Corrections to Lesson 01
I don''t know if it has been pointed out before but this is not yet corrected in the tutorials:
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
in Lesson 01 is misused: it does not perform correctly. If you comment it out, the same size of window results.
The correct code is:
// ----------------------------------------------------------
// RECT *rct contains the desired size of the window
long nLeft = rct->left;
long nTop = rct->top;
long nWidth, nHeight;
...
// in DEVMODE -
// width and height init once for fullscreen
dmSettings.dmPelsWidth = (nWidth = rct->right - rct->left);
dmSettings.dmPelsHeight = (nHeight = rct->bottom - rct->top);
...
// width and height init once for windowed
// or init again if fullscreen failed
if (!bFullScreen)
{
AdjustWindowRectEx(rct, dwStyle, FALSE, dwExStyle);
nWidth = rct->right - rct->left;
nHeight = rct->bottom - rct->top;
}
// this makes sures that the window is at the desired top-left
// and with a suitable width and height
if (!(m_hWnd = CreateWindowEx(dwExStyle, szClassName, szAppTitle, dwStyle, nLeft, nTop, nWidth, nHeight, NULL, NULL, hInstance, NULL)))
// ----------------------------------------------------------
Please point out if I have made any mistakes.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement