I want to set anexact client size (say 300 x 300) when I create a normal 'overlapped' window.
There is the AdjustWindowRectEx() function where I can pass the desired client
area and get sizes that I can pass to CreateWindowEx but it says
in the documentation that I should not use it for overlapped windows
and I do not understand why.
When I pass 300 x 300, I got 306 x 326 from it, and when I receive
WM_SIZE, the client size is 298 x 298 so it is 2 pixels too small.
How to create overlapped window with exact given client size?
My mistake in my case was the following:
AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, WS_CLIPSIBLINGS, FALSE, WS_OVERLAPPEDWINDOW);
Changing to this fixes it:
AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, WS_CLIPSIBLINGS, FALSE, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With