系统会发出WM_DEVICECHANGE消息。<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> private<br> { Private declarations }<br> public<br> procedure WndProc(var Message: TMessage); override;<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.WndProc(var Message: TMessage);<br>begin<br> inherited;<br> if Message.Msg = WM_DEVICECHANGE then<br> begin<br> // 系统硬件改变了<br> end;<br>end;<br><br>end.<br>