Visual C++ and MFC Fundamentals Chapter 2: Introduction to MFC
Figure 32: Illustration of Window Origin and Location.........................................................
Microsoft Windows represents items as a coordinate system whose origin (0, 0) is located
on the top-left corner of the screen. Everything else is positioned from that point.
Therefore:
?? the distance from the left border of the screen to left border of a window represents
the left measurement
?? the distance from the top border of the screen to the top border of a window is the
top measurement.
?? the distance from the left border of the screen to the right border of a window
represents the right measurement
?? the distance from the top border of the screen to the bottom border of a window is
the top measurement.
To represent these distances, the Win32 API provides a structure called RECT and
defined as follows:
typedef struct _RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT;