弹出:interface
TForm1 = class(TForm)
...
public
procedure WMDeviceChange(var Msg: TMsg); message WM_DEVICECHANGE;implementationprocedure TForm1.WMDeviceChange(var Msg: TMsg);
begin
if Msg.wParam = DBT_DEVICEREMOVEPENDING then
// user has started to eject CD
// Tell Windows it's OK.
Msg.Result := True;
end;
//////////////////////////////////////////////////////
You can write a message handler for the WM_DEVICECHANGE message. If
the CD tray is ejected, the value of wParam of the message will be
DBT_DEVICEREMOVECOMPLETE. Take a look at WM_DEVICECHANGE in the
Win32.hlp
TForm1 = class(TForm)
...
public
procedure WMDeviceChange(var Msg: TMsg); message WM_DEVICECHANGE;implementationprocedure TForm1.WMDeviceChange(var Msg: TMsg);
begin
if Msg.wParam = DBT_DEVICEREMOVEPENDING then
// user has started to eject CD
// Tell Windows it's OK.
Msg.Result := True;
end;
//////////////////////////////////////////////////////
You can write a message handler for the WM_DEVICECHANGE message. If
the CD tray is ejected, the value of wParam of the message will be
DBT_DEVICEREMOVECOMPLETE. Take a look at WM_DEVICECHANGE in the
Win32.hlp
mciSendString('Set cdaudio door open wait', nil, 0, handle);
//关闭光驱
mciSendString('Set cdaudio door closed wait', nil, 0, handle) 关于第二个问题用
BOOL RegisterHotKey(
HWND hWnd, // window to receive hot-key notification
int id, // identifier of hot key ID 例如:$168
UINT fsModifiers, // key-modifier flags 例如:MOD_CONTROL{Ctrl键}
UINT vk // virtual-key code 例如:VK_RETURN{回车键}
);用UnRegisterHotKey(Handle,$168); 在程序结束时取消自定义的热键