Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 2: Introduction to MFC


of a window, the window must have a special type of border referred to as a thick frame.
To provide this border, apply or add the WS_THICKFRAME style:

Create(NULL, "Windows Application",
WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_THICKFRAME);

Because many windows will need this functionality, a special style can combine them
and it is called WS_OVERLAPPEDWINDOW. Therefore, you can create a resizable
window as follows:

Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW);

Practical Learning: Building a Regular Window



  1. To create a resizable window, change the file as follows:


CSimpleFrame::CSimpleFrame()
{
// Create the window's frame
Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW);
}


  1. Test the program. When the window comes up, minimize, maximize, restore, and
    resize it:


Figure 29: Windows Application - Resizing.............................................................................



  1. To close the window, click its system Close button


2.2.5 Windows Location..................................................................................


To locate things that display on the monitor screen, the computer uses a coordinate
system similar to the Cartesian's but the origin is located on the top left corner of the
Free download pdf