I learned something new about the window manager today

| | Comments (5)

A bug report came in recently that made me dig into the Win32 window manager a fair amount. You can play along too!

Make a new project, and set the width and height of the default window to be something larger than your screen resolution. My screen runs at 1600x1200, so I made the window 2000x2000. If you run the application, you'll notice that the window is roughly the exact size of the screen. If you run Spy++, you'll see that the window's dimensions were reduced. Now, go back and set the window's frame type to be plain box and run the project again. Interestingly enough, now the window is 2000x2000 pixels (and Spy++ can verify).

So it turns out that the Win32 window manager is responsible for this muckery. If you have a window with a caption bar (know as an "overlapped window"), then the window manager will automatically ensure that it's contained within a screen. However, if your window doesn't have the caption bar (known as a "popup window"), then it won't resize it.

I had no idea that the manager would do that sort of thing for you. Needless to say, it would cause problems with controls which are locked on the window (which is the REALbasic bug).

After a decade (or so) of programming for Windows, I still learn new things every day.

5 Comments

How would you go about compensating for that? If it is an RB bug, what could be done? Not that I would ever make a 2000x2000 window... It would be UGLY on nearly every monitor unless you happen to have a really big one.

It's not an RB bug.. as for what can be done, it depends entirely on what your needs are. It looks like the Win32 window manager simply doesn't allow framed windows to be bigger than what can be displayed (it's not just window creation which shows this -- MoveWindow does it as well).

The RB bug was that you'd design your window at 2000x2000 and lock controls to it. Then, the window is resized behind everyone's back and the locking isn't updated properly. We're working on a fix for that bug.

And btw, this is more commonly a problem when you're designing your window for 1024x768 and the user's setup is for 800x600.

Is there a bug number on that one?

Is it related to issues with intermittently running multiple monitors and disparate window location? In my case, sometimes RB IDE and mostly the Language Reference windows. I've been plagued by that on occasion and never could get it nailed down or recall the resolution.

@DeanG -- Yeah, the ID is djpoanue, and it has nothing to do with what you're thinking. This is a much more basic issue to do with windows in general.

Elastic Window can help solve that problem. Also, if you make the app MDI, then your window won't be clipped by the screen resolution. Interesting, 'eh?

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.