Solved

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

Posted on 2004-04-12
5
281 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
Comment Utility
If you are using MFC, you can just say (CEdit Control Name)->GetWindowText(CString)
0
 
LVL 19

Expert Comment

by:mrwad99
Comment Utility
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
Comment Utility
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
Comment Utility
bkfirebird: I stand corrected :)
0
 

Author Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

772 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

14 Experts available now in Live!

Get 1:1 Help Now