What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [help] Active ChatWnd

[help] Active ChatWnd
Author: Message:
LifelesS
Full Member
***


Posts: 115
Reputation: 4
32 / Male / Flag
Joined: Dec 2006
O.P. [help] Active ChatWnd
Hi, I'm building a script and on there's a point where you have a PlusWnd and when you click on a button it writes something on the ChatWnd. The problem is that I can't do it. :S

[code]function OnWndCharSelectEvent_CtrlClicked(PlusWnd, ControlId)
{
    switch(ControlId)
    {
        case "BtnClose":
            PlusWnd.Close(0);
            break;
           
        case "BtnInsert":
        var currenttext = ChatWindow.EditText;
        var SelectedChar = PlusWnd.Combo_GetCurSel("cbcChar");
        ChatWnd.EditText_ReplaceSel(SelectedChar);
        break;
    }
}[code]

I get "ChatWnd not defined" how can I define it? Can't find it.
Best Regards,
Joćo Godinho
01-26-2007 02:26 PM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [help] Active ChatWnd
To get the handle of Active ChatWnd we can use FindWindowW
code:
ChatWnd = Interop.Call('User32',"FindWindowW",'IMWindowClass',0);


By this way you get the handle of the ChatWnd(ChatWnd.Hnadle) and not the chatwnd :P.

This post was edited on 01-26-2007 at 02:45 PM by Felu.
01-26-2007 02:38 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [help] Active ChatWnd
You don't have the ChatWnd declared. Can you tell us in which chat window the script should send the message?

For example, if the PlusWnd was created from a menu, you could create a global array and add an element with the PlusWnd's handle as key and the ChatWnd as handle, and look for that one when the event occurs.

This post was edited on 01-26-2007 at 02:46 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-26-2007 02:39 PM
Profile E-Mail PM Web Find Quote Report
LifelesS
Full Member
***


Posts: 115
Reputation: 4
32 / Male / Flag
Joined: Dec 2006
O.P. RE: [help] Active ChatWnd
Gonna try it Felu;

Mattike, it's in the active chat window
Best Regards,
Joćo Godinho
01-26-2007 02:40 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [help] Active ChatWnd
Well, the thing is that the chat window can't be on the foreground when you click your control in the PlusWnd. :-/
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-26-2007 02:47 PM
Profile E-Mail PM Web Find Quote Report
LifelesS
Full Member
***


Posts: 115
Reputation: 4
32 / Male / Flag
Joined: Dec 2006
O.P. RE: [help] Active ChatWnd
It doesn't work Felu, thanks for you help:)



Mattike, well, not all's possible in scripts, good thing is I can do it other way. Thanks:)
Best Regards,
Joćo Godinho
01-26-2007 02:49 PM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [help] Active ChatWnd
quote:
Originally posted by LifelesS
It doesn't work Felu, thanks for you help
I never said that it would return the object ChatWnd. It will return the handle of the last active chat wnd.
01-26-2007 02:51 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [help] Active ChatWnd
I suggest to not do what Felu suggested, at first that is. As this will more than likely lead to errors and possible wrong windows (eg: take in account that there can be more than 1 chat window open, that the first found window is not the top-most chat window, that chat windows can even belong to other Messenger sessions (polygamy), etc etc))

Do as Mattike suggested and add a logical way to retrieve in what chat window you want to write something (by the use of a global variable for example like he suggested).

If this isn't possible at all, then you could do a manual search for chat windows. But use the chatwnds enumeration object and not the findwindow api!!!. And in each enumeration you check the Z-order of the window handle with a windows API, the lowest one (aka the top-most), or was it the biggest one.. dunno anymore :p, is the one you need.

PS: And do not forget to check if you actually can edit/write something to the chat window before you actually write or manipulate the cursor!

This post was edited on 01-26-2007 at 02:59 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
01-26-2007 02:54 PM
Profile PM Find Quote Report
LifelesS
Full Member
***


Posts: 115
Reputation: 4
32 / Male / Flag
Joined: Dec 2006
O.P. RE: [help] Active ChatWnd
I'm using other way, I'm going to replace the text you write instead of having to press a button to write the text.
Best Regards,
Joćo Godinho
01-26-2007 02:58 PM
Profile E-Mail PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: RE: [help] Active ChatWnd
quote:
Originally posted by Felu
To get the handle of Active ChatWnd we can use FindWindowW
code:
ChatWnd = Interop.Call('User32',"FindWindowW",'IMWindowClass',0);


By this way you get the handle of the ChatWnd(ChatWnd.Hnadle) and not the chatwnd :P.

It should not work with tabs, as MessengerPlus! creates another window class for tabbed chats. GetForgroundWindow API might work :)
01-26-2007 03:30 PM
Profile E-Mail PM Find Quote Report
« 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