C++ (Qt) sb_pipeline2 w; w.show(); w.raise(); w.activateWindow(); return a.exec();
#ifdef Q_OS_WIN AllowSetForegroundWindow(ASFW_ANY);#endif
C++ (Qt) sb_pipeline2 w; w.show(); w.raise(); w.activateWindow();#ifdef Q_OS_WIN AllowSetForegroundWindow(ASFW_ANY);#endif return a.exec();
Starting with Microsoft Windows 98 and Windows 2000, the system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true: * The process is the foreground process. * The process was started by the foreground process. * The process received the last input event. * There is no foreground process. * The foreground process is being debugged. * The foreground is not locked (see LockSetForegroundWindow). * The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo). * Windows 2000/XP: No menus are active. A process that can set the foreground window can enable another process to set the foreground window by calling AllowSetForegroundWindow. The process specified by dwProcessId loses the ability to set the foreground window the next time the user generates input, unless the input is directed at that process, or the next time a process calls AllowSetForegroundWindow, unless that process is specified. Windows 95/98/Me: This function is not implemented. Therefore, processes must cooperate to manage the foreground window. For example, an application may wish to support only one instance. When the second instance starts up, it should detect the previous instance and call SetForegroundWindow on the window of the previous instance. It should not post a message to the window of the previous instance asking it to call SetForegroundWindow on itself, because the previous instance will not necessarily have permission to call SetForegroundWindow.