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?
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.
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.
Thanks.
For the answer see here: How do I disable a system device programatically?
This article at CodeProject has some really nifty C# code for accomplishing this:
http://www.codeproject.com/KB/cs/HardwareHelper.aspx
In the end you simply make a call such as:
HH_Lib hwh = new HH_Lib();
hwh.SetDeviceState("MyDevice", /*Enable*/ true);
hwh.SetDeviceState("MyDevice", /*Disable*/ false);