View Single Post
  #52 (permalink)  
Old 08-02-2007, 04:18 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Re: VC++ Tips & Tricks

Hi,
I need: Get Handle of Main Window from process handle.

Here is the answer....

1. - Use GetProcessId() to get process id from process handle.

Use EnumWindows() to look at each top-level window.
For each top-level window call GetWindowThreadProcessId() to get the thread id and process id that was used to create the window.
Break when you find a top-level window that was created by the specified process handle/id.
2. - Use GetWindowThreadProcessId() to get the thread id and process id that was used to create the window.

...........
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Reply With Quote