C# how to disable on-screen keyboard sound in wind

2019-06-22 08:38发布

问题:

I have a C# application running on windows xp/7 where I'm using onscreen keyboard.

When the sound is enabled there is a delay which causes problems. I would like to disable the sound.

How can I disable the sound through my C# application code. Any ideas ?

回答1:

You can disable it from registry

[HKEY_CURRENT_USER\Software\Microsoft\Osk] 
"ClickSound"=dword:00000001 // Related Registry Key 

You can use this code to change it

RegistryKey key = Registry.CurrentUser; //key gets the value = "HKEY_CURRENT_USER"
RegistryKey oskKey = key.CreateSubKey(@"Software\Microsoft\Osk");// This line opens the "HKEY_CURRENT_USER\Software\Microsoft\Osk" 
oskKey.SetValue("ClickSound", 0); // Set the value of ClickSound to 0(disable) which is 1(enabled) by default.

I haven't tested it yet but you may have to restart osk.exe after this.



回答2:

All you have to do is click the volume icon in the task bar, click mixer and adjust the slider for "On-Screen Keyboard" or click the speaker to mute it. It has to be running in order to show in the mixer window.



回答3:

All you have to do is click the volume icon in the task bar, click mixer and adjust the slider for "On-Screen Keyboard" or click the speaker to mute it. It has to be running in order to show in the mixer window.

Brother it will effect other media sound also which we don't want,

You can disable it from registry

[HKEY_CURRENT_USER\Software\Microsoft\Osk] "ClickSound"=dword:00000001 // Related Registry Key You can use this code to change it

RegistryKey key = Registry.CurrentUser; //key gets the value = "HKEY_CURRENT_USER" RegistryKey oskKey = key.CreateSubKey(@"Software\Microsoft\Osk");// This line opens the "HKEY_CURRENT_USER\Software\Microsoft\Osk" oskKey.SetValue("ClickSound", 0); // Set the value of ClickSound to 0(disable) which is 1(enabled) by default. I haven't tested it yet but you may have to restart osk.exe after this.

this worked for me like charm thanks a lot brother