PDA

View Full Version : سوال: راهنمایی در مورد کامپوننت USBDetector



MahmoodM30
چهارشنبه 25 بهمن 1391, 13:15 عصر
سلام

میخواستم دوستان راهنمایی کنن که توی این کد چیکار کنم که با کلیک رو ی دکمه تشخیص بده که فلش به USB

متصل شده هست یا نه؟

ممنون از دوستان


unit F_Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, USBDetect;

type
TFRM_Main = class(TForm)
USBDetector1: TUSBDetector;
MEM_Status: TMemo;
procedure USBDetector1Arrival(Sender: TObject; Drive: string);
procedure USBDetector1Removed(Sender: TObject; Drive: string);
private
{ Private declarations }
public
{ Public declarations }
end;

var
FRM_Main: TFRM_Main;

implementation

{$R *.dfm}

procedure TFRM_Main.USBDetector1Arrival(Sender: TObject; Drive: string);
begin
// Detect new USB device connected and return drive name
MEM_Status.Lines.Add('+ New USB device arrival = ' + Drive);
end;

procedure TFRM_Main.USBDetector1Removed(Sender: TObject; Drive: string);
begin
// Detect removed USB device disconnected and return drive name
MEM_Status.Lines.Add('- Removed USB device = ' + Drive);
end;

end.