Results 1 to 6 of 6

Thread: Spy++ Question

  1. #1

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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..

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    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.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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

  4. #4

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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

  5. #5
    Megatron
    Guest
    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.

  6. #6

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Thanks Megatron.

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