C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 300,471 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,755 people online right now. Registration is fast and FREE... Join Now!




Searching for string in GUI

 

Searching for string in GUI

kingnebula

3 Jul, 2009 - 09:40 AM
Post #1

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 11


My Contributions
Greetings all
My question is short and sweet but is puzzling me very much. What would i use to search the resources of a window for a caption of a control like a button that says "Click Me!" and return the control id? (WinAPI)


User is offlineProfile CardPM
+Quote Post


oppenheimer230

RE: Searching For String In GUI

4 Jul, 2009 - 07:39 PM
Post #2

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 16



Thanked: 1 times
My Contributions
You will want to look into EnumChildWindows:

http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx

Then, for every child window, try using SendMessage:

http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx

Using the message WM_GETTEXT:

http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx

And compare the response you get to the text you're looking for (e.g., "Click me!").

THis might work, depending on what exactly it is that you are trying to do.

Also, keep in mind that not all applications are composed of standard Win32 "windows", so this might fail.

It may help to try doing this by hand using Spy++ or OllyDbg before coding -- just so you know exactly what you're looking for and whether your code works.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic

Time is now: 11/8/09 02:51AM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month