Shoutbox

Patchou: Script Windows have an invisible titlebar/border - 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: Patchou: Script Windows have an invisible titlebar/border (/showthread.php?tid=80652)

Patchou: Script Windows have an invisible titlebar/border by matty on 01-03-2008 at 02:38 PM

Patchou,

How come now the Plus! Script Windows, and Plus! windows in general have an invisible titlebar and border? This has caused problems with Screenshot Sender and the select area function.

What made you decide to add this in?


RE: Patchou: Script Windows have an invisible titlebar/border by deAd on 01-03-2008 at 04:03 PM

I'm not sure but I think that hiding the borders using a window region instead of painting over them like before makes it easier to show them again when the window is maximized.


RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-04-2008 at 02:23 PM

quote:
Originally posted by deAd
I'm not sure but I think that hiding the borders using a window region instead of painting over them like before makes it easier to show them again when the window is maximized.
Fair enough but scripts should have the ability within the XML to not have this happen because now I have to work around this and its a pain in the ass.
RE: Patchou: Script Windows have an invisible titlebar/border by Patchou on 01-04-2008 at 03:31 PM

It is internal to Plus! and it solves a couple of problems.

Let me know how it causes a problem for you and I'll try to make some suggestions :).


RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-04-2008 at 03:53 PM

The hidden title bar and borders causes extra space to show up. I cannot move the window up the screen because it is forced down as a default window behavior to make sure there is a portion of the titlebar still showing.

[Image: attachment.php?pid=879901]

Using this code

code:
Interop.Call('user32', 'SetWindowLongW', objWindows['SelectArea'].Handle, (-16) /* GWL_STYLE */, Interop.Call('user32', 'GetWindowLongW', objWindows['SelectArea'].Handle, (-16) /* GWL_STYLE */) & ~ 0xC00000 /* WS_CAPTION */ & ~ 0x400000 /* WS_BOARDER */);

We can remove the title bar and the borders however it doesn't act the same as the overlay window doesn't reach the corners of the screen. So therefore dragging at cursor position 0,0 is dragging on the desktop.

Here is the XML for the window.

code:
<?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
    <Window Id="SelectArea" Version="1">
        <Attributes>
            <ShowInTaskbar>False</ShowInTaskbar>
            <TopMost>True</TopMost>
            <NoActivate>True</NoActivate>
            <LockOnClick>False</LockOnClick>
        </Attributes>
        <Titlebar>
            <AllowMinimize>False</AllowMinimize>
            <AllowMaximize>False</AllowMaximize>
            <AllowClose>False</AllowClose>
        </Titlebar>
        <WindowTmpl>
            <Corners Shape="Rectangle">
                <RoundSize>0</RoundSize>
            </Corners>
        </WindowTmpl>
        <Position Width="400" Height="300" />
    </Window>
</Interfaces>

RE: Patchou: Script Windows have an invisible titlebar/border by Patchou on 01-04-2008 at 07:40 PM

I see... well, in order to do this kind of thing, you would probably be much better off creating the window yourself with a direct call to CreateWindowEx().

But if you really want to try continuing to use Plus! windows for this, try adding option 0x100 to your CreateWnd() call :).


RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-04-2008 at 07:53 PM

quote:
Originally posted by Patchou
I see... well, in order to do this kind of thing, you would probably be much better off creating the window yourself with a direct call to CreateWindowEx().
How would I subclass this window then if I create it myself? I can't so I am stuck using Plus! windows.
quote:
Originally posted by Patchou
But if you really want to try continuing to use Plus! windows for this, try adding option 0x100 to your CreateWnd() call
Is this undocumented? I create it with 1 so that the window is hidden



Ok so 0x100 worked but I had to make a few changes to the xml file so that the user can't see the window being shown then resized but whatever that part is fixed.

Now another problem. Here is the section from the windows xml
code:
    <WindowTmpl>
        <Corners Shape="Rectangle">
            <RoundSize>0</RoundSize>
        </Corners>
    </WindowTmpl>

With setting that style you would assume the windows corners would be square however as shown in the graphic this is not the case:

[Image: attachment.php?pid=879956]
RE: Patchou: Script Windows have an invisible titlebar/border by Spunky on 01-04-2008 at 08:45 PM

quote:
Originally posted by matty
With setting that style you would assume the windows corners would be square however as shown in the graphic this is not the case:

Doesn't the number have to be odd? I know 0 is neither odd or even, but it accepts numbers like 1,3,5 etc so 0 might get rounded up...
RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-04-2008 at 09:12 PM

quote:
Originally posted by SpunkyLoveMuff
quote:
Originally posted by matty
With setting that style you would assume the windows corners would be square however as shown in the graphic this is not the case:

Doesn't the number have to be odd? I know 0 is neither odd or even, but it accepts numbers like 1,3,5 etc so 0 might get rounded up...
0 and 1 have the same affect after I tested I figured I would leave it as 0.
RE: Patchou: Script Windows have an invisible titlebar/border by Matti on 01-05-2008 at 11:23 AM

Hmm... the scripting documentation says:

quote:
element Window/WindowTmpl/Corners/RoundSize
Only valid if shape is Round. Must be an odd value.
So I think it should simply ignore that. Maybe just remove it?
code:
    <WindowTmpl>
        <Corners Shape="Rectangle"/>
    </WindowTmpl>

RE: Patchou: Script Windows have an invisible titlebar/border by Patchou on 01-05-2008 at 05:51 PM

The options parameter is a bit field so if you were using 0x0001 before, just set the option to 0x101 (0x1 + 0x100) and you will get what you want. This option is not documented because scripts are not supposed to use it, but well... ;)


RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-06-2008 at 03:14 PM

quote:
Originally posted by Patchou
The options parameter is a bit field so if you were using 0x0001 before, just set the option to 0x101 (0x1 + 0x100) and you will get what you want. This option is not documented because scripts are not supposed to use it, but well... ;)
Ok so I can fix that but setting the corners to be rectangle they are still missing a pixel as posted here matty's reply to Patchou: Script Windows have an invisible titlebar/border.
RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-11-2008 at 01:09 PM

bump....


RE: Patchou: Script Windows have an invisible titlebar/border by Patchou on 01-11-2008 at 03:50 PM

Matty, I'll check this, don't worry. If it's a bug, it will be fixed :)


RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-14-2008 at 09:39 PM

More side effects from using 0x100 when creating the window. When the window is maximized the custom plus! system tools (minimize, maximize/restore, close) are removed. You can subclass the window and detect when it is being Maximized and you can use the ShowWindow api to show them but this should be fixed on Plus! side ;)


RE: Patchou: Script Windows have an invisible titlebar/border by Matti on 01-15-2008 at 07:27 PM

quote:
Originally posted by matty
More side effects from using 0x100 when creating the window. When the window is maximized the custom plus! system tools (minimize, maximize/restore, close) are removed. You can subclass the window and detect when it is being Maximized and you can use the ShowWindow api to show them but this should be fixed on Plus! side ;)
I'd say that's because the title bar is removed. When you maximize a "regular" Plus! window, the buttons are hidden since the title bar is shown and contains native min-max-close buttons. So, if you'd remove that title bar, well, you'd lose those buttons too. :P

Although this is a hidden option and shouldn't be used in scripts, I agree with Matty that it should be fixed in some way. :)
RE: Patchou: Script Windows have an invisible titlebar/border by matty on 01-16-2008 at 01:20 PM

code:
function OnWindowIdEvent_MessageNotification(pPlusWnd, nMessage, wParam, lParam) {
    switch (nMessage){
        case 0x5 /* WM_SIZE */:
            if (wParam === 2 /* SIZE_MAXIMIZED */) {
                Interop.Call('user32', 'ShowWindow', pPlusWnd.GetControlHandle('BaseBtnMinimise'), 5 /* SW_SHOW */);
                Interop.Call('user32', 'ShowWindow', pPlusWnd.GetControlHandle('BaseBtnMaximise'), 5 /* SW_SHOW */);
                Interop.Call('user32', 'ShowWindow', pPlusWnd.GetControlHandle('BaseBtnCancel'), 5 /* SW_SHOW */);
            }
        break;
    }
}

Simple as that as far as a work around.