Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Shortcut to enable & disable device


31 Mar 2012   #1

Windows 7 x64
 
 
Shortcut to enable & disable device

Hi,
is there a possibility to create shortcut (hotkey or another fast method) to disable and enable device (like in device manager)?
If not for all device, is it possible for built-in cam and/or microphone?
(preferred not by 3rd party aplications)

My System SpecsSystem Spec
.

31 Mar 2012   #2

Windows 7 Professional 64 EFI
 
 

There's not specifically an easy way without a bit of scripting on your part. I attempted to write you a quick VBScript that would use the WMI_SystemDriver class to enumerate all devices that contained the word "camera" in the description and then stop them.

The problem is, my Lenovo webcam doesn't allow that call; the driver exposes itself to the OS as 'unstoppable' in terms of user service control. I have a suspicion that a lot of webcams may work the same way. To get around this, you need to make a DLL call to tell the OS to disable the hardware device, which cannot be done in VBScript.

I could certainly write you such an applet, but then you'd have to simply trust me rather than being able to see what was inside - unless you have access to a C# compiler and just want the source code to compile yourself.

Another alternative that requires a lot of download time but then would allow you to use a simple DOS command to do the toggle is to grab the Windows 7 DDK from Microsoft. Part of the DDK is a utility called Devcon, which is a command-line version of WIndows device manager. A little bit of DOS wizardry with the FOR /F "usebackq..." command to parse a devcon status statement followed by another devcon enable or disable statement would allow you to toggle the hardware state and would get you where you want to be. But it's a huge download for a single stupid file, unless of course you already had use for the WinDDK.
My System SpecsSystem Spec
01 Apr 2012   #3

Windows 7 x64
 
 

I have Microsoft Visual Studio 2010 Ultimate (from MSDN Academic Alliance), but i don't know C# well enough to write such appet. So if you can please share your source code.

I've also try Devcon, i don't have Windows Driver Kit 7.1.0 but i found it in The DevCon command-line utility functions as an alternative to Device Manager
But i don't work well, only 32bit version starts (i have 64bit system)

Code:
C:\Users\Michał\AppData\Local\Temp\i386>devcon.exe status "USB\VID_064E&PID_F300&MI_00*"
USB\VID_064E&PID_F300&MI_00\7&30AD7D1E&0&0000
    Name: USB 2.0 UVC 0.3M Webcam
    Driver is running.
1 matching device(s) found.

C:\Users\Michał\AppData\Local\Temp\i386>devcon.exe disable "USB\VID_064E&PID_F300&MI_00*"
USB\VID_064E&PID_F300&MI_00\7&30AD7D1E&0&0000               : Disable failed
No devices disabled.
Perhaps this is an obsolete version.
My System SpecsSystem Spec
.


02 Apr 2012   #4

Windows 7 Professional 64 EFI
 
 

It is an obsolete version (from 2003 if you got it from the article with the title you mentioned above.) You need the 7.1 DDK to obtain the proper version for WinVista / Windows 7.
My System SpecsSystem Spec
02 Apr 2012   #5

Windows 7 Ultimate x64
 
 

If you havn't already download the Windows Driver Kit.

Thought I had seen this Devcon file on my PC before so I did a search and found it. It's part of a couple of my drivers but it is also included with Slysoft Virtual CloneDrive. Just updated to the latest version to make sure it was still included and still worked and all is ok on Win 7 x64.

You will have to install Virtual CloneDrive though but it's free and only 1.5mb to download a lot less than the WDK. You can then uninstall it after copying the Devcon.exe to a different folder if you want.

Download here - SlySoft Virtual CloneDrive
My System SpecsSystem Spec
06 Apr 2012   #6

Windows 7 x64
 
 

Thank both of you, it works great
My System SpecsSystem Spec
Reply

 Shortcut to enable & disable device




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:48 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33