Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
const char *StrClass = AfxRegisterWndClass(WndCls.style, WndCls.hCursor,
WndCls.hbrBackground, WndCls.hIcon);
Create(StrClass, StrWndName, WS_OVERLAPPEDWINDOW);
}
Remember that, to apply a combination of styles, use the bitwise OR operator.
If you are designing a form or a dialog box, you can use the Properties window to
visually select the styles you want to apply to the window:
Practical Learning: Creating an Overlapped Window
- To create borders and a title bar for the window, apply the
WS_OVERLAPPEDWINDOW style as follows:
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
hWnd = CreateWindowEx(0,
StrClassName,
StrWndName,
WS_OVERLAPPEDWINDOW, );
return 0;
}
//---------------------------------------------------------------------------
- Save all
10.2.5..Window's Location and Size.............................................................
As we learned in Lesson 2, the location of a window is defined by the distance from the
left border of the monitor to the window's left border and its distance from the top border
of the monitor to its own top border. The size of a window is its width and its height.
These can be illustrated for a main window frame as follows: