有谁知Plug & play 的 (200分)

  • 主题发起人 主题发起人 yxjdelphi
  • 开始时间 开始时间
Y

yxjdelphi

Unregistered / Unconfirmed
GUEST, unregistred user!
有谁知Plug & play 的
 
系统会发出WM_DEVICECHANGE消息。<br><br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; procedure WndProc(var Message: TMessage); override;<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.WndProc(var Message: TMessage);<br>begin<br>&nbsp; inherited;<br>&nbsp; if Message.Msg = WM_DEVICECHANGE then<br>&nbsp; begin<br>&nbsp; &nbsp; // 系统硬件改变了<br>&nbsp; end;<br>end;<br><br>end.<br>
 
http://www.tiantiansoft.com/Article_Show.asp?ArticleID=97<br>参考一下。
 
接受答案了.
 
后退
顶部