Home » Community » Newbie corner » check if application is running
Re: check if application is running [message #55677 is a reply to message #55673] |
Sun, 29 November 2020 23:32   |
BetoValle
Messages: 204 Registered: September 2020 Location: Brasil Valinhos SP
|
Experienced Member |
|
|
Hi,
Wow && Wow!!
after much, much code evaluation on the internet the "only one that worked 100% was this one below (identified in
https://bugreports.qt.io/browse/QTBUG-37435)!
(believe me: the others did not satisfy !!!)
HWND w = ::FindWindowA(NULL,"Backup");
if(w!=NULL){
HWND hCurWnd = ::GetForegroundWindow();
DWORD dwMyID = ::GetCurrentThreadId();
DWORD dwCurID = ::GetWindowThreadProcessId(hCurWnd, NULL);
::AttachThreadInput(dwCurID, dwMyID, TRUE);
::SetWindowPos(w, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
::SetWindowPos(w, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
::SetForegroundWindow(w);
::AttachThreadInput(dwCurID, dwMyID, FALSE);
::SetFocus(w);
::SetActiveWindow(w);
}
Thanks!
|
|
|
Goto Forum:
Current Time: Sun Jul 20 00:59:44 CEST 2025
Total time taken to generate the page: 0.03950 seconds
|