开发者

Can a window be resized past the screen size/offscreen?

My purpose is to size a window t开发者_StackOverflowo a width/height greater than the size of my physical screen programmatically under Win32. How can I do this?

On my systems it seems the maximum size of a given window is bound by the size of my screen whether programmatically or whether sizing manually by dragging the sizing cursor.

I have tried programmatically with SetWindowPos() and MoveWindow() and both cap the size of the target window. Oddly I know some people do not have this 'cap' so I wonder whether this is perhaps due to some OS setting (registry). Does anyone know something about this? Or perhaps some way to workaround it?

// Edit: new developments

I am testing on Windows XP and Windows 7. The graphics cards I'm using are a NVIDIA Quadro NVS 290 (256MB) and a Geforce 9800GT (1GB). After further investigation it looks like Windows is intercepting the message and fiddling with the parameters. For example, if you call SetWindowPos to make a target 2000x2000 it will only receive a WM_SIZE for the capped x/y.


Implement a message handler for WM_GETMINMAXINFO to stop Windows from applying the sane default behavior:

case WM_GETMINMAXINFO: {
    DefWindowProc(hWnd, message, wParam, lParam);
    MINMAXINFO* pmmi = (MINMAXINFO*)lParam;
    pmmi->ptMaxTrackSize.x = 2000;
    pmmi->ptMaxTrackSize.y = 2000;
    return 0;
}


Windows with a thick frame (to allow user resize) are restricted from growing larger than the desktop.

Try SetWindowLong() clearing the THICKFRAME (0x40000) flag.

The following should allow programatic sizing, but the user will lose the ability to resize. If you add the Thickframe back after sizing, the user can resize, but when he does so the window will immediately shrink back to the desktop limited size.

The following is from some csharp code that also removes all borders, caption, etc:

WS style = (WS)GetWindowLong(ptr, GWL_STYLE); style = style & ~WS.BORDER & ~WS.ThickFrame & ~WS.SYSMENU & ~WS.CAPTION | WS.POPUP; SetWindowLong(ptr, GWL_STYLE, (int)style);


A good tool to play with window settings is uuSpy. It's like Microsoft Spy++, but allows you to modify settings like THICKFRAME.


Yes, windows can be larger than the screen (or even the sum of all your monitors). Windows can also be positioned off-screen (which some applications do as a hack to hide while remaining active).

Perhaps the Windows 7 desktop manager is kicking in and trying to "dock" those windows to the edges of your screen for you.

You might try using the slightly lower-level API SetWindowPos, which gives you control over notifications, z-order, and other stuff.


You can get a window to be larger in resolution (and even way way larger) than your screen, using the 'Infinte Screen" software: http://ynea.futureware.at/cgi-bin/infinite_screen.pl

Here's how to use it:

  1. Download it, run it.

  2. In the Oversize tab, choose the Windows you want to enlarge.

  3. Give it the Width and Height you want. Done!

Just in case you need a large screenshot (that's how I ended up here): If you want to get a screenshot of the window, you've got a screenshot option in the same Oversize tab. (Because screenshots are normally no bigger than the screen size, even if the window is larger). Another (and better) way to screenshot the window is using Greenshot, as you can save them in .tiff and directly watching the window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜