Issue with Windows 7 32/64 bit and Windows 2008 R2 environments RRS feed

  • Question

  • Hi Friends,

    I am facing issue when I am trying of open OSK.EXE (On-Screen Keyboard) through ShellExecute() in both Windows 7 32/64 bit and Windows 2008 R2 environments. OSK is not getting popped up after executing the command.

    My source code’s statement follows:

    Statement1: ShellExecute ( pWnd, "open", "C:\\WINDOWS\\system32\\osk.exe", NULL, NULL, SW_SHOWNORMAL);

    Note (FYI):

    (1)    If I execute following statement2 by putting OSK.EXE in C:\, then On – Screen Keyboard is getting popped up.


    Statement2: ShellExecute ( pWnd, "open", "C:\\osk.exe", NULL, NULL, SW_SHOWNORMAL);

    (2)    Statement1 is successfully executed on XP, W2K Server and Vista with expected behavior.

    (3)    If I try to get the last error through GetLastError() after executing the Statement 1, “Operation has been performed successfully” is translated from the return value of the GetLastError().

    (4)    On my Windows 7 machine, UAC is disable.

    (5)    I am running ShellExecute() function by logging through the login ID having added to administrator group.

    Please guide me for executing the Statement1.

    Thanks in advance.


    Friday, April 2, 2010 10:13 AM

All replies

  • Start with the basics - can you run c:\windows\system32\osk.exe directly by double-clicking on the executable?

    Have you considered trying CreateProcess rather than ShellExecute?  You may get a more meaningful error code if it fails.


    Friday, April 2, 2010 12:56 PM