5

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

enter image description here

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

enter image description here

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

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Ami DATA
  • 521
  • 2
  • 9
  • 14
  • This is not off-topic because the OP asked for a programming solution. Just a little research leads to the correct solution – Steve Jan 03 '13 at 13:22
  • That's a user setting - *your* application shouldn't be messing around with it. Can you elaborate on what problems it's causing you? We ought to seek a solution that fixes the issue in your application without affecting the users entire system (as Yakup Ünyılmaz's [answer](http://stackoverflow.com/a/14139597/15498) would) – Damien_The_Unbeliever Jan 03 '13 at 14:43

3 Answers3

4

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.

Yakup Ünyılmaz
  • 404
  • 3
  • 11
  • Yakup, can you elaborate a little more ? – Ami DATA Jan 03 '13 at 14:25
  • 1
    I suppose you are using something like this to start onscreen keyboard. `Process.Start("osk.exe");` If you want to disable the sound of the onscreen keyboard before you open it use the code I provided above before you start onscreen keyboard. But if you have already opened it you have to restart the onscreen keyboard. Use this one to close it `Process [] proc Process.GetProcessesByName("osk"); proc[0].Kill();` Then start it again – Yakup Ünyılmaz Jan 03 '13 at 14:49
  • 3
    As much as this is an answer for you... please for heavens sake try and look for an alternative solution, changing the users configured settings is a really silly idea. – BenjaminPaul Jan 03 '13 at 15:15
  • BenjaminPaul, my app. has to fit to my needs.. (according to customer requirements, anyway the app. blocks access to the pc). – Ami DATA Jan 03 '13 at 15:49
  • 1
    @AmiDATA - If the application has *exclusive* access to the pc (so far as the administrators of that pc would recognise that access), then the administrators should configure the pc themselves to remove this (via group policy, their build process, or imaging). Otherwise, no, your application doesn't have exclusive access and shouldn't be changing user settings. – Damien_The_Unbeliever Jan 03 '13 at 18:40
0

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.

Ray
  • 1
0

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