This is what I ended up using: (Enable Sound after disable)
Code:
Public Sub EnableSound()
Dim keyValue As String
keyValue = "%SystemRoot%\Media\"
If Environment.OSVersion.Version.Major = 5 AndAlso Environment.OSVersion.Version.Minor > 0 Then
keyValue += "Windows XP Start.wav"
ElseIf Environment.OSVersion.Version.Major = 6 Then
keyValue += "Windows Navigation Start.wav"
Else
Return
End If
Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("AppEvents\Schemes\Apps\Explorer\Navigating\.Current", True)
key.SetValue(Nothing, keyValue, RegistryValueKind.ExpandString)
End Sub So then on form load it would be:
This is to disable the sound:
Code:
Public Sub DisableSound()
Dim keyValue As String
keyValue = "%SystemRoot%\Media\"
If Environment.OSVersion.Version.Major = 5 AndAlso Environment.OSVersion.Version.Minor > 0 Then
keyValue += "Windows XP Start.wav"
ElseIf Environment.OSVersion.Version.Major = 6 Then
keyValue += "Windows Navigation Start.wav"
Else
Return
End If
Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("AppEvents\Schemes\Apps\Explorer\Navigating\.Current", True)
key.SetValue(Nothing, "", RegistryValueKind.ExpandString)
End Sub