Added: window adjustment
This commit is contained in:
@@ -16,15 +16,19 @@ INT Window::init(HINSTANCE hInstance, UINT width, UINT height)
|
|||||||
if (!RegisterClass(&wc)) return 100;
|
if (!RegisterClass(&wc)) return 100;
|
||||||
|
|
||||||
// 3. adjust window size (optional)
|
// 3. adjust window size (optional)
|
||||||
|
DWORD style = WS_OVERLAPPEDWINDOW; // window with title bar & some more decorations
|
||||||
|
//DWORD style = WS_POPUP; // window without any decorations
|
||||||
|
|
||||||
|
RECT rect = { 100, 100, 100 + width, 100 + height }; // left-top & bottom-right corners
|
||||||
|
AdjustWindowRect(&rect, style, FALSE);
|
||||||
|
|
||||||
// 4. create window instance
|
// 4. create window instance
|
||||||
_hWnd = CreateWindow(
|
_hWnd = CreateWindow(
|
||||||
wc.lpszClassName, // class name
|
wc.lpszClassName, // class name
|
||||||
wc.lpszClassName, // window title
|
wc.lpszClassName, // window title
|
||||||
WS_OVERLAPPEDWINDOW, // visual style
|
style, // visual style
|
||||||
100, 100, // window position (left-top corner)
|
rect.left, rect.top, // window position (left-top corner)
|
||||||
width, height, // window size
|
rect.right - rect.left, rect.bottom - rect.top, // window size
|
||||||
nullptr, // optional handle to a parent window
|
nullptr, // optional handle to a parent window
|
||||||
nullptr, // optional handle to a menu instance
|
nullptr, // optional handle to a menu instance
|
||||||
hInstance,
|
hInstance,
|
||||||
|
|||||||
Reference in New Issue
Block a user