What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » hWnd of IMWindowClass chat input box

2 votes - 5 average   hWnd of IMWindowClass chat input box
Author: Message:
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: hWnd of IMWindowClass chat input box
quote:
Originally posted by Matty
code:
Public Declare Function GetForegroundWindow Lib "user32" () 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
SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function
WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, _
                                                            ByVal dwMilliseconds As Long) _
                                                            As Long

Public Const WM_CHAR = &H102
Public Const VK_RETURN = &HD
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const INFINITE = &HFFFF

Public lngPrevWnd As Long
Public
ConversationWnd_Obj As Object

Public Sub
SendText(hwnd As Long, _
                    sText As String, _
                    Optional bSend As Boolean = False, _
                    Optional bKeepFocus As Boolean = True)
Dim RetVal As Long

    RetVal = SetForegroundWindow(hwnd)
    WaitForSingleObject RetVal, INFINITE
   
    For i = 1 To Len(sText)
        Call PostMessage(hwnd, WM_CHAR, Asc(Mid(sText, i, 1)), 0)
    Next i
   
    If bSend Then
        Call
PostMessage(hwnd, WM_KEYDOWN, VK_RETURN, 0&)
        Call PostMessage(hwnd, WM_KEYUP, VK_RETURN, 0&)
    End If
   
    If Not
bKeepFocus Then
        Call
SetForegroundWindow(lngPrevWnd)
    End If
End Sub



IIRC, It isnt neccessary to set the windows focus to use post message to send keys.
10-10-2005 05:36 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
hWnd of IMWindowClass chat input box - by eSouL on 10-10-2005 at 03:32 PM
RE: hWnd of IMWindowClass chat input box - by J-Thread on 10-10-2005 at 04:19 PM
RE: hWnd of IMWindowClass chat input box - by matty on 10-10-2005 at 04:28 PM
RE: hWnd of IMWindowClass chat input box - by eSouL on 10-10-2005 at 04:39 PM
RE: hWnd of IMWindowClass chat input box - by Stigmata on 10-10-2005 at 04:57 PM
RE: hWnd of IMWindowClass chat input box - by J-Thread on 10-10-2005 at 04:58 PM
RE: hWnd of IMWindowClass chat input box - by matty on 10-10-2005 at 05:11 PM
RE: hWnd of IMWindowClass chat input box - by Mike on 10-10-2005 at 05:14 PM
RE: hWnd of IMWindowClass chat input box - by matty on 10-10-2005 at 05:17 PM
RE: hWnd of IMWindowClass chat input box - by Plik on 10-10-2005 at 05:36 PM
RE: hWnd of IMWindowClass chat input box - by eSouL on 10-10-2005 at 06:09 PM
RE: hWnd of IMWindowClass chat input box - by matty on 10-10-2005 at 06:50 PM
RE: hWnd of IMWindowClass chat input box - by eSouL on 10-10-2005 at 07:03 PM
RE: hWnd of IMWindowClass chat input box - by matty on 10-10-2005 at 08:23 PM
RE: hWnd of IMWindowClass chat input box - by eSouL on 10-11-2005 at 03:47 AM
RE: hWnd of IMWindowClass chat input box - by matty on 10-11-2005 at 03:55 AM
RE: hWnd of IMWindowClass chat input box - by eSouL on 10-12-2005 at 05:13 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On