DuiLIb无法接收到USB插入消息DBT_DEVICEARRIVAL的解决办法

在需要响应此消息的窗口Init函数中添加以下代码即可:

1     DEV_BROADCAST_DEVICEINTERFACE Filter;
2     ZeroMemory(&Filter, sizeof(Filter));
3     Filter.dbcc_size = sizeof(Filter);     
4     Filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
5     GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72, 0x8a,0x6d,0xb5,0x4c,0x2b,0x4f,0xc8,0x35 };
7     Filter.dbcc_classguid = WceusbshGUID;
8     //DEVICE_NOTIFY_ALL_INTERFACE_CLASSES //关注所有设备事件  
9     HDEVNOTIFY m_hDeviceNotify = RegisterDeviceNotification(this->m_hWnd, &Filter, 0x00000004);

 

 

  

posted @ 2017-03-28 11:24  卖杏花的陆游  阅读(1215)  评论(1编辑  收藏  举报