请问wm_drivechang的详细用法!(50分)

  • 主题发起人 主题发起人 wein
  • 开始时间 开始时间
W

wein

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,特别是它的各个返回参数是什么意思!

有人曾回答我说:
The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.

Event = (UINT) wParam;
dwData = (DWORD) lParam;


Parameters

Event

Event type. This parameter can be one of the following values:

Value Meaning
DBT_CONFIGCHANGECANCELED A request to change the current configuration (dock or undock) has been canceled.
DBT_CONFIGCHANGED The current configuration has changed, due to a dock or undock.
DBT_DEVICEARRIVAL A device has been inserted and is now available.
DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. Any application can deny this request and cancel the removal.
DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled.
DBT_DEVICEREMOVECOMPLETE A device has been removed.
DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied.
DBT_DEVICETYPESPECIFIC A device-specific event has occurred.
DBT_QUERYCHANGECONFIG Permission is requested to change the current configuration (dock or undock).
DBT_USERDEFINED The meaning of this message is user-defined.


dwData

Address of a structure that contains event-specific data. Its meaning depends on the given event.



Return Values

Return TRUE to grant a requested action.
Return QUERY_BROADCAST_DENY to deny a requested action.

Remarks

For devices that offer software-controllable features, such as ejection and locking, the operating system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully.
If the operating system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.
DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED


不过我在使用这个函数时,已经使CDROM打开了,
这样使用:
procedure tform1.wmdevicechange(var msg:tmessage);
begin
if msg.wparam=DBT_DEVICEREMOVEPENDING then
msg.result:=true;
而delphi5系统却是报出错,DBT_DEVICEREMOVEPENDING 出现什么错误!
我已经在开头声明了这个函数了!

希望大家能给我一个解答,谢谢!
 
怎么这么长时间还是没有人来支持,回答我??
 
我也想知道,每次用它,都提示没定义
 
wein:如果你还要继续讨论请定期提前你的帖子,如果不想继续讨论请结束帖子。
 
请继续或结束
 
请继续或结束
 
多人接受答案了。
 
后退
顶部