Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 1.39 KB

using-a-window.md

File metadata and controls

18 lines (13 loc) · 1.39 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Using a Window
Using a Window (ATL)
11/04/2016
ATL, windows
CWindow class, about CWindow class
windows [C++], ATL
b3b9cc8e-4287-486b-b080-38852bc2943a

Using a Window

Class CWindow allows you to use a window. Once you attach a window to a CWindow object, you can then call CWindow methods to manipulate the window. CWindow also contains an HWND operator to convert a CWindow object to an HWND. Thus you can pass a CWindow object to any function that requires a handle to a window. You can easily mix CWindow method calls and Win32 function calls, without creating any temporary objects.

Because CWindow has only two data member (a window handle and the default dimensions), it does not impose an overhead on your code. In addition, many of the CWindow methods simply wrap corresponding Win32 API functions. By using CWindow, the HWND member is automatically passed to the Win32 function.

In addition to using CWindow directly, you can also derive from it to add data or code to your class. ATL itself derives three classes from CWindow: CWindowImpl, CDialogImpl, and CContainedWindowT.

See also

Window Classes