'How to bring window on top of the process created through CreateProcess

I am launching a process from my application using CreateProcess API and I want to bring the window of the new process to top. Is there a way to do it? Do we have any flag or something like that with CreateProcess?



Solution 1:[1]

You need the window handle of the application you launched. If you don't have it, you could use the FindWindowA API call.

Then use the SetFocus API call with the window handle as parameter.

Related links:

http://www.andreavb.com/tip020001.html
http://msdn.microsoft.com/en-us/library/aa697422%28v=vs.71%29.aspx

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeroen Jacobs