[solved] Raise Window to Front using "SwitchToThisWindow"
-
Hi guys and girls,
I want the MainWindow to be pushed on top of the windows stack.
As I understand an application shall not do this, that's why raise() and showNormal() won't do.My plan is to use the windows routine SwitchToThisWindow( HWND hWnd, BOOL fAltTab )
http://msdn.microsoft.com/de-de/library/windows/desktop/ms633553(v=vs.85).aspxWhat kills my plan is that the windows handle seems not to be accessible any longer in 5.x.
I tried the way around viaQPlatformNativeInterface* interfacep = QGuiApplication::platformNativeInterface();
HWND handle = static_cast<HWND>(interfacep->nativeResourceForWindow(QByteArrayLiteral("handle"), window() ));
SwitchToThisWindow( handle, (WINBOOL)false );But the window handle seems to be wrong, because some windows will be raised, but not the correct one (it is the same during one run each time the SwitchToThisWindow() is called, but when the program is restarted, it is randomly any window).
Question A) is there maybe only a problem with the cast and the routine to get the window handle is wrong?
Question B) is there a solution provided by the QT-API to switch the window to the top, so I can drop the windows specific SwitchToWindow() routine?
Thanks so far...
-
...sorry, was my fault...
The windows handles are correct. When I set the bool "by alt-tab" to true, the correct window reacts.
But that way the application blinks and comes not to the front. That's the same like showNormal(), so I didn't win anything...If anybody has an idea how to raise a window above all other windows I would appreciate it, but the initial question as I described it seems to be solved.