'************************************** ' Name: Windows 10 Taskbar sound icon fa ' ilure ' Description:Windows 10 often fails to ' open the Sound Volume Dialog when the Ta ' skbar Sound Icon is clicked. Here is a q ' uick solution to that problem. ' By: A_X_O ' ' ' Inputs:None ' ' Returns:None ' 'Assumes:None ' 'Side Effects:None '************************************** ' '--------------------------------------- ' --------------------------------------- ' '+++++++++++++++++++++++++++++++++++++++ ' ++++++++++++++++++++++++++++++++ ' ' Demonstration: Windows 10, VBScript; ' System Sound Volume ' '+++++++++++++++++++++++++++++++++++++++ ' ++++++++++++++++++++++++++++++++ ' ' ' ' Purpose : Demonstrates VBScript Open ' SndVol.exe ' ' -------------------------------------- ' --------------------------------- ' ' Creation Date : 01/01/2019 [dd/mm/yyy ' y] ' ' Version : 1.1 ' ' Designer : Fabian ' ' ' '####################################### ' ####################################### ' ' MODIFICATION HISTORY ' '--------------------------------------- ' --------------------------------------- ' ' Version : 1:0 01/01/2019 Create the S ' ample ' ' : 1:1 02/01/2019 Cleanup Objects ' ' ' ' ' '--------------------------------------- ' --------------------------------------- ' ' Public Const PlatformError_L1 = "This application is not compatible with" 'Application Incompatibility Message Public Const PlatformError_L2 = "your version of Windows." 'Application Incompatibility Message Public Const PlatformError_L3 = "Compatibility Error" 'Application Incompatibility Message ' Public strPlatform 'Example Windows Vista or Windows 10 Public intPlatformBit 'Example Windows 32 Bit or Windows 64 Bit ' ' Data Types Named for complete cl ' arity, but VBScript only ' makes use of the Variant, data t ' ype. ' Public strDriveLetter 'As String 'Store the root directory / Drive-Label ' Public Const SW_SHOWNORMAL = 1 'Constant for sndvol Window [SW_ Show Window] ' ' Public Const strTargetPath = "\sndvol.exe" 'As String 'The application we are targeting Public Const str32BitPath = "\Windows\System32" 'As String 'Determine correct location for 32Bit Windows Public Const str64BitPath = "\Windows\SysWOW64" 'As String 'Determine correct location for 64Bit Windows ' Dim objWMIService 'As Object 'Memory for Windows Management Instrumentation Dim colSettings 'As Integer 'Memory for items in the Windows Address Width Column Dim colOperatingSystems 'As String 'Memory for items in the Windows Version Column Dim WshShell 'As Object 'Memory for Windows Script Host ' Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 'Communication with the WMI Set colSettings = objWMIService.ExecQuery ("SELECT * FROM Win32_Processor") 'Return the Address Width Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem") 'Return the Windows Version Set WshShell = Wscript.CreateObject("Wscript.Shell") 'Create the Windows Scripting Object ' strDriveLetter = Left((Wscript.ScriptFullName), 2) 'Quick and easy way to get the Drive letter ' For Each objOperatingSystem in colOperatingSystems 'Work through the list of Operating Systems ' strPlatform = objOperatingSystem.Version 'Store the Returned String ' Next ' For Each objProcessor In colSettings 'Work through the list Address Widths ' intPlatformBit = objProcessor.AddressWidth 'Store the Returned Integer ' Next ' Call Main() 'Begin ' Public Sub Main() 'The first Sub-Routine On Error Resume Next ' If Left((strPlatform), 2) = 10 And intPlatformBit = 64 Then 'Check for 64Bit Windows 10 ' Call StartSoundVolumeApp("1064") 'Call appropriate routine for 64Bit Windows 10 ' ElseIf Left((strPlatform), 2) = 10 And intPlatformBit = 32 Then ' Call StartSoundVolumeApp("1032") 'Call appropriate routine for 32Bit Windows 10 ' Else 'Invalid Platform: Notify user and Exit Script ' MsgBox PlatformError_L1 & VbCrLf & _ PlatformError_L2, _ VbSystemModal + VbExclamation + VbOkOnly, _ PlatformError_L3 ' Call CleanupObjectInstances ' WScript.Quit 'End ' Exit Sub ' End If ' End Sub ' Public Sub StartSoundVolumeApp(ByVal WindowsVersion) 'Sub-Routine to build path and execute sndvol.exe On Error Resume Next 'Override all errors ' Dim SoundControlApp 'Memory for sndvol.exe path ' Select Case WindowsVersion 'Two possibilities available, so, determine the path for each ' Case "1064" 'Windows 10 64Bit ' SoundControlApp = (strDriveLetter & _ str64BitPath & _ strTargetPath) ' WshShell.Run SoundControlApp, SW_SHOWNORMAL, FALSE 'Run the sndvol.exe application in the \Windows\SysWOW64 directory ' Call CleanupObjectInstances ' Case "1032" 'Windows 10 32Bit ' SoundControlApp = (strDriveLetter & _ str32BitPath & _ strTargetPath) ' WshShell.Run SoundControlApp, SW_SHOWNORMAL, FALSE 'Run the sndvol.exe application in the \Windows\System32 directory ' Call CleanupObjectInstances ' Case Else: Exit Sub 'Exit the routine in all other cases ' Call CleanupObjectInstances ' End Select ' End Sub ' Public Sub CleanupObjectInstances() 'Release the objects On Error Resume Next ' Set objWMIService = Nothing Set colSettings = Nothing Set colOperatingSystems = Nothing Set WshShell = Nothing ' End Sub '