Shoutbox

Change Window's Title bar in script - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Change Window's Title bar in script (/showthread.php?tid=62104)

Change Window's Title bar in script by J-Thread on 06-30-2006 at 09:36 AM

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...
RE: Change Window's Title bar in script by matty on 06-30-2006 at 04:54 PM

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.
RE: Change Window's Title bar in script by J-Thread on 06-30-2006 at 06:25 PM

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".


RE: Change Window's Title bar in script by deAd on 06-30-2006 at 06:43 PM

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 :/)


RE: Change Window's Title bar in script by J-Thread on 06-30-2006 at 06:46 PM

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: ...".


RE: Change Window's Title bar in script by deAd on 06-30-2006 at 08:03 PM

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...

RE: Change Window's Title bar in script by RaceProUK on 06-30-2006 at 08:40 PM

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().


RE: Change Window's Title bar in script by J-Thread on 06-30-2006 at 08:59 PM

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.