|
-
Jun 25th, 2000, 02:50 AM
#1
Thread Starter
Lively Member
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
-
Jun 25th, 2000, 04:09 AM
#2
Hyperactive Member
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.
-
Jun 25th, 2000, 04:23 AM
#3
Thread Starter
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|