如何禁用系统的设备? [英] How do I disable a system device?

查看:302
本文介绍了如何禁用系统的设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来禁用从C#.NET系统设备。

Is there any way to disable a system device from C#.NET.

基本上,当你进入设备管理器和禁用设备的方式模仿?

Basically emulating when you go to Device Manager and disable a device that way?

我假设有一个WinAPI的功能,我可以调用,但我不知道它是哪一个?

I am assuming there is a WinAPI function that I can invoke, but I don't know which one it is?

我需要做的原因是,我需要禁用直后再次启用该设备。

The reason I need to do this is that I need to disable and straight after enable the device again.

我需要在Windows XP和Vista(86&安培; 64)工作。我看了一下所谓的开发者大会,但它似乎并没有工作在Vista 64位。

I need to work in Windows XP and Vista (x86 & x64). I had a look at something called "DevCon" but it doesn't seem to work on Vista x64.

感谢。

要知道答案在这里看到:<一href="http://stackoverflow.com/questions/4097000/how-do-i-disable-a-system-device-programatically">How做我禁用系统设备编程?

For the answer see here: How do I disable a system device programatically?

推荐答案

要futher梅尔·格林的答案,硬件辅助库使用互操作调用Windows API(SetupAPI的),特别是SetupDiSetClassInstallParams方法。当然也有其他呼叫这里这是用来查找设备的详细信息等。

To futher Mel Green's answer, the hardware helper library uses interop to call the Windows API (setupapi), specifically the SetupDiSetClassInstallParams method. Of course there are other calls here which are used to look up the device details etc.

有一点需要注意,如果你正在运行作为一个标准用户或未经授权的帐户,您将无法使用此控制(启用​​/禁用等)的硬件设备。

One thing to consider that if you are running as a standard user or unprivileged account you will not be able to use this to control (enable/disable etc) hardware devices.

有关详细信息看看 http://www.pinvoke.net (和特定的呼叫:<一href="http://pinvoke.net/default.aspx/setupapi.SetupDiSetClassInstallParam">http://pinvoke.net/default.aspx/setupapi.SetupDiSetClassInstallParam )

For more details have a look at http://www.pinvoke.net (and for the specific call: http://pinvoke.net/default.aspx/setupapi.SetupDiSetClassInstallParam )

这篇关于如何禁用系统的设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆