Im trying to get the handle of an AIM window....... and get the text the person sends.... im makin an AFK bot and it aint workin out..... this is my code... check it

Code:
    Dim vLines As Variant
    findstring$ = "Instant Message"
    findstring2$ = "Conversation"
    Dim h As Long, a As String, j As Long, k As Long, bFound As Boolean
    h = GetWindow(GetDesktopWindow(), GW_CHILD)


    Do While h
        a = Space$(128)
        j = SendMessage(h, WM_GETTEXT, 128, ByVal a)
        
            If j Then
            a = Left$(a, j)
            
            If InStr(a, findstring$) <> 0 Then
                SN = a
                Handle = h
                Exit Do
            End If
            
            End If
            
        h = GetWindow(h, GW_HWNDNEXT)
    Loop
    



Do
Text2$ = GetClass(Win%)
MsgBox Text2$
If Text2$ = "Ate32Class" Then Exit Do
If Text2$ = "RichEdit20A" Then Exit Do

Win% = GetWindow(Win%, GW_HWNDNEXT)
Loop Until Win% = 0

WinEdit% = GetWindow(Win%, GW_HWNDNEXT)
WinEdit% = GetWindow(WinEdit%, GW_HWNDNEXT)
Text2$ = GetClass(WinEdit%)
MsgBox Text2$


Text& = SendMessage(Win%, WM_GETTEXTLENGTH, 0&, 0&)
Cursor$ = String(Text&, 0&)
Call SendMessageByString(Win%, WM_GETTEXT, Text& + 1, Cursor$)
If Cursor$ = DogImCountingn Then Exit Sub
DogImCounting = Cursor$

    Do While InStr(Cursor$, ":")
        d = InStr(Cursor$, ":")
        LastOfIt = Mid$(Cursor$, d + 1, Len(Cursor$))
        If InStr(LastOfIt, ":") = False Then
            Exit Do
        Else
            Cursor$ = LastOfIt
        End If
    Loop
Cursor$ = Right$(LastOfIt, Len(LastOfIt) - 2)

' This is the line of code that does the commands for
' whatever the user types in
MsgBox Cursor$
If InStr(Cursor$, "end") Then End
If InStr(Cursor$, "Say It") Then
SendMessage WinEdit%, WM_SETTEXT, ByVal 0, "Im Busy"
End If

Someone please help me out!!