Results 1 to 10 of 10

Thread: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Resolved [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
    can everyone resolve it ?
    Sorry For Bad My English

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    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
    Attached Files Attached Files
    Last edited by Fazi; Aug 26th, 2007 at 01:36 PM.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Re: send text to message (chat) window of yahoo messenger 8.1

    thanks. it's work
    Sorry For Bad My English

  4. #4
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    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.........

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1

    hai wiz, just try my attachemnt, if not work ill check bit lator.

  6. #6
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    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.........

  7. #7
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    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

  8. #8
    New Member
    Join Date
    May 2007
    Posts
    9

    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?

    Thank you in advance.

  9. #9
    Lively Member wiz....'s Avatar
    Join Date
    Nov 2008
    Location
    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.........

  10. #10
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] send text to message (chat) window of yahoo messenger 8.1

    thanks folks,
    btw, ill try unicode one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width