Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WM_DEVICECHANGE message under XP

1 view
Skip to first unread message

al

unread,
Nov 26, 2002, 8:32:42 AM11/26/02
to
I have a USB-RS232 serial port adapter.

When I connect/disconnect this device I should receive a WM_DEVICECHANGE
message with LParam == DBT_DEVICEARRIVAL / DBT_DEVICEREMOVECOMPLETE.

It works under Windows 2000, but it does not work under Windows XP.

I receive a WM_DEVICECHANGE messages under XP only with
LParam==DBT_DEVNODES_CHANGED.

Did anybody work with WM_DEVICECHANGE message under XP?

Thanks in advance.


Jim Cavalaris [MS]

unread,
Nov 26, 2002, 6:25:46 PM11/26/02
to
if you mean the DBT_DEVTYP_PORT type of WM_DEVICECHANGE
DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE
messages, this was fixed with windows XP SP1.

for a solution that will work on windows 2000, XP RTM, XP SP1, and
later, your program could use RegisterDeviceNotification with a
NotificationFilter of type DBT_DEVTYP_DEVICEINTERFACE
(DEV_BROADCAST_DEVICEINTERFACE structure) to register for
arrival and removal notification events for members of the
GUID_DEVINTERFACE_COMPORT device interface class.

RegisterDeviceNotification:
http://msdn.microsoft.com/library/en-us/devio/base/registerdevicenotification.asp

Registering for Device Notification:
http://msdn.microsoft.com/library/en-us/devio/base/registering_for_device_notification.asp

Introduction to Device Interfaces:
http://msdn.microsoft.com/library/en-us/install/hh/install/setup-cls_8vs7.asp

when notified of a device interface DBT_DEVICEARRIVAL or
DBT_DEVICEREMOVECOMPLETE removal event (dbch_devicetype
is DBT_DEVTYP_DEVICEINTERFACE), the corresponding
DEV_BROADCAST_DEVICEINTERFACE structure will contain a path
you can use to access the device in the dbcc_name field.

DEV_BROADCAST_DEVICEINTERFACE:
http://msdn.microsoft.com/library/en-us/devio/base/dev_broadcast_deviceinterface_str.asp

hope this helps,
jim.

"al" <a...@pronan.zp.ua> wrote in message news:#Z3rWBVlCHA.2800@tkmsftngp04...

0 new messages