检测USB连接 - C#.NET CF 3.5 [英] Detecting USB Connection -- C# .Net CF 3.5
问题描述
我有一个是Windows Mobile 6.1设备上的应用程序(.NET Compact Framework的3.5)的运行,我想当USB连接的变化(无论是东西连接或断开连接)来检测。
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 disconnects).
我原来使用 SystemProperty.CradlePresent
属性触发事件,但我想知道如果这仅适用于当连接该设备具有ActiveSync的?我会收到来自不具有在其上运行的ActiveSync Linux设备通过USB连接。
I was originally using the SystemProperty.CradlePresent
property to trigger an event but I am wondering if this only works if the device connecting has ActiveSync? I will be receiving a connection via USB from a Linux device that does not have ActiveSync running on it.
我仍然可以使用 SystemProperty.CradlePresent
来检测来自USB的连接/断开?或者我需要寻求其他选项检测USB事件?谢谢
Can I still use SystemProperty.CradlePresent
to detect the connect/disconnect from the USB? Or do I need to explore other options to detect the USB event? Thanks.
推荐答案
这也许以前我的问题可以帮助:
Perhaps this previous question of mine may help:
我如何检测USB断开事件? (在Windows,.NET C#应用程序)
我结束了监听和处理 WM_DEVICECHANGE
事件。他们在这里规定: http://msdn.microsoft.com /en-us/library/aa363480(VS.85).aspx
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.
这篇关于检测USB连接 - C#.NET CF 3.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!