在需要响应此消息的窗口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);

 

 

  

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2021-12-17
  • 2021-09-17
  • 2022-12-23
  • 2021-07-15
  • 2021-06-02
  • 2022-02-13
猜你喜欢
  • 2021-12-08
  • 2022-12-23
  • 2021-03-31
  • 2021-04-27
  • 2021-09-12
  • 2021-07-28
  • 2021-09-16
相关资源
相似解决方案