Solved

How to get an object's handle inside a window?

Posted on 2004-04-12
5
282 Views
Last Modified: 2010-04-01
Hi experts. I would like to know how to enumerate all the objects within a window. There is a certain program I am using that contains a value (the username) in a text box. So, I need to read that text box, and for that I need the handle. I have the window handle, but I don't know how to get the text box's handle. Is there a way to enumerate all the objects? I am quite sure this is possible since I saw some time ago a program that could say all the values inside text boxes.
Thanks a lot.
0
Comment
Question by:ricardodelvalle3
  • 3
5 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 10807715
If you are using MFC, you can just say (CEdit Control Name)->GetWindowText(CString)
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 10807742
Oh, sorry, it now sounds like you are not writing the program, but are using it.  Hmm.  In that case I don't think it is possible to get handles to controls of windows that you don't own, so to speak.
0
 
LVL 4

Accepted Solution

by:
bkfirebird earned 200 total points
ID: 10807744
is this application a external ie you don't have the source code for it ?
You can use EnumChildWindows to get a handle for the text box once you know the parent window's handle.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/EnumChildWindows.asp
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 10807761
bkfirebird: I stand corrected :)
0
 

Author Comment

by:ricardodelvalle3
ID: 10807901
Excelent bkfirebird!! I'll try it tonight when I get home.
Cheers.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now