31-10-2014, 11:19 AM
31-10-2014, 07:15 PM
وعليكم السلام ورحمة الله تعالى وبركاته.
كود :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,u_usb;
type
TForm1 = class(TForm)
procedure usbin(sender:tobject);
procedure usbout(sender:tobject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
test: tcomponentusb;
implementation
{$R *.dfm}
procedure TForm1.usbin(sender: tobject);
begin
showmessage('تم ادخال الفلاش ديسك');
end;
procedure TForm1.usbout(sender: tobject);
begin
showmessage('تم اخراج الفلاش ديسك');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
test:=tcomponentusb.create(self);
test.OnUSBArrival:=usbin;
test.OnUSBRemove:=usbout;
end;
end.31-10-2014, 11:42 PM
شكرا جزيلا يا اخي بارك الله فيك
04-11-2014, 11:00 AM
اخي بن دهبية ما رايك باضافة تعليمة هدم في الحدث
إقتباس :procedure tform1.formcreate(sender: Tobject);
begin
test:=tcomponentusb.create(self);
test.onusbarrival:=usbin;
test.onusbremove:=usbout;
test.destroycomponents;
end