I'm trying to send text to a text box within another application, with the class name "Edit." Normally, this wouldn't be a problem, but there are 3 other boxes with the same class name in the same hwnd. How can I access them individually?
Printable View
I'm trying to send text to a text box within another application, with the class name "Edit." Normally, this wouldn't be a problem, but there are 3 other boxes with the same class name in the same hwnd. How can I access them individually?
Did you try thease.
1. You can manupulate it windowRect for diffrence.
2. you can panipulate the text (GetWindowText) of the controlls for diffrents.
Yeah, that would tell me if the current box that I am accessing is the right or wrong one.. but if it's the wrong one, how do I tell my program to move on to the next?
neomulemi6,
You can rtrive the WindowRect & hwnd of all the controlls and store in an array(). then sort the arry. Within the array, you find the one you want. then reffer to its handle and do the rest. :D
I'm not sure how to access a window by handle... only by class or title.
You can use the GetWindow API with the GW_HWNDNEXT argument constant or you can use the GetDlgCtrlID to retrieve the window control id number and match it with its known number to be able to identify if its the correct window.
.
Most of the window related API have an argument like 'hWnd as long'.Quote:
Originally Posted by neomulemi6
hWnd is a long number that uniquly identifies a window by the OS. If you use FindWindowEx, the returned value is the handle of the window you find.
Isn't there a way to do this using the EnumWindows function, or something similar?
If you want to retrive a perticuler window, you can use FindWindow / FindWindowEx. (Please referrer to the MSDN For detail of earch.)
If you want to enumurate all the windows in the sysem, you can use EnumWindows and EnumChildWindows.
OK.
GetWindow with the GWL_HWNDNEXT is similar to enumerating hte windows but at the level that you have drilled down to. Check out my Find Window by Partial Window Caption for an example.
http://vbforums.com/showthread.php?t=316924