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

Pages: (2): « First « 1 [ 2 ] Last »
2 votes - 5 average   hWnd of IMWindowClass chat input box
Author: Message:
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: hWnd of IMWindowClass chat input box
Hi Matty, your code is fantastic! It helped me very much :D

Except for one thing, the message does not seem to get sent at the SendText function (the contact that is supposed to receive the message does not receive anything). I have verified that both the parameters hwnd and sText are correctly passed in.

Any ideas?

This post was edited on 10-10-2005 at 06:11 PM by eSouL.
10-10-2005 06:09 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: hWnd of IMWindowClass chat input box
code:
SendText ConversationWnd_Obj.hWnd, "this text will be sent", True, True

Are you passing True to both parts of the function? The first one is to send the text and the second is to return the original windows focus.
10-10-2005 06:50 PM
Profile E-Mail PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: hWnd of IMWindowClass chat input box
Yup I passed both as true.

I got around the problem by using sendkeys instead.
10-10-2005 07:03 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: hWnd of IMWindowClass chat input box
Sorry I made a mistake in the code

You also need to include this

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

And instead of passing ConversationWnd_Obj.hWnd you need to pass

SendText FindWindowEX(ConversationWnd_Obj.hWnd, 0&, "DirectUIHWND", vbNullString), "the text", true, true
10-10-2005 08:23 PM
Profile E-Mail PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: hWnd of IMWindowClass chat input box
Strangely, posting to DirectUIHWND still doesn't do anything. :O
10-11-2005 03:47 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: hWnd of IMWindowClass chat input box
quote:
Originally posted by eSouL
Strangely, posting to DirectUIHWND still doesn't do anything. :O
Thats odd cause it works with no problem here in my plugin I am developing.

Here is the actual code I have.

code:
        Dim lngNewWindow As Long
        Dim strTextToSend As String
        If Contacts_lv.SelectedItem.Tag <> "" Then
            lngPrevWnd = GetForegroundWindow()
            MessengerAPI_Obj.InstantMessage Contacts_lv.SelectedItem.Tag
            lngNewWindow = GetForegroundWindow()
            lngNewWindow = FindWindowEx(lngNewWindow, 0, "DirectUIHWND", vbNullString)
            SendText lngNewWindow, "/dropfile " & Me.Tag, True, False
            Unload Me
        End If

This post was edited on 10-11-2005 at 04:00 AM by matty.
10-11-2005 03:55 AM
Profile E-Mail PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: hWnd of IMWindowClass chat input box
I shifted the code out and tested it on a separate project, but it still doesn't work. Anything is wrong?

code:
Dim hwnd_msn As Long
Dim hwnd_msn_edit As Long
hwnd_msn = FindWindow("IMWindowClass", vbNullString)
hwnd_msn_edit = FindWindowEx(hwnd_msn, 0&, "DirectUIHWND", vbNullString)

Dim sText As String
sText = Text1.text
Text1.text = ""
   
For i = 1 To Len(sText)
  Call PostMessage(hwnd_msn_edit, WM_CHAR, Asc(Mid(sText, i, 1)), 0)
Next i
   
Call PostMessage(hwnd_msn_edit, WM_KEYDOWN, VK_RETURN, 0&)
Call PostMessage(hwnd_msn_edit, WM_KEYUP, VK_RETURN, 0&)



EDIT:
I realized that the above code will only work if I bring the window to the front first using this code:
code:
   
    Dim RetVal As Long
    RetVal = SetForegroundWindow(hwnd_msn_edit)
    WaitForSingleObject RetVal, INFINITE


It wasn't very reliable though. Some messages would not get sent. Some concatenated and got sent as one line. (Tested it by repeatedly sending string of messsages through a text box)

Funny thing is, posting messages to Notepad actually works without having to bring the window to the front. I wonder why the difference. *-)

This post was edited on 10-12-2005 at 05:32 AM by eSouL.
10-12-2005 05:13 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


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