Jump to content

Getting standard sound output device (Win7)

Recommended Posts

I'd like to know if there's a method of retrieving the current sound output device in Win 7.

It's easy in Win XP, but the dialog boxes in Win 7 are not that accessible, at least not for me (or the Au3InfoTool).

I made two scripts which simply select the first/second device in the list. That works fine, but I'd like to add a small tooltip which displays the new selection.

Thanks in advance,


Edited by Mikesch
Link to comment
Share on other sites

Sure. It doesn't even try to read the device name yet, it just does the switching. Anyway, it works with Win 7, (32 & 64)

;select Audio Device from device list; 0-based

$ref = 0 ;selects 1st sound device, 1=second device...

$SoundPID = Run("control mmsys.cpl")
Global $hWnd
$aWinList = WinList()

For $i = 1 To $aWinList[0][0]
    If WinGetProcess($aWinList[$i][0]) = $SoundPID Then
        $hWnd = $aWinList[$i][1]
WinWait($hWnd, "")

ControlListView($hWnd, "", "SysListView321", "Select", $ref)

ControlClick($hWnd, "", "Button2")
ControlClick($hWnd, "", "Button4")



Link to comment
Share on other sites

Thanks, but this is not about debugging the code I have, it works fine.

I just want to know how I can get the name of the device which is selected after the script has done its job. Maybe reading a registry key or the like. The dialog is not very talkative ;-)


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...