unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
private
procedure wmdevicechange(var msg:tmessage);
message WM_DEVICECHANGE; { Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
procedure tform1.wmdevicechange(var msg:tmessage);
const
DBT_DEVICEARRIVAL=$8000;
DBT_DEVICEMOVECOMPLETE=$8004;
var
tempstr:string;
begin
inherited;
case msg.WParam of
DBT_DEVICEARRIVAL :tempstr:='你插入了CD';
DBT_DEVICEMOVECOMPLETE :tempstr:='你弹出了CD';
end;
showmessage(tempstr);end;end.
看一下这个例子吧!
捕获光区消息的例子!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
private
procedure wmdevicechange(var msg:tmessage);
message WM_DEVICECHANGE; { Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
procedure tform1.wmdevicechange(var msg:tmessage);
const
DBT_DEVICEARRIVAL=$8000;
DBT_DEVICEMOVECOMPLETE=$8004;
var
tempstr:string;
begin
inherited;
case msg.WParam of
DBT_DEVICEARRIVAL :tempstr:='你插入了CD';
DBT_DEVICEMOVECOMPLETE :tempstr:='你弹出了CD';
end;
showmessage(tempstr);end;end.
看一下这个例子吧!
捕获光区消息的例子!
解决方案 »
- 求指点 多台机器GPRS通讯的方法
- 根据窗口句柄,如何对在其内部定义的Record类型的变量进行编程?高手作答!!!老急了!!!!!!!!!
- quickreport报表循环连续打印问题?
- 请问DELPHI的打印对话框PrintDialog控件和PrinterSetupDialog1控件有什么用啊?万分感谢
- 影院售票系统
- 打开一个excel文件,读取其中的单元数据,存入数组,如何实现
- 主从表更新失败,主表主键为autoinc类型
- 帮忙
- delphi控制excel2000的问题,急,请帮忙!!
- 这段sql代码错误多多,请帮我看看。
- 新手上路,但是也许高手做不了!进来看看就知道啦,分数不够可以再加!
- SQL查询问题?(高手请进)
可以使用,但是还有没有其它的方法?这种方法可以在使用任何打开/关闭光驱的方法前,直接先行检测光驱门的状态,而不用事先使用任何打开/关闭光驱的方法或者函数?