請問要如何判斷CompPor的讀卡機,的卡片取出和插入? |
尚未結案
|
rookie
一般會員 發表:26 回覆:38 積分:12 註冊:2003-04-23 發送簡訊給我 |
我有修改hagar 版主的Fnction
可惜小弟功力不夠,不知如何下手
勞凡各位高手幫幫忙
==========以下是小弟改的==================
procedure TMainPage.WMDeviceChange(var Msgs: TMessage);
const
device_on = DBT_DEVICETYPESPECIFIC;
device_gone = DBT_DEVICEREMOVECOMPLETE;
new_device =DBT_DEVICEARRIVAL;
var
emsgs : string;
begin inherited;
case Msgs.wParam of
device_on : emsgs := 'device_is_on';
device_gone : emsgs := 'device_is_gone';
new_device : emsgs := 'system detected a new device';
end;
ShowMessage(emsgs );
end;
=================================
=============UNIT DBT_H===============
UNIT DBT_H; INTERFACE USES
Windows; // UNIT, DWORD CONST
// Events of WM_DEVICECHANGE (wParam)
DBT_DEVICEARRIVAL = $8000; // system detected a new device
DBT_DEVICEQUERYREMOVE = $8001; // wants to remove, may fail
DBT_DEVICEQUERYREMOVEFAILED = $8002; // removal aborted
DBT_DEVICEREMOVEPENDING = $8003; // about to remove, still avail
DBT_DEVICEREMOVECOMPLETE = $8004; // device is gone
DBT_DEVICETYPESPECIFIC = $8005; // type specific event
DBT_CONFIGCHANGED = $0018; // type of device in DEV_BROADCAST_HDR
DBT_DEVTYP_OEM = $00000000; // OEM- or IHV-defined
DBT_DEVTYP_DEVNODE = $00000001; // Devnode number
DBT_DEVTYP_VOLUME = $00000002; // Logical volume
DBT_DEVTYP_PORT = $00000003; // Port (serial or parallel
DBT_DEVTYP_NET = $00000004; // Network resource // media types in DBT_DEVTYP_VOLUME
DBTF_MEDIA = $0001; // change affects media in drive
DBTF_NET = $0002; // logical volume is network volume TYPE
// Instead of TMessage, use this:
TWMDeviceChange =
RECORD
Msg : Cardinal;
Event : UINT;
dwData : pointer;
Result : LongInt;
END; // In a DBT_DEVICECHANGE or DBT_DEVICEREMOVECOMPLETE event, dwData contains an
// address of a DEV_BROADCAST_HDR structure identifying the device inserted. TDevBroadcastHDR =
PACKED RECORD
dbch_size : DWORD;
dbch_devicetype: DWORD;
dbch_reserved : DWORD;
END;
pDevBroadcastHDR = ^TDevBroadcastHDR; // When the device is of type volume, then we can get some device specific
// information, namely specific information about a logical volume.
TDevBroadcastVolume =
PACKED RECORD
dbcv_size : DWORD;
dbcv_devicetype: DWORD;
dbcv_reserved : DWORD;
dbcv_unitmask : DWORD;
dbcv_flags : WORD;
END;
pDevBroadcastVolume = ^TDevBroadcastVolume;
IMPLEMENTATION
END.
=================================
謝謝
|
rookie
一般會員 發表:26 回覆:38 積分:12 註冊:2003-04-23 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |