Detecting USB Connection — C# .Net CF 3.5

后端 未结 2 781
暗喜
暗喜 2021-02-19 22:27

I have an application (.Net Compact Framework 3.5) running on a Windows Mobile 6.1 device and I want to detect when the USB connection changes (either something connects or disc

2条回答
  •  爱一瞬间的悲伤
    2021-02-19 22:53

    Perhaps this previous question of mine may help:

    How can I detect a USB disconnect event? (Windows, .NET C# application)

    I ended up listening for and handling WM_DEVICECHANGE events. They are specified here: http://msdn.microsoft.com/en-us/library/aa363480(VS.85).aspx

    Unfortunately I don't have a copy of the source code anymore so my memory on it is a bit hazy. I don't know if this solution applies in your context.

提交回复
热议问题