#Include <SoundQuery.au3>
Global $Dll = -1, $Unmute = 0
Switch @OSVersion
Case 'WIN_2000', 'WIN_2003', 'WIN_XP', 'WIN_XPe'
If Not _SoundGetMasterMute() Then
_SoundSetMasterMute(1)
$Unmute = 1
EndIf
Case Else
$Dll = _PluginOpen(@ScriptDir & '\Vista_Vol.dll')
If $Dll <> -1 Then
If Not _IsMute_Vista() Then
_SetMute_Vista(1)
$Unmute = 1
EndIf
EndIf
EndSwitch
Sleep(5000)
Switch @OSVersion
Case 'WIN_2000', 'WIN_2003', 'WIN_XP', 'WIN_XPe'
If $Unmute Then
_SoundSetMasterMute(0)
EndIf
Case Else
If $Dll <> -1 Then
If $Unmute Then
_SetMute_Vista(0)
EndIf
PluginClose($Dll)
EndIf
EndSwitch
Func _PluginOpen($sPath)
Local $Ret, $Dll = PluginOpen($sPath)
If Not $Dll Then
$Ret = DllCall('kernel32.dll', 'ptr', 'GetModuleHandleW', 'wstr', $sPath)
If (@error) Or ($Ret[0] = 0) Then
Return SetError(1, 0, -1)
EndIf
EndIf
Return $Dll
EndFunc ;==>_PluginOpen