Search code examples
c#.netwpfon-screen-keyboard

Detect if On Screen Keyboard is open


I would like to deteck if OSK.exe process (On screen keyboard) is open.

It's my code to open the OSK:

Process.Start("C:\\Windows\\System32\\osk.exe");

Do you have any ideas how can check it and prevent to launch twice and more this process ?


Solution

  • You could get a running process by name as below:

    var arrProcs = Process.GetProcessesByName("osk");
    if (arrProcs.Length == 0)
    {
       Process.Start("C:\\Windows\\System32\\osk.exe");
    }