c# - DeviceAttached message never comes -
i trying develop c# application can communicate usb hid. have overriden wndproc method catches of wm_devicechange events , passes devicechange method method ondevicechange (this code borrowed jan axelson) looks this....
protected override void wndproc( ref message m ) { try { // ondevicechange routine processes wm_devicechange messages. if ( m.msg == devicemanagement.wm_devicechange ) { ondevicechange( m ); } // let base form process message. base.wndproc( ref m ); } catch ( exception ex ) { displayexception( this.name, ex ); throw ; } }
for reason though, everytime plug in device, whether mouse or keyboard or device developing, hid's, value of wparam 0x7;
i checked in dbt.h , value of 0x0007 ...
#define dbt_devnodes_changed 0x0007 /* * message = wm_devicechange * wparam = dbt_querychangeconfig * lparam = 0 * * sent ask if config change allowed */....
i don't stop after first message comes in either @ messages , every 1 value 0x0007. why never seeing deviceattached or deviceremoved events?
anyone usb experience have ideas?
you need register device in order receive attached , removed. see registerdevicenotification. here great example going.
Comments
Post a Comment