My launched process has window activation code like below, but it doesn't work when the process is launched from my main application:
void Window::Activate()
{
BringWindowToTop(hwnd);
SetWindowPos(hwnd,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
SetForegroundWindow(hwnd);
SetActiveWindow(hwnd);
SetFocus(hwnd);
current = this;
}
My main application also calls AllowSetForegroundWindow(), to try to give the launched process permission to take the foreground, but it doesn't seem to do anything:
process=CreateProcess("~q"+procpath+"~q "+parameters)
?win32
AllowSetForegroundWindow(process.handle)
?
How can I allow the window of my launched process to become the topmost window?