Share via


CWindow Class

This class provides methods for manipulating a window.

class CWindow

Remarks

CWindow provides the base functionality for manipulating a window in ATL. Many of the CWindow methods simply wrap one of the Win32 API functions. For example, compare the prototypes for CWindow::ShowWindow and ShowWindow:

CWindow method

Win32 function

BOOL ShowWindow( int nCmdShow );

BOOL ShowWindow( HWND hWnd, int nCmdShow );

CWindow::ShowWindow calls the Win32 function ShowWindow by passing CWindow::m_hWnd as the first parameter. Every CWindow method that directly wraps a Win32 function passes the m_hWnd member; therefore, much of the CWindow documentation will refer you to the Windows SDK.

Note

Not every window-related Win32 function is wrapped by CWindow, and not every CWindow method wraps a Win32 function.

CWindow::m_hWnd stores the HWND that identifies a window. An HWND is attached to your object when you:

  • Specify an HWND in CWindow's constructor.

  • Call CWindow::Attach.

  • Use CWindow's operator =.

  • Create or subclass a window using one of the following classes derived from CWindow:

    CWindowImpl   Allows you to create a new window or subclass an existing window.

    CContainedWindow   Implements a window contained within another object. You can create a new window or subclass an existing window.

    CDialogImpl   Allows you to create a modal or modeless dialog box.

For more information about windows, see Windows and subsequent topics in the Windows SDK. For more information about using windows in ATL, see the article ATL Window Classes.

Requirements

Header: atlwin.h

See Also

Other Resources

CWindow Members

ATL Class Overview