you could do it using the enum child api, but you will need to know something about the content of the textbox to really find the correct textboxes api as the enum child api returns all the hwnds of the controls on that program
Code:'In a modules Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long Dim ChildsText As String ChildsText = Space$(GetWindowTextLength(hwnd) + 1) GetWindowText hwnd, ChildsText, Len(ChildsText) ChildsText = Left$(ChildsText, Len(ChildsText) - 1) If ChildsText = "Text1" Then Form1.Text2.Text = hwnd EnumChildProc = 1 End Function 'Replace If ChildsText = "Text1" Then Form1.Text2.Text = hwnd with what ever you want to, get the right hwnd 'to call on it in your form use like so: EnumChildWindows Form1.hwnd, AddressOf EnumChildProc, ByVal 0& 'all you need to do is replace form1.hwnd with the hwnd of the program with the textbox you want to use.




Reply With Quote