Search Tools Links Login

Broadcast Over MSN

Posted: 2002-06-01
By: ArchiveBot
Viewed: 62

Filed Under:

VB6 Code Cache

No attachments for this post


This code will Send a message to all open MSN Conversation Windows. Please comment and vote!

Original Author: že7eN

Code

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
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
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Const XP = "RichEdit20W"
Const Win98 = "RichEdit20A"
'If you cant Get it to work useing these two, then get an API Spyer
'and click on the IM's chat box then replace that value with that one
Sub SendText(Text As String)
Dim IMWindow, RichTB, RichTB2, SendButton As Long
IMWindow = FindWindow("IMWindowClass", vbNullString) 'Get IM's Hwnd
If IMWindow = 0 Then Exit Sub 'if no Im's open then exit
RichTB = FindWindowEx(IMWindow, 0, XP, vbNullString) ' Get Chat Rooms Hwnd
RichTB2 = FindWindowEx(IMWindow, RichTB, XP, vbNullString) 'Get Chat Box Hwnd
SendButton = FindWindowEx(IMWindow, 0, "Button", "&Send") 'Get Send Button Hwnd
SendMessageByString RichTB2, &HC, 0, Text 'Get Send Buttons Hwnd
Call SendMessage(SendButton, &H100, &H20, 0&) 'Click the Button
Call SendMessage(SendButton&, &H101, &H20, 0&)
End Sub


Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.