Attribute VB_Name = "MSNMessenger"
Public 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
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 PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
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 Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_SETTEXT = &HC
Sub FloodMessenger(What As String)
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
richedita& = FindWindowEx(IMWindowClass&, 0&, "RichEdit20A", vbNullString)
richedita& = FindWindowEx(IMWindowClass&, richedita&, "RichEdit20A", vbNullString)
Call SendMessageByString(richedita&, WM_SETTEXT, 0&, What)
Button& = FindWindowEx(IMWindowClass&, 0&, "Button", vbNullString)
Call PostMessage(Button&, WM_LBUTTONDOWN, 0&, 0&)
Call PostMessage(Button&, WM_LBUTTONUP, 0&, 0&)
End Sub
Function gettextmes()
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
richedita& = FindWindowEx(IMWindowClass&, 0&, "RichEdit20A", vbNullString)
TextLen& = SendMessage(richedita&, WM_GETTEXTLENGTH, 0&, 0&)
RichEditATxt$ = String(TextLen&, 0&)
Call SendMessageByString(richedita&, WM_GETTEXT, TextLen& + 1&, RichEditATxt$)
gettextmes = RichEditATxt$
End Function
