none
can not start on-screen keyboard RRS feed

  • Question

  • Hello, I am not proficient on C# programming. now I need to call windows on-screen keyboard, my OS is windows 7 64bit.

    I post my code here.

                string OskExe = null;
                string winDir = Environment.GetEnvironmentVariable("WINDIR");

                if (OskExe == null)
                {
                    OskExe = Path.Combine(
                        Path.Combine(winDir,"sysnative"),
                        "osk.exe");
                    if (!File.Exists(OskExe))
                    {
                        OskExe = null;
                    }
                }
                if(OskExe == null)
                {
                    OskExe = Path.Combine(
                        Path.Combine(winDir, "system32"), "osk.exe");
                    if (!File.Exists(OskExe))
                    {
                        OskExe = null;
                    }
                }
                if (OskExe == null)
                {
                    OskExe = "osk.exe";
                }
                Process.Start(OskExe);

    this code work fine on my laptop, but when run on machine, there are always "can not start on-screen keyboard". can anyone help me?

    thanks.

    Thursday, April 9, 2015 1:28 PM

Answers

  • Hi Sunny,

    I have tested on my side, my OS is windows8.1 64bit.  It works fine with the code as below.

    Process.Start(@"C:\Windows\WinSxS\wow64_microsoft-windows-osk_31bf3856ad364e35_6.3.9600.17415_none_a61c78a5620ce678\osk.exe");

    My suggestion is that check on your OS by manual first.

    Then use the code to call keyboard.

    >>this code work fine on my laptop, but when run on machine, there are always "cannot start on-screen keyboard".

    Different environment with different result is expected. And also the osk.exe from path is different.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Sunday, April 19, 2015 3:56 AM
    Moderator

All replies

  • Can you start the on screen Keyboard manually? If not ordering the start from you code won't make it more likely to function...

    Where are you running that code from? Note that services (among other stuff) is barred from accessing the Desktop since Vista.

    Does your user have proper rights for that folder?

    Thursday, April 9, 2015 2:26 PM
  • As I know if you are using touch screen then the on-screen keyboard will automatically appear when you want to input to any textbox. Not sure why you need to write a program to call a on-screen keyboard.

    chanmm


    chanmm

    Thursday, April 9, 2015 3:20 PM
  • Hi Sunny,

    I have tested on my side, my OS is windows8.1 64bit.  It works fine with the code as below.

    Process.Start(@"C:\Windows\WinSxS\wow64_microsoft-windows-osk_31bf3856ad364e35_6.3.9600.17415_none_a61c78a5620ce678\osk.exe");

    My suggestion is that check on your OS by manual first.

    Then use the code to call keyboard.

    >>this code work fine on my laptop, but when run on machine, there are always "cannot start on-screen keyboard".

    Different environment with different result is expected. And also the osk.exe from path is different.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Sunday, April 19, 2015 3:56 AM
    Moderator