Problem with QProcess trying to open my On-Screen Keyboard (osk.exe)
-
Then maybe a 32 bit app can't start a 64 bit executable with QProcess - try to start other executables - 32 and 64 bit ones to see if this assumption is correct.
-
@Christian-Ehrlicher so there is no possible solution??
-
@JonexElectronic
@Christian-Ehrlicher has posted the sort of thing I was thinking of. I'm not an expert, but issues with 32- vs 64-bit stuff under Windows. Also I *wonder& whethersystem32
is an issue here....-
Start with a
QFileInfo::exists()
on"C:/Windows/System32/osk.exe"
from within the Qt application, what does it say? -
Try something else there similar, like
Notepad.exe
, I think that's insystem32
too? Does that work?
start()
/execute()
require, I think, that it can get something to wait on. I'm not sure whether that works between 32- to 64-bit, might be an issue.startDetached()
might be a better choice here/for external GUI programs. -
-
@JonexElectronic said in Problem with QProcess trying to open my On-Screen Keyboard (osk.exe):
@Christian-Ehrlicher so there is no possible solution??
Start by doing some more investigations of your own per my previous post before you know where you are going....
Also one thing to try maybe is
process->start("cmd.exe", QStringList() << "/c" << "C:\\Windows\\System32\\osk.exe");
-
@JonexElectronic The only idea I have now is to check Windows logs (you can do that using mmc tool) - maybe there are some hints.
-
@JonB said in Problem with QProcess trying to open my On-Screen Keyboard (osk.exe):
Start with a QFileInfo::exists() on "C:/Windows/System32/osk.exe" from within the Qt application, what does it say?
qDebug() << "Exist osk?" <<QFileInfo::exists("C:/Windows/System32/osk.exe");
It sais false, ¿Why? I check it, and it exist
I triedQDir directory("C:/Windows/System32"); QFileInfoList info =directory.entryInfoList();
it gives me
but I have
any idea why qt omit some files? I didnt find osk.exe on my QFileInfoList info;
but yes I found notepad.exe -
I found anothe osk.exe on my pc that is in
C:\Windows\WinSxS\amd64_microsoft-windows-osk_31bf3856ad364e35_10.0.19041.1_none_60ade0eff94c37fc/osk.exe
and it works with QProcess::startDetached on my 32 bits app but not with process->start... I need to know when this app is close. Maybe I can use the pid returned on startdetached and set a timer to ask every second, but this method dont looks good...
any to detect when this app is closed? -
@JonexElectronic said in Problem with QProcess trying to open my On-Screen Keyboard (osk.exe):
It sais false, ¿Why? I check it, and it exist
This is what I suspected might be the case. Basically because your Qt application is 32-bit. Then
C:\Windows\System32
does not contain what you think it contains when you look from a 64-bit application.I believe this is the root of your problem.
In a word, if you made your Qt application be 64- instead of 32-bit I think all would be well. Have you considered doing this? 32-bit programs are going out of fashion now....
-
@JonB Yes, I have considered moving to 64-bit. But I also use other 32-bit libraries in my program and transitioning everything to 64-bit is too much work at the moment. Anyway, I've tried starting osk.exe with the start method in a new Qt project, but it doesn't work. It only works with startDetached.
QProcess *process; ..... process=new QProcess(); process->start("C:/Windows/System32/osk.exe",QStringList());
-
@JonexElectronic said in Problem with QProcess trying to open my On-Screen Keyboard (osk.exe):
It only works with startDetached.
That does not particularly surprise me. Again I suspect this is an issue about running a 64-bit application from a 32-bit one. And so long as
QFileInfo::exists("C:/Windows/System32/osk.exe")
returns false from your 32-bit app I don't know what you expect to work.Do you really care about
start()
instead ofstartDetached()
anyway? -
@JonB Sorry I forgot to say that it happens in a new 64-bit app not in my 32-bit app.
AndQFileInfo::exists("C:/Windows/System32/osk.exe")
returns true
And yes I really care about start because I need to know when this process has finished
-
Hello!
As an option, you can try to disable the
Wow64EnableWow64FsRedirection
function fromWinAPI
(https://learn.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-wow64enablewow64fsredirection), run yourC:/Windows/System32/osk.exe
process and re-enable it again.
Description: This function is useful for 32-bit applications that want to gain access to the native system32 directory. By default, WOW64 file system redirection is enabled.
It could work in your case.