Search code examples
windowswinapiwindowsizemax

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


My purpose is to size a window to 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.


Solution

  • 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;
    }