Set foreground window


I’m writing an application in which I issue a command to start running a separate process. The problem is that, when I do that, the of application loses focus. Is there a way of making the of window the active window again?
I searched online, and since I’m on windows I can use SetForegroundWindow or SetActiveWindow, but is there any way I can get a HWND handle to the of window?
Thanks in advance,


I think this can get you the hwnd. There is another way, if you know the title of the window, if you search the forum for hwnd you can see it in a few examples, but this is fairly simple:

HWND wnd = WindowFromDC(wglGetCurrentDC());  

hope that helps!