Solved Shortcut to enable & disable device

Rogacz

New member
Local time
2:36 AM
Messages
3
Location
Wrocław, Poland
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 Computer

Computer Manufacturer/Model Number
Asus UX31
OS
Windows 7 x64
CPU
i5 2557M
Screen Resolution
1600x900
Mouse
Microsoft Touch Mouse
Internet Speed
20Mb/s
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 Computer

OS
Windows 7 Professional 64 EFI
CPU
Core i7-3930k C2 @ 4.5Ghz (125 strap x 36)
Motherboard
Intel DX79Si 4.30FW
Memory
8 x 4Gb Mushkin Redline @ 8-9-8-24 1T 1666Mhz
Graphics Card(s)
Sapphire 7970 OC Edition @ 1200/1525
Monitor(s) Displays
Dell U2711
Screen Resolution
2560x1440
Hard Drives
6 x OCZ Agility 3 240Gb SATA3 RAID0 via
Highpoint 2720SGL PCIE 2.0 8x SAS card
PSU
Kingwin Lazer 1KW 80+Platinum
Case
ThermalTake Armor+
Cooling
Zalman CNPS9900 Max
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 Computer

Computer Manufacturer/Model Number
Asus UX31
OS
Windows 7 x64
CPU
i5 2557M
Screen Resolution
1600x900
Mouse
Microsoft Touch Mouse
Internet Speed
20Mb/s
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 / Win7.
 

My Computer

OS
Windows 7 Professional 64 EFI
CPU
Core i7-3930k C2 @ 4.5Ghz (125 strap x 36)
Motherboard
Intel DX79Si 4.30FW
Memory
8 x 4Gb Mushkin Redline @ 8-9-8-24 1T 1666Mhz
Graphics Card(s)
Sapphire 7970 OC Edition @ 1200/1525
Monitor(s) Displays
Dell U2711
Screen Resolution
2560x1440
Hard Drives
6 x OCZ Agility 3 240Gb SATA3 RAID0 via
Highpoint 2720SGL PCIE 2.0 8x SAS card
PSU
Kingwin Lazer 1KW 80+Platinum
Case
ThermalTake Armor+
Cooling
Zalman CNPS9900 Max
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 Computer

Computer Manufacturer/Model Number
Self built
OS
Windows 7 Ultimate x64
CPU
Intel Pentium Dual Core E5200 2.5GHz (3.77GHz OC)
Motherboard
Asus P5Q-E
Memory
Corsair 4GB DDR2 (4x1GB CM2X1024-6400C4)
Graphics Card(s)
Palit GeForce GTS 250 (1024MB)
Sound Card
On Board (ADI AD2000B 8ch HD)
Monitor(s) Displays
Samsung 32in LCD TV
Screen Resolution
1360x768
Hard Drives
2 x 1TB Samsung 103SJ (Raid0)
2 x External 500GB Samsung 502IJ (NexStar 3 HD Enclosures)
PSU
550W Antec Neo HE 550
Case
Antec P180
Cooling
Xigmatex Red Scorpion CPU Cooler. 3x120mm Fans
Keyboard
Logitech MX5000 Laser (Combo)
Mouse
Logitech MX5000 Laser (Combo)
Internet Speed
ADSL2+ (avg 10 Mbps Down, 0.80 Mbps up)
Other Info
Gigabyte GN-WP01GS 54g Wireless Lan Card
Thank both of you, it works great :)
 

My Computer

Computer Manufacturer/Model Number
Asus UX31
OS
Windows 7 x64
CPU
i5 2557M
Screen Resolution
1600x900
Mouse
Microsoft Touch Mouse
Internet Speed
20Mb/s
Back
Top