- WM_DEVICECHANGE PARAMETERS
- Posted by rseedle on October 18th, 2007
I am recieving the plug in / unplug events correctly but the WPARAM always
has a 7 in it. If I understand correctly the WPARAM should specify the values
DBT_DEVICEARRIVAL 0x8000
and
DBT_DEVICEREMOVECOMPLETE 0x8004
What is up with that ?
Randy Seedle
- Posted by Farhan Ahmed [MSFT] on October 19th, 2007
Could you share more information about what you are registering for and with
what flags?
And also, do you mean 0x7 or 7 in base 10? 0x0007 is DBT_DEVNODES_CHANGED
and is broadcast to all window handles regardless of whether they are
registered for device notifications or not (for compatibility with 9x).
Thanks,
Farhan
"rseedle" <rseedle@discussions.microsoft.com> wrote in message
news:455DA823-0523-4626-8ABE-627696174559@microsoft.com...
- Posted by Farhan Ahmed [MSFT[ on October 19th, 2007
I just realized that my question about the base seems quirky
What I meant
to ask was when you say that WPARAM always has a 7 in it, do you mean the
value is exactly 7, or if the hex representation contains a 7 somewhere in
it?
Regardless, it seems pretty likely that you are receiving the
DBT_DEVNODES_CHANGED notification.
Farhan
"Farhan Ahmed [MSFT]" <farhanah@online.microsoft.com> wrote in message
news:#JsZHqeEIHA.3548@TK2MSFTNGP06.phx.gbl...
- Posted by rseedle on October 19th, 2007
This is a USB product. It uses Silicon Labs CP2102 communications
microcontroller. It is registered with a GUID which is specific to Silicon
Labs. The WPARAM is 0x7. The registration function looks like this.
void USB_event::RegisterNotification()
{
DEV_BROADCAST_DEVICEINTERFACE devIF = {0};
devIF.dbcc_size = sizeof(devIF);
devIF.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
devIF.dbcc_classguid = GUID_INTERFACE_CP210x; //MY_DEVICE_GUID;
m_hNotifyDevNode = RegisterDeviceNotification(window_ptr->winId(),
&devIF, DEVICE_NOTIFY_WINDOW_HANDLE);
}
The GUID looks like this:
DEFINE_GUID(GUID_INTERFACE_CP210x, 0x993f7832, 0x6e2d, 0x4a0f, 0xb2, 0x72,
0xe2, 0xc7, 0x8e, 0x74, 0xf9, 0x3e);
Randy Seedle
"Farhan Ahmed [MSFT[" wrote:
- Posted by Farhan Ahmed [MSFT] on October 19th, 2007
Yes, as I mentioned, 0x7 is DBT_DEVNODES_CHANGED and is broadcast to all
window handles regardless of registration state (you'll get it even if you
don't register using RegisterDeviceNotification()).
More about it here:
http://msdn2.microsoft.com/en-us/library/aa363211.aspx
You can just ignore this message if it's not interesting to you.
Thanks,
Farhan
"rseedle" <rseedle@discussions.microsoft.com> wrote in message
news:0D9C2939-89C4-43EC-95FA-E64D5C835691@microsoft.com...
- Posted by Tim Roberts on October 21st, 2007
"Farhan Ahmed [MSFT]" <farhanah@online.microsoft.com> wrote:
He probably meant 7 in octal.
Sorry, couldn't resist.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
- Posted by mooni on March 17th, 2008
Well,
I am also getting same problem. Whenever I plugin my USB device I get
WM_DEVICECHANGE successfully but its wParam contains 0x00000007 and lParam is
0x00000000.
I am using device driver of LIBUSB and I've registered for notification also.
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = GUID_CLASS_VHCTRL;
hdevnotify =
RegisterDeviceNotification(hwnd, &NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE);
Any one who can help me?
"Tim Roberts" wrote:
- Posted by mooni on March 17th, 2008
Well,
I am also getting same problem. I am using LibUSB driver. The problem I am
getting is that whenever I plugin my USB device, I recieve DM_DEVICECHANGED
even but wParam contains 0x00000007 and lParam is 0x00000000. I am
registering notification of these events and code I am using is as follows
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = GUID_CLASS_VHCTRL;
hdevnotify =
RegisterDeviceNotification(hwnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
Anyone who can help me?
-Taimoor
"Tim Roberts" wrote:
- Posted by chris.aseltine@gmail.com on March 17th, 2008
On Mar 17, 2:33 am, mooni <mo...@discussions.microsoft.com> wrote:
My advice is to dump libusb and use WinUSB.
- Posted by Rob on June 13th, 2008
Hi,
I also had the problem that LParam is 0.
See codefragment below for the right (?) way to register, in order to solve
that.
My problem is that when I plug in a device (like a COMPORT) I would like to
know 2 things :
1) WHat kind of device was plugged (comport, I need the IF-GUID I think)
2) What it's devicename is (Like COM1
This seems impossible without to determine from the notification-info.
See : http://69.10.233.10/KB/cs/HardwareHelper.aspx
and : http://www.codeproject.com/KB/system...splay=PrintAll
monitoring the entire devicelist seems the only option.
I hope I'm wrong about this.
Any tips ?
//****** CODE fragment: ******
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
GUID tmp={0,0,0,""};
ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = tmp;
m_hDevNotify = RegisterDeviceNotification(m_hWnd ,&NotificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTE RFACE_CLASSES);
//****** end CODE fragment: ******
Greetings,
Rob.
"rseedle" wrote:
- Posted by Doron Holan [MSFT] on June 13th, 2008
you need to register with a specific device interface. this tells you the
type of device. once you have the devicce instance path on the arrival
notification you can use setupdi to open up the properties for the device
and read the "ComPort" property (for a COM port)
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Rob" <Rob@discussions.microsoft.com> wrote in message
news:A51D55EF-F958-40F2-920C-1AD0DB3D73A8@microsoft.com...