Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows
For a Win32 application, the original distance from the left border of the monitor is
passed as the x argument to the CreateWindow() or the CreateWindowEx() function.
The distance from top is specified using the y argument. The x and y arguments define
the location of the window. The distance from the left border of the monitor to the right
border of the window is specified as the nWidth argument. The distance from the top
border of the monitor to the lower border of the window is specified with the nHeight
value.
If you cannot make up your mind for these four values, you can use the
CW_USEDEFAULT (when-Creating-the-Window-USE-the-DEFAULT-value) constant
for either one or all four arguments. In such a case, the compiler would select a value for
the argument.
For an MFC application, when calling the CFrameWnd::Create() method, the location
and size of the frame window is specified as a RECT or CRect rectangle as we saw in
Lesson 2. As done with the CW_USEDEFAULT constant, you can let the compiler
decide on the rectangle by passing the rect argument as rectDefault. Here is an example:
CMainFrame::CMainFrame()
{
// Declare a window class variable
WNDCLASS WndCls;
const char *StrWndName = "Windows Fundamentals";
...
const char *StrClass = AfxRegisterWndClass(WndCls.style, WndCls.hCursor,