Re: WM_DEVICECHANGE PARAMETERS

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,
Thanks for your tips.
I got it working for the devices I mentioned, by just registerring for
keyboards.
Disks and ports are an exception, and are always notified "with data".

Unfortunately the custom USB-comport-device thats produced in-house by the
company I work for, somehow is not the same as another USB-COM device I have.
They both appear in devicemanager under ports (class), and are both shown by
XP as a comport (deviceinterface ?) .

The custom (self-built) device however, does not produce a notification
"with data", as the other (bought) device does. The device programmer tells
me that the device has the following properties (part of descriptor):

0x02, /* bcdUSB = 2.00 */
0x02, /* bDeviceClass: CDC */
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0 */

Any idea what could be wrong here ?
Strange that in XP-devicemanager, and under WinCE everything is OK.
Just the notification is giving me trouble.

Greetings,
Rob.


"Doron Holan [MSFT]" wrote:

the device arrival message will include the device interface GUID and will
include the symbolic link name to the device.

WM_DEVICECHANGE
http://msdn.microsoft.com/en-us/library/aa363205(VS.85).aspx

DEV_BROADCAST_DEVICEINTERFACE Structure
http://msdn.microsoft.com/en-us/library/aa363244(VS.85).aspx

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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:28F01714-9D35-408B-A3DF-4E63C8C46AE9@xxxxxxxxxxxxxxxx
Hi,
Thanks, I'll try that first thing tomorrow.

I assume you mean this is done by calling the register function multiple
times with differrent GUIDS, and I assume that the resulting
WM_DEVICECHANGE
will have usefull info then ? (if I register for "all classes" I just get
class guids, but if I register for keyboard I should get the keyboard guid
in
the response ?) , Right ?

Do you happen to know where I can find the devicename of the inserted
device
?
I did see a sample where some long , very cryptic devicename was
retrieved,
but not the short form like KBD1:,COM1: etc...

Greetings,
Rob.





"Doron Holan [MSFT]" wrote:

yes, of course you can register for multiple notifications. for
keyboards
you should GUID_DEVINTERFACE_KEYBOARD, not the HID guid.

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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0153784F-2B33-43C4-B915-C121014F7BE5@xxxxxxxxxxxxxxxx
Hi,
I need to monitor several types of devices at the same time :
- keyboard (not all HID's)
- Comports
- Disks

Can I register multiple times for this ?

Greetings,
Rob.


"Doron Holan [MSFT]" wrote:

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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A51D55EF-F958-40F2-920C-1AD0DB3D73A8@xxxxxxxxxxxxxxxx
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/HwDetect.aspx?display=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_INTERFACE_CLASSES);

//****** end CODE fragment: ******



Greetings,
Rob.




"rseedle" wrote:

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






.



Relevant Pages

  • Re: WM_DEVICECHANGE PARAMETERS
    ... Please do not send e-mail directly to this alias. ... Just the notification is giving me trouble. ... I assume you mean this is done by calling the register function ... but if I register for keyboard I should get the keyboard ...
    (microsoft.public.development.device.drivers)
  • Re: WM_DEVICECHANGE PARAMETERS
    ... the device arrival message will include the device interface GUID and will include the symbolic link name to the device. ... Please do not send e-mail directly to this alias. ... I assume you mean this is done by calling the register function multiple ... but if I register for keyboard I should get the keyboard guid in ...
    (microsoft.public.development.device.drivers)
  • Re: WM_DEVICECHANGE PARAMETERS
    ... 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 ... Please do not send e-mail directly to this alias. ... See codefragment below for the right way to register, ... My problem is that when I plug in a device (like a COMPORT) I would like to ...
    (microsoft.public.development.device.drivers)
  • Re: New Neo-Narnia book coming in two weeks!
    ... keyboard and typed: ... Mark Goodge writes ... The word "Narnia" is not subject to copyright. ... I had this long argument with them when I tried to register ...
    (uk.religion.christian)
  • Re: UK Poultry Register
    ... notification from SERAD to register any poultry I might have, ... any information as to who has to register. ... It seems that all equines must now have a passport. ... been notified of this fact by SERAD, or asked if I keep equines. ...
    (uk.business.agriculture)