Jump to content
  • Advertisement
Sign in to follow this  
GeneralQuery

Win32 Client Area Problem

This topic is 2601 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

Hi, I use AdjustWindowRectEx so I can set a specific size for the client area, but it's always out by 15 pixels. This is the code I use:

[source]
wndRect.right = pxWidth;
wndRect.bottom = pxHeight;
wndExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
wndStyle=WS_OVERLAPPEDWINDOW;
wndRect.left = 0;
wndRect.top = 0;

// Must be called to ensure window is actuall the size the user requested (i.e. not 613 x 468 if user wanted 640 x 480)
AdjustWindowRectEx(&wndRect, wndStyle, false, wndExStyle);

pxWidth = wndRect.right-wndRect.left;
pxHeight = wndRect.bottom-wndRect.top;

// Go ahead and reate the window
hWnd = CreateWindowEx( wndExStyle,
wndClass,
wndTitle,
wndStyle,
0, 0,
pxWidth, pxHeight,
hParentWnd,
0,
hInstance,
NULL);
[/source]
When I set pxWidth and pxHeight to 1024 and 768 respectively and create the window, a call to GetClientRect() returns a width of 1024 and a height of 752. However, when I use a width and height of 800 and 600, the call GetClientRect() returns a valid result of 800 and 600. My desktop resolution is 1366x768, so is this stopping my 1024x768 window from being created with the requested size?

Share this post


Link to post
Share on other sites
Advertisement
My desktop resolution is 1366x768, so is this stopping my 1024x768 window from being created with the requested size? [/quote]

Exactly this. Try to resize any window larger than this. Just put some window half outside the screen and then try to drag the border to the other side.
It will stop when the windows size has reached your resolution.

You can create your window with the WS_POPUP style to have a window without borders which can fill out the whole screen resolution. Or, if you are using DirectX or something your can create a fullscreen swapchain.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!