真的不能用了?(300分)

  • 主题发起人 主题发起人 Chenlili
  • 开始时间 开始时间
C

Chenlili

Unregistered / Unconfirmed
GUEST, unregistred user!
有一条消息,在win2k下面不能用了,真的吗?<br>&nbsp; &nbsp; procedure WMDeviceChange(var Msg: TMsg); message WM_DEVICECHANGE;<br>&nbsp; &nbsp; &nbsp;{ Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br>procedure TForm1.WMDeviceChange(var Msg: TMsg);<br>const <br>DBT_QUERYCHANGECONFIG &nbsp; &nbsp; &nbsp; = $0017; <br>DBT_CONFIGCHANGED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $0018; <br>DBT_CONFIGCHANGECANCELED &nbsp; &nbsp;= $0019; <br>DBT_DEVICEARRIVAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $8000; <br>DBT_DEVICEQUERYREMOVE &nbsp; &nbsp; &nbsp; = $8001; <br>DBT_DEVICEQUERYREMOVEFAILED = $8002; <br>DBT_DEVICEREMOVEPENDING &nbsp; &nbsp; = $8003; <br>DBT_DEVICEREMOVECOMPLETE &nbsp; &nbsp;= $8004; <br>DBT_DEVICETYPESPECIFIC &nbsp; &nbsp; &nbsp;= $8005; <br>DBT_USERDEFINED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $FFFF; <br>begin<br>&nbsp; inherited;<br>&nbsp; &nbsp; if Msg.wParam = DBT_DEVICEREMOVEPENDING &nbsp;then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// user has started to eject CD<br>&nbsp; &nbsp; &nbsp; &nbsp; // Tell Windows it's OK.<br>&nbsp; &nbsp; &nbsp; &nbsp; Caption := 'Open';<br><br>&nbsp; &nbsp; &nbsp; end;<br>end;
 
&nbsp;<br>&nbsp; Platform SDK: Hardware <br>WM_DEVICECHANGE<br>The WM_DEVICECHANGE device message notifies an application of a <br>change to the hardware configuration of a device or the computer.<br><br>A window receives this message through its WindowProc function. <br><br>LRESULT CALLBACK WindowProc(<br>&nbsp; HWND hwnd, &nbsp; &nbsp; &nbsp; // handle to window<br>&nbsp; UINT uMsg, &nbsp; &nbsp; &nbsp; // WM_DEVICECHANGE<br>&nbsp; WPARAM wParam, &nbsp; // device-change event<br>&nbsp; LPARAM lParam &nbsp; &nbsp;// event-specific data<br>);<br>Parameters<br>wParam <br>Specifies the event. This parameter can be one of the following values. <br>Value Meaning <br>DBT_CONFIGCHANGECANCELED &nbsp;A request to change the current configuration <br>(dock or undock) has been canceled. <br>DBT_CONFIGCHANGED The current configuration has changed, due to a dock <br>or undock. &nbsp;<br>DBT_CUSTOMEVENT Windows 98 and Windows 2000: A custom event has occurred. <br>DBT_DEVICEARRIVAL A device has been inserted and is now available. &nbsp;<br>DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. <br>Any application can deny this request and cancel the removal. <br>DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled. <br>DBT_DEVICEREMOVECOMPLETE A device has been removed. <br>DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied. <br>DBT_DEVICETYPESPECIFIC A device-specific event has occurred. <br>DBT_QUERYCHANGECONFIG &nbsp;Permission is requested to change the current <br>configuration (dock or undock). &nbsp;<br>DBT_USERDEFINED &nbsp;The meaning of this message is user-defined. <br><br><br>lParam <br>Pointer to a structure that contains event-specific data. Its format <br>depends on the value of the wParam parameter. For more information, refer <br>to the documentation for each event. <br>Return Values<br>Return TRUE to grant the request.<br><br>Return BROADCAST_QUERY_DENY to deny the request.<br><br>Remarks<br>For devices that offer software-controllable features, such as ejection and <br>locking, the system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully. If the system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.<br><br>Requirements <br>&nbsp; Windows NT/2000: Requires Windows NT 4.0 or later.<br>&nbsp; Windows 95/98: Requires Windows 95 or later.<br>&nbsp; Header: Declared in Winuser.h; include Windows.h.<br><br>See Also<br>Device Management Overview, Device Management Messages, <br>DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_CUSTOMEVENT, <br>DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, <br>DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, <br>DBT_QUERYCHANGECONFIG, DBT_USERDEFINED<br><br>Built on Thursday, October 12, 2000Requirements <br>&nbsp; Windows NT/2000: Requires Windows NT 4.0 or later.<br>&nbsp; Windows 95/98: Requires Windows 95 or later.<br>&nbsp; Header: Declared in Winuser.h; include Windows.h.<br>See Also<br>Device Management Overview, Device Management Messages, <br>DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_CUSTOMEVENT, <br>DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, <br>DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, <br>DBT_QUERYCHANGECONFIG, DBT_USERDEFINED<br>
 
接受答案了.
 
后退
顶部