Programmatically enabling/disabling hardware device [duplicate]

不问归期 提交于 2019-11-30 17:18:56

问题


Possible Duplicates:
[.NET] How do I disable a system device?
Win32 API function to programatically enable/disable device

Is there a way, in C#, to programmatically disable and re-enable a device? I'm looking for essentially the same functionality that occurs when you go into device manager and right click on a device and disable or enable it. How can I do this in C#?


回答1:


Take a look at net-how-do-i-disable-a-system-device.




回答2:


According to this link: http://bytes.com/topic/c-sharp/answers/513855-can-i-use-wmi-c-disable-enable-device

You need to interface with CfgMgr32 (Win32 API) to do this.

My first thought was to look at WMI but it's not there.

DevCon, which comes with the Device Drive Toolkit, provides a CLI to do this.

http://msdn.microsoft.com/en-us/library/ff541193(VS.85).aspx



来源:https://stackoverflow.com/questions/3498042/programmatically-enabling-disabling-hardware-device

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