DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA:Webcam/Mic on/off switch  (Read 5,163 times)

spacedad

  • full of poison
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 36
IDEA:Webcam/Mic on/off switch
« on: March 17, 2016, 04:50 PM »
a taskbar button to turn on and off your webcam and mic as most cheap ones don't have a real switch.
maybe it's more tricky than it sounds.
cheers,
sd.

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: IDEA:Webcam/Mic on/off switch
« Reply #1 on: March 17, 2016, 06:23 PM »
Use devcon to disable/enable the device - you need the Device instance path from Device Properties.

eg.
Disable Microsoft Lifecam HD-3000:
Code: (text)
devcon disable "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"

Enable Microsoft Lifecam HD-3000:
Code: (text)
devcon enable "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"

Check status:
Code: (text)
devcon status "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"

Put it all together as a simple command file:
Code: (text)
@echo off
devcon status "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002" | find /i "disabled" >NUL
if errorlevel 1 goto running
devcon enable "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"
goto alldone
:running
devcon disable "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"
:alldone
devcon status "@USB\VID_045E&PID_0779&MI_02\6&17F0D2C8&0&0002"

Now any time you run the command file the status of the webcam will toggle between enabled and disabled.

DevCon is attached here for ease of download, normally you'd need to download and install a MS development kit but it is available elsewhere on the net.

NOTE: You may need to Run as Admin if you have UAC enabled.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903
« Last Edit: March 22, 2016, 12:26 AM by 4wd »

Original address: https://www.donationcoder.com/forum/index.php?topic=42426.0