Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
class CWnd
◄CObject► ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
Description
The CWnd class provides the base functionality of all window classes in
the Microsoft Foundation Class Library.
A CWnd object is actually distinct from a Windows window, but the two
are tightly linked. A CWnd object is created or destroyed by the CWnd
constructor and destructor. The Windows window, on the other hand, is a
data structure internal to Windows that is created by the CreateEx
member function and destroyed by the CWnd virtual destructor. The
DestroyWindow function, one of the few public virtual CWnd member
functions, destroys the Windows window without destroying the object.
The CWnd class and the message-map mechanism hide the WndProc function.
Incoming Windows notification messages are automatically routed through
the message map to the proper On<Message> CWnd member functions. You
override the On<Message> member function to handle that member's
particular message in your derived classes.
The CWnd class also provides the functionality of a Windows child
window.
To create a useful child window for your application, derive a class
from CWnd. Add member variables to the derived class to store data
specific to your application. Implement message-handler member functions
and a message map in the derived class to specify what happens when
messages are directed to the window.
You create a child window in two steps. First, call the constructor CWnd
to construct the CWnd object, then call the ◄Create► member function to
create the child window and attach it to the CWnd object.
Construction can be a one-step process in a derived class. Write a
constructor for the derived class and call Create from within the
constructor.
When the user terminates your child window, destroy the CWnd object, or
call the DestroyWindow member function to remove the window and destroy
its data structures. If you allocate any memory in the CWnd object,
override the CWnd destructor to dispose of the allocations.
Within the Microsoft Foundation Class Library, further classes are
derived from CWnd to provide specific window types. Three of these
classes, CFrameWnd, CMDIFrameWnd, and CMDIChildWnd, contain further
window functionality and are designed for further derivation. The
control classes derived from CWnd, such as CDialog and CButton, can be
used directly, or can also be used for further derivation of classes.
See Also
◄CDialog►, ◄CModalDialog►, ◄CStatic►, ◄CButton►, ◄CEdit►, ◄CListBox►,
◄CComboBox►, ◄CScrollBar►, ◄CFrameWnd►, ◄CMDIFrameWnd►, ◄CMDIChildWnd►
Public Members
To view CWnd members, select one of the following categories:
◄Data Members►
◄Construction/Destruction►
◄Initialization►
◄Window State Functions►
◄Window Size and Position►
◄Window Access Functions►
◄Update/Painting Functions►
◄Coordinate Mapping Functions►
◄Window Text Functions►
◄Scrolling Functions►
◄Caret Functions►
◄Child Window Attributes►
◄Dialog-Box Item Functions►
◄Menu Functions►
◄Timer Functions►
◄Alert Functions►
◄Message Functions►
◄Clipboard Functions►
◄Initialization Message Handlers►
◄System Message Handlers►
◄General Message Handlers►
◄Input Message Handlers►
◄Nonclient-Area Message Handlers►
◄MDI Message Handlers►
◄Control Message Handlers►
◄Clipboard Message Handlers►
◄Windows 3.1 Functions►
Protected Members
◄Initialization►
◄Operations►
-♦-