|
-
Apr 4th, 2001, 11:47 AM
#1
Thread Starter
PowerPoster
I dont get this. I'm using Spy ++ to get a class name of a window, and when I try to use the given class name in an api call, it returns zero. Is there something I'm missing here..
-
Apr 4th, 2001, 11:57 AM
#2
Frenzied Member
Where do you try to use that class name?
I assume you have this problem.
If you are looking for the handle of a child window (ex. a button), then use the FindWindowEx API.
-
Apr 4th, 2001, 12:01 PM
#3
Thread Starter
PowerPoster
Ok...I'm new to using the API so bare with me, I'm trying to get an edit window from an aol window. By using the FindWindowEx, I can get the handle to the parent window with no prob using findwindow, but what would I do to get the correct edit window? Hope this makes sense
-
Apr 4th, 2001, 12:18 PM
#4
Thread Starter
PowerPoster
Ok, I got this to work by doing a loop. There are two windows of the same class inside of the parent window. Is there a way to do this without looping. I mean get the handle of the second window?
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private 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
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_GETTEXT = &HD
Private Const WM_SETTEXT = &HC
Private Const GW_CHILD = 5
Private Sub Command1_Click()
Dim lng As Long, rc As Long, title As String, Hey As String, nsize As Long, message As String
nsize = 255
message = Space(nsize)
Hey = "testing"
title = "MsShopper31 - Instant Message"
lng = FindWindow(vbNullString, title)
Do
rc = FindWindowEx(lng, rc, "WndAte32Class", vbNullString)
SendMessage rc, WM_SETTEXT, 0, ByVal Hey
Loop While rc <> 0
End Sub
-
Apr 4th, 2001, 12:44 PM
#5
Lethal: Just a note: when using FindWindowEx in your routine, you don't need to declare both FindwinowEx, and FindWindow. FindWindowEx can do the exact same thing -- just pass 0 for the first 2 arguments.
-
Apr 4th, 2001, 12:48 PM
#6
Thread Starter
PowerPoster
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
|