Link to home
Start Free TrialLog in
Avatar of yoavo
yoavo

asked on

getting the main window from a process HANDLE

hi,
In my application I'm using the CreateProcess() function from which I get the HANDLE to the process (by the PROCESS_INFORMATION structure).
In a certain situation I need to bring to top the main window of the application which I instanced by the CreateProcess() function.
Is there a way to get the handle of the main window from a HANDLE to process ? (or maybe is there another solussion ?)

10x,
Yoav.
Avatar of jhance
jhance

There are probably a dozen ways to do this but one method that I'm familiar with is to use the FindWindow() function.
Avatar of yoavo

ASKER

the problem with FindWindow() is that my application should run on several languages and I dont want to get into translating the process name that I'm running by the providers...
This is not a problem.
You can use only the class name parameter in the FindWindow function. You only need to make sure that your class (from WNDCLASS) is registered correctly. This info is only used internaly and not exposed to the user.
Check out for ways to do it.

The second thing you can do, is to load the window title from the resources of that EXE. It is a bit tricky, but it can be done. Becuase your application support multipile langs I assume you a set of res for each lang. You need to establish the lang the app is running and dig into the resources a bit. Basicaly you load the right string from res and use find window.
ASKER CERTIFIED SOLUTION
Avatar of CindyC
CindyC

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial