Jump to content
  • Advertisement
Sign in to follow this  
andrew1b

Locking the window size

This topic is 3648 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey there, I'm using Win32 with Direct3D in windowed mode and I want to know how to prevent my window from resizing. Is it possible?

Share this post


Link to post
Share on other sites
Advertisement
Yes, look up WM_SIZING. You can alter the RECT to keep it at a minimum or maximum size.

Alternatively, if you want a fixed size, you can use the window style during CreateWindow(). Typically you'll create an WS_OVERLAPPEDWINDOW window, which is short for WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX.

WS_THICKFRAME makes the border sizable, so just leave that out. May have to experiment a bit to get the desired style.

Share this post


Link to post
Share on other sites
Alternatively, you can use the MINMAXINFO struct to tell the window to have a size restriction:



case WM_GETMINMAXINFO:

MINMAXINFO *minMaxInfo;

// Force a minimum of 250x250 pixel size window
minMaxInfo = (MINMAXINFO *) lParam;
minMaxInfo->ptMinTrackSize.x = 250;
minMaxInfo->ptMinTrackSize.y = 250;

if (lockWindowSize)
{
minMaxInfo->ptMinTrackSize.x = minWidth;
minMaxInfo->ptMinTrackSize.y = minHeight;
minMaxInfo->ptMaxTrackSize.x = maxWidth;
minMaxInfo->ptMaxTrackSize.y = maxHeight;
}

return FALSE;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!