-1

I'm trying to invoke the Windows On-Screen Keyboard with the command:

C:\Windows\System32\osk.exe

Running this command from Windows cmd.exe works perfectly fine.

But when I run from with the Qt application

int exitCode = QProcess::execute( "c:/Windows/System32/osk.exe");

The exit code is -2.

I have also tried to wrap this within a Windows bat script and execute those as follows:

int exitCode = QProcess::execute( "cmd /c \"w:/scripts/myscript.bat\"");

And myscript.bat has:

c:\Windows\System32\osk.exe

But this gives:

'c:\Windows\System32\osk.exe' is not recognized as an internal or external command,

operable program or batch file.

Compo
  • 36,585
  • 5
  • 27
  • 39
TenG
  • 3,843
  • 2
  • 25
  • 42
  • 1
    Most likely you have a 32bit QT application trying to run the 64bit osk.exe file. As there is no 32bit `osk.exe` application on a 64bit OS, you will need to create and use a 64bit application to run your 64bit process, or somehow try to disable the Wow64EnableWow64FsRedirection function. – Compo Feb 06 '23 at 21:56

1 Answers1

1

int exitCode = QProcess::execute("c:'\'Windows'\'System32'\'osk.exe");

guest
  • 11
  • 2