Grab/Copy from a textbox in anther application
Hi.
This is my problem:
I have an MS Access.exe (2002) innstalled on my pc. I am NOT the owner of this program so I dont have access to to the db.
I would like to make a program in vb6 that allowes me to get the text of a specific textbox in a specific form in the MS Access program. When the Spesific form is open.
I have the name of the textbox but cant locate it and copy it's contents. this might be because the textbox I am trying to find is not enabled. Meaning I cant click on it and ctrl/c.
Pls reply with code samples. or any other ways to do this.
I wish I could do this. " label1 = other_applications_form_name.text1.text" lol :D
# 1 Re: Grab/Copy from a textbox in anther application
Dear Saroman,
the name of the controls (like "text1") is only meaninful when you load the project in the IDE. When the program is compiled, that control is just another "window" object, that does not have any memory that was even created by VB. The only way to get the text of a component in a running application is to use the GetWindowText API; the problem is to know the control window handle. Usually this is done using the EnumWindows API, that enumerates all the active windows, and find the right one based on some characteristics (well, good luck with that...)
Marco
mstraf at 2007-11-11 17:26:17 >

# 2 Re: Grab/Copy from a textbox in anther application
I have found a way to locate the window using FindWindow()
But I am having problems finding the correct control/handle of the textbox
The textbox is located inside a frame. I can find the handle of the frame but not the textbox inside. any bright ideas? anyone??
# 3 Re: Grab/Copy from a textbox in anther application
use EnumWindow to enumerate the hiearachy of the windows that are children of that frame
Marco
mstraf at 2007-11-11 17:28:23 >

# 5 Re: Grab/Copy from a textbox in anther application
ok. sounds good. but I have never used EnumWindow before. anyone care to give an example?
http://www.vbaccelerator.com/home/VB/Code/Libraries/Windows/Enumerating_Windows/article.asp