Finding text within a seperate application?

I'm trying to find a way to pull text from a listbox on a seperate application.

Specifically.. I am trying to write an application that will use "wshshell.sendkeys" in order to create a new profile within a wireless internet program. In order to do that i want to be able to read the listbox that is within that application and see if the profile name is currently there.

I'm kind of stuck as to how to find that text..Would anyone know how to find text within a text box..or listbox on a seperate application?

[541 byte] By [swoodby] at [2007-12-28]
# 1

A control is just a window, and so GetWindowText (a windows API) should work to get text from a control you don't own (it certainly works for text boxes and the edit areas of combo boxes, though admittedly I've never tried this with a listbox, and I'm not sure what exactly it would return in that case). The trick is getting the HWND of the control to use with that API. What do you know about the other app? Do you have a reference to its process id or anything like that? There are various samples on the web which will help you narrow down to a window -- start with a search for "Declare Sub GetWindowTextA" to get a lot of references to such samples to see how they get the HWND. Given a parent HWND, you can then enumerate its children (again, via the Windows APIs) to look for a particular control.

--Matt--*

MatthewGertzMS at 2007-9-3 > top of Msdn Tech,Visual Basic,Visual Basic General...