Sori Posted May 29, 2014 Posted May 29, 2014 I need a way to disable/enable playback devices. The method I use now is right clicking on the speaker icon, selecting playback devices. Right clicking on the device and selecting disable. I want the same effect, but via coding. I have found things such as disabling the drivers via device manager, but it seems that it does not work, or I don't know how to do it correctly. I tried looking up APIs but not really sure which one would mess with such an item. Any assistance would be much appreciated. P.S. Why? Skype does not have an option to use the system default device. I often switch between my headphones and speakers. Through a bit of experimentation, I found that if you disable the device that skype is using, it will automatically fall back to the other device. If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
November Posted May 29, 2014 Posted May 29, 2014 (edited) Try Registry in HKLMSOFTWAREMicrosoftWindowsCurrentVersionMMDevicesAudioRender. There will be some devices and you have to figure wich one do you want. Then inside each one you have a DeviceState, if you insert 1 you enable, if you insert 8 you disable. Inside the device folder you will have another one called proprieties where the name of the device is there. Windows 8.1 x64 ***EDITED*** I hope this helps. Cheers Edited May 29, 2014 by November Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font]
Sori Posted May 29, 2014 Author Posted May 29, 2014 The registry edit appears to be working. If I disable my speakers, playback devices as well as Skype no longer see it as an option. I will have to make the program and run some tests before I can fully verify. Thank you very much ^ ^ If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Sori Posted May 29, 2014 Author Posted May 29, 2014 (edited) Global Const $devSpeakers = "{13c5caf7-b858-46ac-87ab-c51c32412825}" Global Const $devHeadset = "{32337b5a-4178-4619-b2f3-79d8bf7598b4}" Global Const $regPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\" EnableHeadset() Func EnableSpeakers() ;Enable Speakers MsgBox(0, "Pre Speakers", RegRead($regPath & $devSpeakers, "DeviceState")) RegWrite($regPath & $devSpeakers, "DeviceState", "REG_DWORD", "1") MsgBox(0, "Post Speakers", RegRead($regPath & $devSpeakers, "DeviceState")) ;Disable Headset MsgBox(0, "Pre Headset", RegRead($regPath & $devHeadset, "DeviceState")) RegWrite($regPath & $devHeadset, "DeviceState", "REG_DWORD", "8") MsgBox(0, "Post Headset", RegRead($regPath & $devHeadset, "DeviceState")) EndFunc Func EnableHeadset() ;Enable Headset MsgBox(0, "Pre Headset", RegRead($regPath & $devHeadset, "DeviceState")) RegWrite($regPath & $devHeadset, "DeviceState", "REG_DWORD", "1") MsgBox(0, "Post Headset", RegRead($regPath & $devHeadset, "DeviceState")) ;Disable Speakers MsgBox(0, "Pre Speakers", RegRead($regPath & $devSpeakers, "DeviceState")) RegWrite($regPath & $devSpeakers, "DeviceState", "REG_DWORD", "8") MsgBox(0, "Post Speakers", RegRead($regPath & $devSpeakers, "DeviceState")) EndFunc According to the program... everything is changing. According to Windows... Nothing has changed. (I did also try to give RegWrite the full path without variables, yielding the same result) Edited May 29, 2014 by Sori If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Sori Posted May 29, 2014 Author Posted May 29, 2014 Meh... I took the low road Batch Files EnableSpeakers() Func EnableSpeakers() ShellExecute(@WorkingDir & "/Speakers On.bat") EndFunc Func EnableHeadset() ShellExecute(@WorkingDir & "/Headset On.bat") EndFunc ECHO Y | REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{32337b5a-4178-4619-b2f3-79d8bf7598b4} /v DeviceState /t REG_DWORD /d 0x1 ECHO Y | REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{13c5caf7-b858-46ac-87ab-c51c32412825} /v DeviceState /t REG_DWORD /d 0x8 ECHO Y | REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{13c5caf7-b858-46ac-87ab-c51c32412825} /v DeviceState /t REG_DWORD /d 0x1 ECHO Y | REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{32337b5a-4178-4619-b2f3-79d8bf7598b4} /v DeviceState /t REG_DWORD /d 0x8 If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now