Results 1 to 3 of 3

Thread: Wierd

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91
    I am trying to Find The Child hWnd of an AOL Parent, The Code below works for EVERY thing else but for some reason it isnt working for Child Windows Can any one help me out on this?.

    Jeremy


    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Const WM_GETTEXT = &HD
    Public Const WM_GETTEXTLENGTH = &HE
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long





    Dim hWnd1 As
    Dim hWnd2 As Long
    Dim slength As Long
    Dim wintext As String
    Dim retval As Long


    Private Sub Command1_Click()
    hWnd1 = FindWindow(vbNullString, "America Online")
    hWnd2 = FindWindowEx(hWnd1, 0&, "Write Mail", vbNullString)
    If hWnd2 = 0 Then
    Debug.Print "Window Not Found"
    Else
    slength = GetWindowTextLength(hWnd2)
    wintext = Space(slength + 1)
    retval = GetWindowText(hWnd2, wintext, slength + 1) wintext = Left(wintext, slength)
    Debug.Print "Window name is: "; wintext
    End If
    End Sub
    [email protected]
    If its as simple as it sounds I guess I am not basic enough.

  2. #2
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    Do you mean it doesn't work for the "Write Mail" class?
    It may be that the class is actually called "Worker"
    > if you change the class name and window name in FindWindowEx to vbnullstring, this returns a handle, then use a GetWindowClass, and it returns "Worker")





    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91

    My Fault

    I had the Class and Window Name mixed up on the post
    The code below is what i am using but still is wrong for some reason.

    Private Sub Command1_Click()
    hWnd1 = FindWindow(vbNullString, "America Online")
    hWnd2 = FindWindowEx(hWnd1, 0&, vbNullString,"Write Mail")
    If hWnd2 = 0 Then
    Debug.Print "Window Not Found"
    Else
    slength = GetWindowTextLength(hWnd2)
    wintext = Space(slength + 1)
    retval = GetWindowText(hWnd2, wintext, slength + 1) wintext = Left(wintext, slength)
    Debug.Print "Window name is: "; wintext
    End If
    End Sub

    Thanks,
    Jeremy
    [email protected]
    If its as simple as it sounds I guess I am not basic enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width