[RESOLVED] send text to message (chat) window of yahoo messenger 8.1
hi
i use below code to send text to message (chat) window of yahoo messenger 8.1 but it dose not send any thing
i use it to older version of Yahoo messenger (i think 7.5) and it send text very well
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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
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 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 Const WM_SETTEXT = &HC
Private Const WM_KEYDOWN = &H100
Private Const VK_RETURN = &HD
Private Sub Command1_Click()
Dim wnd, meswnd As Long
wnd = FindWindow("IMClass", vbNullString)
meswnd = FindWindowEx(wnd, 0, "YIMInputWindow", vbNullString)
SendMessageByString meswnd, WM_SETTEXT, 0, Text2.Text
butwnd = FindWindowEx(wnd, 0, "Button", vbNullString)
PostMessage meswnd, WM_KEYDOWN, VK_RETURN, 0
End Sub
Re: send text to message (chat) window of yahoo messenger 8.1
I have modified your code. This works !!
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 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 GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) 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 Const WM_SETTEXT = &HC
Private Const WM_KEYDOWN = &H100
Private Const VK_RETURN = &HD
Private Const GW_HWNDNEXT = 2
Private Const GW_CHILD = 5
Private Sub Command1_Click()
Dim wnd As Long, meswnd As Long, lhndchild As Long
Dim StrClass As String * 255
Dim i As Integer
wnd = FindWindow("YSearchMenuWndClass", vbNullString)
wnd = FindWindowEx(wnd, 0&, "IMClass", vbNullString)
lhndchild = GetWindow(wnd, GW_CHILD)
Call GetClassName(lhndchild, StrClass, 255)
i = InStr(StrClass, "YIMInputWindow")
If i > 0 Then
SendMessageByString meswnd, WM_SETTEXT, 0, Text2.Text
Exit Sub
End If
'Continue enumuration
Do
lhndchild = GetWindow(lhndchild, GW_HWNDNEXT)
If lhndchild = 0 Then Exit Do
Call GetClassName(lhndchild, StrClass, 255)
i = InStr(StrClass, "YIMInputWindow")
If i > 0 Then
SendMessageByString lhndchild, WM_SETTEXT, 0, Text2.Text
Exit Sub
End If
Loop
End Sub
Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
Posts
78
Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1
sorry to revive an old post but is it possible to send it to Messenger 9.0??
PAIN n SUFFERING-Pain is Inevitable,,suffering is optional........... WORK EXPECTATION--U can do anything in this world if u don't look for credit.........
Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
Posts
78
Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1
Fazi!!!i tried ur attachment and it didn't work...
PAIN n SUFFERING-Pain is Inevitable,,suffering is optional........... WORK EXPECTATION--U can do anything in this world if u don't look for credit.........
Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1
Hai wiz,
I check with ym latest version
i edited the code since it required few changes.
so update the command1_click code in the old project check it
Code:
Private Sub Command1_Click()
Dim wnd As Long, meswnd As Long, lhndchild As Long
Dim StrClass As String * 255
Dim i As Integer
wnd = FindWindow("ATL:007C37C0", vbNullString)
wnd = FindWindowEx(wnd, 0&, "YIMInputWindow", vbNullString)
If wnd = 0 Then
MsgBox "Sorry, no input window found."
Exit Sub
End If
'lhndchild = GetWindow(wnd, GW_CHILD)
''Continue enumuration
'Do
' Call GetClassName(lhndchild, StrClass, 255)
' i = InStr(StrClass, "YIMInputWindow")
' If i > 0 Then
' SendMessageByString lhndchild, WM_SETTEXT, 0, Text2.Text
' Me.CmdSend.Enabled = True
' Exit Sub
' End If
'
' lhndchild = GetWindow(lhndchild, GW_HWNDNEXT)
' If lhndchild = 0 Then Exit Do
'
'Loop
SendMessageByString wnd, WM_SETTEXT, 0, Text2.Text
End Sub
Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1
Your code on this matter is helpful! I am happy to find it here- at last.
...However it doesn't work for unicode string. Could you please enhance your code in order for it to work with unicode string?
Asia, Earth, Solar System, Milky Way Galaxy, Near Andromeda Galaxy, Universe
Posts
78
Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1
Thnx Fazi!
PAIN n SUFFERING-Pain is Inevitable,,suffering is optional........... WORK EXPECTATION--U can do anything in this world if u don't look for credit.........