What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Change Window's Title bar in script

Change Window's Title bar in script
Author: Message:
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. Change Window's Title bar in script
I've defined a window like this:
code:
<Window Id="Name" Version="1">
    <Attributes>
       <Caption>Bla</Caption>
        <ShowInTaskbar>true</ShowInTaskbar>
    </Attributes>
   
    <TitleBar>
        <AllowMinimize>true</AllowMinimize>
        <AllowClose>true</AllowClose>
            <Title>
                <Text>Message Box</Text>
            </Title>
    </TitleBar>
                ....

I can of course show the window etc, nothing wrong with that. But I would like to change the title of the window within my script (the Text Message Box). Is it possible, and how? The Scripting Documentation doesn't say anything about it, and I couldn't figure it our myself...
06-30-2006 09:36 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Change Window's Title bar in script
Do you mean changing the titlebar caption of the window?

code:
function SetWindowText(hWnd, sText){
    Interop.Call('user32', 'SetWindowTextW', hWnd, sText);
}

Usage would be something like this
code:
var pChatWnd = MsgPlus.CreateWnd('xmlfile', 'WindowId')
SetWindowText(pChatWnd.Handle, 'new text');

Should work, like most scripts I post I can't test it as I am at work not home.
06-30-2006 04:54 PM
Profile E-Mail PM Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. RE: Change Window's Title bar in script
That works, but changes the real "Window Text", so the text you see on your taskbar / alt the alt-tab.

The "Title Bar" of the PlusWnd's is a different text, that you see in the window itself (wonder why those 2 are different...). I would like to change that too...

So the "Window Text" is defined as "Bla" in my example, and can be changed using your function, and the "Title Bar Text" is "Message Box".
06-30-2006 06:25 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Change Window's Title bar in script
It's different because the Plus! window is not a normal window. That's not a standard titlebar, it's a text control. You can't change it in script (that i know of :/)
06-30-2006 06:43 PM
Profile PM Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. RE: Change Window's Title bar in script
Sorry, but this reaction is pretty useless, because I already know what you said (that is the question).

There are 2 good answers to this question, either "it is absolutely not possible" or "it is possible, like this: ...".
06-30-2006 06:46 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Change Window's Title bar in script
i wasn't really trying to answer the thread's question with that post...I was mainly answering this:
quote:
Originally posted by J-Thread

The "Title Bar" of the PlusWnd's is a different text, that you see in the window itself (wonder why those 2 are different...). I would like to change that too...
06-30-2006 08:03 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Change Window's Title bar in script
Best way I can tell to do it: use a temp file with the title you want dynamically placed, and use that in MsgPlus::CreateWnd().
[Image: spartaafk.png]
06-30-2006 08:40 PM
Profile PM Web Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. RE: Change Window's Title bar in script
Smart one, I didn't think of that! But it's a bit dodgy...

Well I think I'll leave it then, I hope Patchou adds it in the future... I didn't really need it after all, but it would just be nice to be able to change it.
06-30-2006 08:59 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