Detecting USB Connection — C# .Net CF 3.5

China☆狼群 提交于 2019-12-04 02:22:10
Jon

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.

Check this out, you might be able to grab part of the source code. Its written in C# with a GUI. Keep in mind every time you have a program running that is checking for new USB drives, it will take up memory and CPU so you might want to tone down the intervals at which it checks and then supply a "refresh" button for impatient users.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!