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.
yoavoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhanceCommented:
There are probably a dozen ways to do this but one method that I'm familiar with is to use the FindWindow() function.
0
yoavoAuthor Commented:
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...
0
zoferCommented:
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.
0
CindyCCommented:
If you know the class name of the window, juz use
FindWindow( "YourClassName", NULL), which returns the window.
Hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.