Corrections to Lesson 01

Started by
0 comments, last by singulab 20 years, 4 months ago
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.
Advertisement
I''d noticed that myself actually... but in my infinite wisdom of the time (probably half asleep I guess) I recoded it using GetSystemMetrics - not exactly the easy way around the problem

This topic is closed to new replies.

Advertisement