C# how to disable on-screen keyboard sound in windows xp/7

妖精的绣舞 提交于 2019-12-10 15:26:52

问题


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



来源:https://stackoverflow.com/questions/14139349/c-sharp-how-to-disable-on-screen-keyboard-sound-in-windows-xp-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!