Click to See Complete Forum and Search --> : How to differentiate a virtual device arrival/removal than a (real) physical device?
JoderCoder
July 4th, 2008, 12:07 PM
In my application that does some audio-related stuff, I constantly receive WM_DEVICECHANGE - DBT_DEVICEARRIVAL from the Vista Business OS, although there is no actual device arrivals nor removals. I think somewhere in the code or some other application could be adding some virtual devices on the ports, so I reckon that kicks off these events.
I think what I should do is to try to find a way to distinguish virtual device notifications than physical device notification.
Anyone has any idea how to achieve this?
Thanks in advance!
TheCPUWizard
July 4th, 2008, 12:54 PM
Examine the device type???
JoderCoder
July 4th, 2008, 03:24 PM
Thanks, but how can I examine the device type? Sorry but I am not that familiar with this area. I was handed over the code.
TheCPUWizard
July 4th, 2008, 03:37 PM
Thanks, but how can I examine the device type? Sorry but I am not that familiar with this area. I was handed over the code.
Did you consider reading the documentation??? :confused: :confused: :confused:
http://msdn.microsoft.com/en-us/library/aa363205(VS.85).aspx
lParam
A pointer to a structure identifying the device inserted. The structure consists of an event-independent header, followed by event-dependent members that describe the device. To use this structure, treat the structure as a DEV_BROADCAST_HDR structure, then check its dbch_devicetype member to determine the device type.
JoderCoder
July 10th, 2008, 06:44 AM
Ok thanks! Learnt a lot! Surely not enough!
Another question: My code is like this
broadcastInterface.dbcc_classguid = KSCATEGORY_AUDIO ;
RegisterDeviceNotification(hWnd, &broadcastInterface, DEVICE_NOTIFY_WINDOW_HANDLE);
I have to register for KSCATEGORY_AUDIO category devices. This is broad category of audio devices. But when I receive DBT_DEVICEARRIVAL, I need to take action if the arrived device is USB device only. Could you suggest any idea how to achieve this? Unfortunately registering for USB devices is not an option.
Also if I do a check on dbcc_classguid == GUID_DEVINTERFACE_USB_DEVICE, this is not gonna happen because we registered for KSCATEGORY_AUDIO.
But I should be able to something as the device belongs to both GUID_DEVINTERFACE_USB_DEVICE and KSCATEGORY_AUDIO group.
Thanks much!
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.