Josh Posted October 11, 2012 Share Posted October 11, 2012 I am using freeprocess to launch and communicate with an external EXE, but the launched window won't activate/become foreground, on top of main program window. 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? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted October 12, 2012 Author Share Posted October 12, 2012 AllowSetForegroundWindow() has to be called directly after the new process is created. However, you can use -1 for the process handle, which makes things slightly easier. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.