tags:

views:

18

answers:

2

I need to interact with 3'rd party applications by knowing the handle of certain text fields, but the hWnd always changes when that window is recreated. Is there any method that would allow me to identify a window and repeatedly be able to access that window (even after it is closed and then reopened) without having the user manually identify the window?

I need the user to be able to identify a window with the usual click, drag and release method but only have to do it once and not every time the target window is recreated.

A: 

Use GetWindowText/GetWindowInfo to find the window's name and class name when the user clicks on it. When you want to find the window again pass these to FindWindow.

atomice
A: 

If its a dialog box, then the controls will all have IDs. Use FindWindowEx to get the handle to the main window, then GetDlgItem to retrieve a handle to a control given its id.

Chris Becke