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

RegisterDeviceNotification, GUIDs & ON_WM_DEVICECHANGE

85 views
Skip to first unread message

nevil

unread,
Sep 29, 2004, 6:08:11 PM9/29/04
to
Windows sends ON_WM_DEVICECHANGE notifications to all top level
windows. How do I register so that I get notifications for my own
devices? i.e. My device has its own GUID.

One would have thought that you call RegisterDeviceNotification
specifying the GUID you are interested in and OnDeviceChange would be
invoked for those devices only. But it is getting invoked for all
sorts of devices ! How do I tell windows to notify me only for devices
with a particular GUID?

Thanks
Nevil.

Mark Cariddi

unread,
Sep 30, 2004, 1:01:23 PM9/30/04
to
I don't understand, you do have to specify a GUID in the parameters you pass
to this request, for example

// Register to receive notification when a USB device is plugged in.
broadcastInterface.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
broadcastInterface.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;

memcpy( &(broadcastInterface.dbcc_classguid),
&(GUID_CLASS_USB_DEVICE),
sizeof(struct _GUID));

m_NotifyDevHandle = RegisterDeviceNotification(m_hWnd,
&broadcastInterface,
DEVICE_NOTIFY_WINDOW_HANDLE);

This will only recevie USB device messages...

--
Mark Cariddi
Consulting Associate
OSR, Open Systems Resources, Inc.
http://www.osr.com/
"nevil" <nev...@gmail.com> wrote in message
news:2b1b9a62.04092...@posting.google.com...

nevil

unread,
Sep 30, 2004, 5:13:32 PM9/30/04
to
The problem was not the one I discribed, it was actually because
OnDeviceChange was getting DBT_DEVNODES_CHANGED messages instead of
DBT_DEVICEARRIVAL.
0 new messages