LiveWire Peer Support Network

Printable Version of Topic "enumchildwindows, getwindow (vb.net)"

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- enumchildwindows, getwindow (vb.net) (http://www.golivewire.com/forums/peer-stpaeb-support-a.html)


-- Posted by j3100 at 2:08 pm on Dec. 30, 2007

I'm trying to get handles for buttons, textboxes and other controls inside tabbed boxes of a 3rd party windows form, but those functions listed above do not seem to be able to "see" inside the tab controls.  Here is some code that I have now:

Code:

   Private Sub btnPress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPress.Click
       Dim hwnd As IntPtr

       hwnd = FindWindow(vbNullString, "Joe")
       Dim ptrChildWindows() As IntPtr = GetWindows(hwnd)

       For iCounter As Integer = 0 To ptrChildWindows.Length - 1
           'grab the current handle to process...
           Dim ptrCurrent As IntPtr = ptrChildWindows(iCounter)
           'get the window text...
           Dim sText As String = GetWindowText(ptrCurrent)
           TextBox2.AppendText(sText & vbCrLf)

           'check to see if this is the button we are looking for...
           If sText = "Click" Then
               'click the button to close the dialog...
               ClickButton(ptrCurrent)
               'done deal...
               Exit For
           End If
       Next

   End Sub


Does anybody know of a way to get the child handles that are inside the tab control?  It get's handles for controls that are outside the tab just fine.


www.golivewire.com