Shortcut to enable & disable device


  1. Posts : 3
    Windows 7 x64
       #1

    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 Computer


  2. Posts : 23
    Windows 7 Professional 64 EFI
       #2

    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


  3. Posts : 3
    Windows 7 x64
    Thread Starter
       #3

    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


  4. Posts : 23
    Windows 7 Professional 64 EFI
       #4

    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


  5. Posts : 640
    Windows 7 Ultimate x64
       #5

    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


  6. Posts : 3
    Windows 7 x64
    Thread Starter
       #6

    Thank both of you, it works great :)
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 09:01.
Find Us