How can I get the Text that a user sent to me in MSN Messenger... I got the handle of Messenger but I cant get the text they sent out of it. Please Help!
Printable View
How can I get the Text that a user sent to me in MSN Messenger... I got the handle of Messenger but I cant get the text they sent out of it. Please Help!
If you already have the handle of the window then:
VB Code:
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 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 Const WM_GETTEXT = &HD Public Const WM_GETTEXTLENGTH = &HE Public Function GetText(Window As Long) As String 'Gets any text from a window Dim Cursor As String, Text As Long Text& = SendMessage(Window&, WM_GETTEXTLENGTH, 0&, 0&) Cursor$ = String(Text&, 0&) Call SendMessageByString(Window&, WM_GETTEXT, Text& + 1, Cursor$) GetText$ = Cursor$ End Function
this is the code im using.......
TheNum = HScroll1.Value
Instant% = lsthandle.List(TheNum)
Win% = GetWindow(Instant%, GW_CHILD)
Do
Text2$ = GetClass(Win%)
If Text2$ = "RichText20A" Then Exit Do
Win% = GetWindow(Win%, GW_HWNDNEXT)
Loop Until Win% = 0
Text& = SendMessage(Win%, WM_GETTEXTLENGTH, 0&, 0&)
Cursor$ = String(Text&, 0&)
Call SendMessageByString(Win%, WM_GETTEXT, Text& + 1, Cursor$)
Messages.Text = Cursor$
I have my program look for all the instant messages and put them in a listbox. THen i fix it so that whichever one i want the text from i move the scroll bar to the number in the listbox and click get message and this is the get message command_click
But it doesn't get any messages... it just sits there.... Messages.Text is a richtext box also....... can someone help me?
Private Sub Msg_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, _
ByVal pSourceUser As Messenger.IMsgrUser, ByVal bstrMsgHeader As String, ByVal bstrMsgText As String, _
pfEnableDefault As Boolean)
'Do Stuff Here
'bstrMsgText is the text received.
End Sub
Dont you need the reference to MSN object Library?Quote:
Originally posted by Doctor UDP
Private Sub Msg_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, _
ByVal pSourceUser As Messenger.IMsgrUser, ByVal bstrMsgHeader As String, ByVal bstrMsgText As String, _
pfEnableDefault As Boolean)
'Do Stuff Here
'bstrMsgText is the text received.
End Sub
Well duhhhhh, yeah. Sorry somehow i assumed you had that already. Just goto Project > References and add Messenger Type Library and that should do it.
is there anyway, to Set the text inside a windows instead of "get the text" ?
This might give you a few ideas.
"When Threads Arise From the Grave, Part 4"