libusb开发,在MFC下怎么实现USB设备热插拔?

夜小白945 2016-09-09 09:49:37
在VC6.0下做STM32的libusb上位机, 我在检测连接状态时采用了定时器,由于设备不能重复打开,所以热插拔功能不知道怎么实现,求助!谢谢
...全文
1299 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
林夕Style_ 2018-12-10
  • 打赏
  • 举报
回复
老哥 我现在也在做libusb的开发 mfc界面下 我想要开辟一个线程 一直检测usb 调用的USBcheck函数 在此之前调用了USBscanfdev 扫描和USBOpen 发现USB断线后 扫描和打开的返回值不会变化 后来修改源码 扫描之前先置空flag 清空设备列表, 但是运行多次后 check会中断 不明白为什么 老哥你怎么解决的
赵4老师 2016-09-09
  • 打赏
  • 举报
回复
英语也是一门计算机语言的说。 查MSDN是Windows程序员必须掌握的技能之一。 http://bbs.csdn.net/topics/390374955
zgl7903 2016-09-09
  • 打赏
  • 举报
回复
夜小白945 2016-09-09
  • 打赏
  • 举报
回复
老师啊,你回复的好深奥,看不懂,能用中文说一下方法吗?谢谢
赵4老师 2016-09-09
  • 打赏
  • 举报
回复
WM_DEVICECHANGE The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer. Event = (UINT) wParam; dwData = (DWORD) lParam; Parameters Event Event type. This parameter can be one of the following values: Value Meaning DBT_CONFIGCHANGECANCELED A request to change the current configuration (dock or undock) has been canceled. DBT_CONFIGCHANGED The current configuration has changed, due to a dock or undock. DBT_DEVICEARRIVAL A device has been inserted and is now available. DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. Any application can deny this request and cancel the removal. DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled. DBT_DEVICEREMOVECOMPLETE A device has been removed. DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied. DBT_DEVICETYPESPECIFIC A device-specific event has occurred. DBT_QUERYCHANGECONFIG Permission is requested to change the current configuration (dock or undock). DBT_USERDEFINED The meaning of this message is user-defined. dwData Address of a structure that contains event-specific data. Its meaning depends on the given event. Return Values Return TRUE to grant a requested action. Return BROADCAST_QUERY_DENY to deny a requested action. Remarks For devices that offer software-controllable features, such as ejection and locking, the system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully. If the system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so. DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED QuickInfo Windows NT: Requires version 4.0 or later. Windows: Requires Windows 95 or later. Windows CE: Unsupported. Header: Declared in winuser.h. See Also System Messages Overview, System Message Messages

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧