Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find a window based on its title and......

Status
Not open for further replies.

attidoode

Technical User
Aug 5, 2003
1
US
Heres what I want :

1. Find a window based on its title from among the open windows at that time. (or just get a handle to the active window).

2. Once you locate that window, find a button with certain text in that window and click that button.

3. It would be awesome if a similar procedure can be incorporated for menus.

The biggest problem : I am not a good programmer. I am just integrating two third party tools and in order to automate my application, I need a code which can perform the above mentioned actions.

I would really appreciate if someone can give me a code snippet or explain step by step what i should do ? Is VC++ the best option or should i go for VB ?

Thanks a lot
 
Check the documentation for the FindWindow api call. It takes two parameters and returns a handle. The second one is the window title.

Once you have the handle to the window. You can probably search for child windows. And send messages to these windows.

Hope this helps.
 
Below sample code will find a window based on its name/title

// ?????????? is the name/title of the window you want
// to find
LPCTSTR lpWindowName = ??????????;

HWND hWnd = ::FindWindow(NULL, lpWindowName);

if (hWnd)
{
// Add additional code here

}

If this is win32 include windows.h
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top