?? unit1.~pas
字號:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, LMDControl, LMDBaseControl, LMDBaseGraphicControl,
LMDBaseLabel, LMDCustomSimpleLabel, LMDSimpleLabel, CPortCtl;
type
PDEV_BROADCAST_HDR = ^TDEV_BROADCAST_HDR;
TDEV_BROADCAST_HDR = packed record
dbch_size : DWORD;
dbch_devicetype : DWORD;
dbch_reserved : DWORD;
end;
PDEV_BROADCAST_VOLUME = ^TDEV_BROADCAST_VOLUME;
TDEV_BROADCAST_VOLUME = packed record
dbcv_size : DWORD;
dbcv_devicetype : DWORD;
dbcv_reserved : DWORD;
dbcv_unitmask : DWORD;
dbcv_flags : WORD;
end;
type
TForm1 = class(TForm)
Memo1: TMemo;
LMDSimpleLabel1: TLMDSimpleLabel;
Button1: TButton;
Edit1: TEdit;
ComLed1: TComLed;
private
{ D閏larations priv閑s }
procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
public
{ D閏larations publiques }
end;
var
Form1: TForm1;
GetLettre : string;
implementation
{$R *.dfm}
///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
//
// Detecter la Connection/D閏onnection de p閞iph閞iques USB de stockage "STORAGE"
// M閙 FLASH, HDD , M閙 app photo , MP3...
//
// Rylou 27/01/2005 21:44
//
///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Capture Evenement windows "WMDeviceChange"
procedure TForm1.WMDeviceChange(var Msg: TMessage);
var
VolName, FileSysName : Array[0..Max_Path]Of Char;
VolSerial, FileMaxLen, FileFlags : DWord;
S : string;
begin
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TESTER si DBT_DEVICEARRIVAL = $8000
// si oui, ne traiter que les p閞iph閞iques de stockage de type 0=DeviceTypeOEM
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
if Msg.wParam =$8000 then begin
if PDEV_BROADCAST_HDR( Msg.LParam )^.dbch_devicetype <>2 then exit;
if PDEV_BROADCAST_VOLUME( Msg.LParam )^.dbcv_flags <>0 then exit;
// A partir d'ici vous pouvez mettre votre code a executer en cas
// de connection d'un peripherique de stockage USB.
// Vous pouvez aussi par exemple comparer le "Non de volume"
// de ce p閞ipph閞ique pour affiner le declenchement.
//Affiche dans le textbox les infos du periph閞ique conn閏t
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -