回复 7# zldfsz
搞定~
#include <GuiToolbar.au3>
MsgBox(0, '', SystemVolume())
Func SystemVolume()
Local $vol = Win7GetSystemVolume()
If Not $vol Then $vol = Win7GetSystemVolume(1)
Return $vol
EndFunc ;==>SystemVolume
Func Win7GetSystemVolume($frag = 0)
Local $info, $sR, $i, $i_C, $txt
Local $Handle = '[class:Shell_TrayWnd]'
If $frag Then $Handle = '[class:NotifyIconOverflowWindow]'
Local $hTb = ControlGetHandle($Handle, '', 'ToolbarWindow321')
For $i = 0 To _GUICtrlToolbar_ButtonCount($hTb) - 1
$i_C = _GUICtrlToolbar_IndexToCommand($hTb, $i)
$txt = _GUICtrlToolbar_GetButtonText($hTb, $i_C)
$sR = StringRegExp($txt, '^扬声器\:\h?(\d+)%', 1)
If Not @error Then
$info = $sR[0]
EndIf
Next
Return $info
EndFunc ;==>Win7GetSystemVolume
|