class CWindow
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 Win32 SDK documentation.
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:
For more information about windows, see "Windows" and subsequent topics in the Win32 SDK. For more information about using windows in ATL, see the article ATL Window Classes.
#include <atlwin.h>
Alert Methods | Icon Methods |
Attribute Methods | Menu Methods |
Caret Methods | Message Methods |
Clipboard Methods | Scrolling Methods |
Construction, Destruction, and Initialization | Timer Methods |
Coordinate Mapping Methods | Update and Painting Methods |
Dialog Box Item Methods | Window Access Methods |
Drag-Drop Methods | Window Size and Position Methods |
Font Methods | Window State Methods |
Help Methods | Window Text Methods |
Hot Key Methods | Window Tree Access Methods |
Operators | |
Data Members | |
Alert Methods | |
FlashWindow | Flashes the window once. |
MessageBox | Displays a message box. |
Attribute Methods | |
GetExStyle | Retrieves the extended window styles. |
GetStyle | Retrieves the window styles. |
GetWindowLong | Retrieves a 32-bit value at a specified offset into the extra window memory. |
GetWindowWord | Retrieves a 16-bit value at a specified offset into the extra window memory. |
ModifyStyle | Modifies the window styles. |
ModifyStyleEx | Modifies the extended window styles. |
SetWindowLong | Sets a 32-bit value at a specified offset into the extra window memory. |
SetWindowWord | Sets a 16-bit value at a specified offset into the extra window memory. |
Caret Methods | |
CreateCaret | Creates a new shape for the system caret. |
CreateGrayCaret | Creates a gray rectangle for the system caret. |
CreateSolidCaret | Creates a solid rectangle for the system caret. |
HideCaret | Hides the system caret. |
ShowCaret | Displays the system caret. |
Clipboard Methods | |
ChangeClipboardChain | Removes the window from the chain of Clipboard viewers. |
OpenClipboard | Opens the Clipboard. |
SetClipboardViewer | Adds the window to the Clipboard viewer chain. |
Construction, Destruction, and Initialization | |
Attach | Attaches a window to the CWindow object. |
CWindow | Constructor. |
DestroyWindow | Destroys the window associated with the CWindow object. |
Detach | Detaches the window from the CWindow object. |
Coordinate Mapping Methods | |
ClientToScreen | Converts client coordinates to screen coordinates. |
MapWindowPoints | Converts a set of points from the window's coordinate space to the coordinate space of another window. |
ScreenToClient | Converts screen coordinates to client coordinates. |
Dialog Box Item Methods | |
CheckDlgButton | Changes the check state of the specified button. |
CheckRadioButton | Checks the specified radio button. |
DlgDirList | Fills a list box with the names of all files matching a specified path or filename. |
DlgDirListComboBox | Fills a combo box with the names of all files matching a specified path or filename. |
DlgDirSelect | Retrieves the current selection from a list box. |
DlgDirSelectComboBox | Retrieves the current selection from a combo box. |
GetDlgItemInt | Translates a control's text to an integer. |
GetDlgItemText | Retrieves a control's text. |
GetNextDlgGroupItem | Retrieves the previous or next control within a group of controls. |
GetNextDlgTabItem | Retrieves the previous or next control having the WS_TABSTOP style. |
IsDlgButtonChecked | Determines the check state of the button. |
SendDlgItemMessage | Sends a message to a control. |
SetDlgItemInt | Changes a control's text to the string representation of an integer value. |
SetDlgItemText | Changes a control's text. |
Drag-Drop Methods | |
DragAcceptFiles | Registers whether the window accepts dragged files. |
Font Methods | |
GetFont | Retrieves the window's current font. |
SetFont | Changes the window's current font. |
Help Methods | |
GetWindowContextHelpId | Retrieves the window's help context identifier. |
SetWindowContextHelpId | Sets the window's help context identifier. |
WinHelp | Starts Windows Help. |
Hot Key Methods | |
GetHotKey | Determines the hot key associated with the window. |
SetHotKey | Associates a hot key with the window. |
Icon Methods | |
GetIcon | Retrieves the window's large or small icon. |
SetIcon | Changes the window's large or small icon. |
Menu Methods | |
DrawMenuBar | Redraws the window's menu bar. |
GetMenu | Retrieves the window's menu. |
GetSystemMenu | Creates a copy of the system menu for modification. |
HiliteMenuItem | Highlights or removes the highlight from a top-level menu item. |
SetMenu | Changes the window's current menu. |
Message Methods | |
PostMessage | Places a message in the message queue associated with the thread that created the window. Returns without waiting for the thread to process the message. |
SendMessage | Sends a message to the window and does not return until the window procedure has processed the message. |
SendNotifyMessage | Sends a message to the window. If the window was created by the calling thread, SendNotifyMessage does not return until the window procedure has processed the message. Otherwise, it returns immediately. |
Scrolling Methods | |
EnableScrollBar | Enables or disables the scroll bar arrows. |
GetScrollPos | Retrieves the position of the scroll box. |
GetScrollRange | Retrieves the scroll bar range. |
ScrollWindow | Scrolls the specified client area. |
ScrollWindowEx | Scrolls the specified client area with additional features. |
SetScrollPos | Changes the position of the scroll box. |
SetScrollRange | Changes the scroll bar range. |
ShowScrollBar | Shows or hides a scroll bar. |
Timer Methods | |
KillTimer | Destroys a timer event. |
SetTimer | Creates a timer event. |
Update and Painting Methods | |
BeginPaint | Prepares the window for painting. |
EndPaint | Marks the end of painting. |
GetDC | Retrieves a device context for the client area. |
GetDCEx | Retrieves a device context for the client area and allows clipping options. |
GetUpdateRect | Retrieves the coordinates of the smallest rectangle that completely encloses the update region. |
GetUpdateRgn | Retrieves the update region and copies it into a specified region. |
GetWindowDC | Retrieves a device context for the entire window. |
Invalidate | Invalidates the entire client area. |
InvalidateRect | Invalidates the client area within the specified rectangle. |
InvalidateRgn | Invalidates the client area within the specified region. |
IsWindowVisible | Determines the window's visibility state. |
LockWindowUpdate | Disables or enables drawing in the window. |
Requests that the window be drawn in a specified device context. | |
PrintClient | Requests that the window's client area be drawn in a specified device context. |
RedrawWindow | Updates a specified rectangle or region in the client area. |
ReleaseDC | Releases a device context. |
SetRedraw | Sets or clears the redraw flag. |
ShowOwnedPopups | Shows or hides the pop-up windows owned by the window. |
ShowWindow | Sets the window's show state. |
UpdateWindow | Updates the client area. |
ValidateRect | Validates the client area within the specified rectangle. |
ValidateRgn | Validates the client area within the specified region. |
Window Access Methods | |
ChildWindowFromPoint | Retrieves the child window containing the specified point. |
ChildWindowFromPointEx | Retrieves a particular type of child window containing the specified point. |
GetLastActivePopup | Retrieves the most recently active pop-up window. |
GetParent | Retrieves the immediate parent window. |
GetTopLevelParent | Retrieves the top-level parent or owner window. |
GetTopLevelWindow | Retrieves the top-level owner window. |
GetTopWindow | Retrieves the top-level child window. |
GetWindow | Retrieves the specified window. |
IsChild | Determines whether the specified window is a child window. |
SetParent | Changes the parent window. |
Window Size and Position Methods | |
ArrangeIconicWindows | Arranges all minimized child windows. |
BringWindowToTop | Brings the window to the top of the Z order. |
CenterWindow | Centers the window against a given window. |
GetClientRect | Retrieves the coordinates of the client area. |
GetWindowPlacement | Retrieves the show state and positions. |
GetWindowRect | Retrieves the window's bounding dimensions. |
IsIconic | Determines whether the window is minimized. |
IsZoomed | Determines whether the window is maximized. |
MoveWindow | Changes the window's size and position. |
SetWindowPlacement | Sets the show state and positions. |
SetWindowPos | Sets the size, position, and Z order. |
Window State Methods | |
EnableWindow | Enables or disables input. |
IsWindowEnabled | Determines whether the window is enabled for input. |
SetActiveWindow | Activates the window. |
SetCapture | Sends all subsequent mouse input to the window. |
SetFocus | Sets the input focus to the window. |
Window Text Methods | |
GetWindowText | Retrieves the window's text. |
GetWindowTextLength | Retrieves the length of the window's text. |
SetWindowText | Changes the window's text. |
Window Tree Access Methods | |
GetDescendantWindow | Retrieves the specified descendant window. |
GetDlgCtrlID | Retrieves the window's identifier (for child windows only). |
GetDlgItem | Retrieves the specified child window. |
SendMessageToDescendants | Sends a message to the specified descendant windows. |
SetDlgCtrlID | Changes the window's identifier. |
Operators | |
operator HWND | Converts the CWindow object to an HWND. |
operator = | Assigns an HWND to the CWindow object. |
Data Members | |
m_hWnd | The handle to the window associated with the CWindow object. |
UINT ArrangeIconicWindows( );
See ArrangeIconicWindows in the Win32 SDK.
Remarks
Arranges all minimized child windows.
CWindow Overview | Class Members
void Attach( HWND hWndNew );
Parameters
hWndNew [in] The handle to a window.
Remarks
Attaches the window identified by hWndNew to the CWindow object.
CWindow Overview | Class Members
See Also CWindow::Detach
HDC BeginPaint( LPPAINTSTRUCT lpPaint );
See BeginPaint in the Win32 SDK.
Remarks
Prepares the window for painting.
CWindow Overview | Class Members
See Also CWindow::EndPaint
BOOL BringWindowToTop( );
See BringWindowToTop in the Win32 SDK.
Remarks
Brings the window to the top of the Z order.
CWindow Overview | Class Members
See Also CWindow::MoveWindow, CWindow::SetWindowPos
BOOL CenterWindow( HWND hWndCenter = NULL );
Return Value
TRUE if the window is successfully centered; otherwise, FALSE.
Parameters
hWndCenter [in] The handle to the window against which to center. If this parameter is NULL (the default value), the method will set hWndCenter to the window's parent window if it is a child window. Otherwise, it will set hWndCenter to the window's owner window.
Remarks
Centers the window against a given window.
CWindow Overview | Class Members
See Also CWindow::MoveWindow, CWindow::SetWindowPos
BOOL ChangeClipboardChain( HWND hWndNewNext );
See ChangeClipboardChain in the Win32 SDK.
Remarks
Removes the window from the chain of Clipboard viewers.
CWindow Overview | Class Members
See Also CWindow::SetClipboardViewer
BOOL CheckDlgButton( int nIDButton, UINT nCheck );
See CheckDlgButton in the Win32 SDK.
Remarks
Changes the check state of the specified button.
CWindow Overview | Class Members
See Also CWindow::CheckRadioButton, CWindow::IsDlgButtonChecked
BOOL CheckRadioButton( int nIDFirstButton, int nIDLastButton, int nIDCheckButton );
See CheckRadioButton in the Win32 SDK.
Remarks
Checks the specified radio button.
CWindow Overview | Class Members
See Also CWindow::CheckDlgButton
HWND ChildWindowFromPoint( POINT point ) const;
See ChildWindowFromPoint in the Win32 SDK.
Remarks
Retrieves the child window containing the specified point.
CWindow Overview | Class Members
See Also CWindow::ChildWindowFromPointEx
HWND ChildWindowFromPoint( POINT point, UINT uFlags ) const;
See ChildWindowFromPointEx in the Win32 SDK.
Remarks
Retrieves a particular type of child window containing the specified point.
CWindow Overview | Class Members
See Also CWindow::ChildWindowFromPoint
BOOL ClientToScreen( LPPOINT lpPoint ) const;
BOOL ClientToScreen( LPRECT lpRect ) const;
See ClientToScreen in the Win32 SDK.
Remarks
Converts client coordinates to screen coordinates. The second version of this method allows you to convert the coordinates of a RECT structure.
CWindow Overview | Class Members
See Also CWindow::ScreenToClient
BOOL CreateCaret( HBITMAP pBitmap );
See CreateCaret in the Win32 SDK.
Remarks
Creates a new shape for the system caret.
CWindow Overview | Class Members
See Also CWindow::CreateGrayCaret, CWindow::CreateSolidCaret
BOOL CreateGrayCaret( int nWidth, int nHeight );
See CreateCaret in the Win32 SDK.
Remarks
Creates a gray rectangle for the system caret. Passes (HBITMAP) 1 for the bitmap handle parameter to the Win32 function.
CWindow Overview | Class Members
See Also CWindow::CreateCaret, CWindow::CreateSolidCaret
BOOL CreateSolidCaret( int nWidth, int nHeight );
See CreateCaret in the Win32 SDK.
Remarks
Creates a solid rectangle for the system caret. Passes (HBITMAP) 0 for the bitmap handle parameter to the Win32 function.
CWindow Overview | Class Members
See Also CWindow::CreateCaret, CWindow::CreateGrayCaret
CWindow( HWND hWnd = NULL );
Parameters
hWnd [in] The handle to a window.
Remarks
The constructor. Initializes the m_hWnd member to hWnd, which by default is NULL.
Note CWindow::CWindow does not create a window. Classes CWindowImpl, CContainedWindow, and CDialogImpl (all of which derive from CWindow) provide a method to create a window or dialog box, which is then assigned to CWindow::m_hWnd. You can also use the CreateWindow Win32 function.
CWindow Overview | Class Members
BOOL DestroyWindow( );
See DestroyWindow in the Win32 SDK.
Remarks
Destroys the window associated with the CWindow object and sets m_hWnd to NULL. It does not destroy the CWindow object itself.
CWindow Overview | Class Members
HWND Detach( );
Return Value
The HWND associated with the CWindow object.
Remarks
Detaches m_hWnd from the CWindow object and sets m_hWnd to NULL.
CWindow Overview | Class Members
See Also CWindow::Attach
int DlgDirList( LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType );
See DlgDirList in the Win32 SDK.
Remarks
Fills a list box with the names of all files matching a specified path or filename.
CWindow Overview | Class Members
See Also CWindow::DlgDirListComboBox, CWindow::DlgDirSelect, CWindow::DlgDirSelectComboBox
int DlgDirListComboBox( LPTSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT nFileType );
See DlgDirListComboBox in the Win32 SDK.
Remarks
Fills a combo box with the names of all files matching a specified path or filename.
CWindow Overview | Class Members
See Also CWindow::DlgDirList, CWindow::DlgDirSelectt, CWindow::DlgDirSelectComboBox
BOOL DlgDirSelect( LPTSTR lpString, int nCount, int nIDListBox );
See DlgDirSelectEx in the Win32 SDK.
Remarks
Retrieves the current selection from a list box.
CWindow Overview | Class Members
See Also CWindow::DlgDirSelectComboBox, CWindow::DlgDirList
BOOL DlgDirSelectComboBox( LPTSTR lpString, int nCount, int nIDComboBox );
See DlgDirSelectComboBoxEx in the Win32 SDK.
Remarks
Retrieves the current selection from a combo box.
CWindow Overview | Class Members
See Also CWindow::DlgDirSelect, CWindow::DlgDirListComboBox
void DragAcceptFiles( BOOL bAccept = TRUE );
See DragAcceptFiles in the Win32 SDK.
Remarks
Registers whether the window accepts dragged files.
CWindow Overview | Class Members
BOOL DrawMenuBar( );
See DrawMenuBar in the Win32 SDK.
Remarks
Redraws the window's menu bar.
CWindow Overview | Class Members
See Also CWindow::GetMenu, CWindow::SetMenu
BOOL EnableScrollBar( UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH );
See EnableScrollBar in the Win32 SDK.
Remarks
Enables or disables the scroll bar arrows.
CWindow Overview | Class Members
See Also CWindow::ShowScrollBar
BOOL EnableWindow( BOOL bEnable = TRUE );
See EnableWindow in the Win32 SDK.
Remarks
Enables or disables input.
CWindow Overview | Class Members
See Also CWindow::IsWindowEnabled
void EndPaint( LPPAINTSTRUCT lpPaint );
See EndPaint in the Win32 SDK.
Remarks
Marks the end of painting.
CWindow Overview | Class Members
See Also CWindow::BeginPaint
BOOL FlashWindow( BOOL bInvert );
See FlashWindow in the Win32 SDK.
Remarks
Flashes the window once.
CWindow Overview | Class Members
See Also CWindow::SetTimer
BOOL GetClientRect( LPRECT lpRect ) const;
See GetClientRect in the Win32 SDK.
Remarks
Retrieves the coordinates of the client area.
CWindow Overview | Class Members
See Also CWindow::GetWindowRect
HDC GetDC( );
See GetDC in the Win32 SDK.
Remarks
Retrieves a device context for the client area.
CWindow Overview | Class Members
See Also CWindow::GetDCEx, CWindow::GetWindowDC, CWindow::ReleaseDC
HDC GetDCEx( HRGN hRgnClip, DWORD flags );
See GetDCEx in the Win32 SDK.
Remarks
Retrieves a device context for the client area and allows clipping options.
CWindow Overview | Class Members
See Also CWindow::GetDC, CWindow::GetWindowDC, CWindow::ReleaseDC
HWND GetDescendantWindow( int nID ) const;
Return Value
The handle to a descendant window.
Parameters
nID [in] The identifier of the descendant window to be retrieved.
Remarks
Finds the descendant window specified by the given identifier. GetDescendantWindow searches the entire tree of child windows, not only the windows that are immediate children.
CWindow Overview | Class Members
See Also CWindow::GetDlgItem
int GetDlgCtrlID( ) const;
See GetDlgCtrlID in the Win32 SDK.
Remarks
Retrieves the window's identifier (for child windows only).
CWindow Overview | Class Members
See Also CWindow::SetDlgCtrlID
HWND GetDlgItem( int nID ) const;
See GetDlgItem in the Win32 SDK.
Remarks
Retrieves the specified child window.
CWindow Overview | Class Members
See Also CWindow::GetDescendantWindow
UINT GetDlgItemInt( int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE ) const;
See GetDlgItemInt in the Win32 SDK.
Remarks
Translates a control's text to an integer.
CWindow Overview | Class Members
See Also CWindow::SetDlgItemInt, CWindow::GetDlgItemText
UINT GetDlgItemText( int nID, LPTSTR lpStr, int nMaxCount ) const;
BOOL GetDlgItemText( int nID, BSTR& bstrText ) const;
See GetDlgItemText in the Win32 SDK.
Remarks
Retrieves a control's text. The second version of this method allows you to copy the control's text to a BSTR. This version returns TRUE if the text is successfully copied; otherwise, FALSE.
CWindow Overview | Class Members
See Also CWindow::SetDlgItemText, CWindow::GetDlgItem
DWORD GetExStyle( ) const;
Return Value
The window's extended styles.
Remarks
Retrieves the extended window styles of the window.
To retrieve the regular window styles, call GetStyle.
CWindow Overview | Class Members
See Also CWindow::ModifyStyleEx
HFONT GetFont( ) const;
Return Value
A font handle.
Remarks
Retrieves the window's current font by sending a WM_GETFONT message to the window.
CWindow Overview | Class Members
See Also CWindow::SetFont
DWORD GetHotKey( WORD& wVirtualKeyCode, WORD& wModifiers ) const;
Return Value
The virtual key code and modifiers for the hot key associated with the window. For a list of possible modifiers, see WM_GETHOTKEY in the Win32 SDK.
Parameters
wVirtualKeyCode [in] Not used.
wModifiers [in] Not used.
Remarks
Determines the hot key associated with the window by sending a WM_GETHOTKEY message.
CWindow Overview | Class Members
See Also CWindow::SetHotKey
HICON GetIcon( BOOL bBigIcon = TRUE ) const;
Return Value
An icon handle.
Parameters
bBigIcon [in] If TRUE (the default value) the method returns the large icon. Otherwise, it returns the small icon.
Remarks
Retrieves the handle to the window's large or small icon. GetIcon sends a WM_GETICON message to the window.
CWindow Overview | Class Members
See Also CWindow::SetIcon
HWND GetLastActivePopup( ) const;
See GetLastActivePopup in the Win32 SDK.
Remarks
Retrieves the most recently active pop-up window.
CWindow Overview | Class Members
HMENU GetMenu( ) const;
See GetMenu in the Win32 SDK.
Remarks
Retrieves the window's menu.
CWindow Overview | Class Members
See Also CWindow::SetMenu
HWND GetNextDlgGroupItem( HWND hWndCtl, BOOL bPrevious = FALSE ) const;
See GetNextDlgGroupItem in the Win32 SDK.
Remarks
Retrieves the previous or next control within a group of controls.
CWindow Overview | Class Members
See Also CWindow::GetNextDlgTabItem
HWND GetNextDlgTabItem( HWND hWndCtl, BOOL bPrevious = FALSE ) const;
See GetNextDlgTabItem in the Win32 SDK.
Remarks
Retrieves the previous or next control having the WS_TABSTOP style.
CWindow Overview | Class Members
See Also CWindow::GetNextDlgGroupItem
HWND GetParent( ) const;
See GetParent in the Win32 SDK.
Remarks
Retrieves the immediate parent window.
CWindow Overview | Class Members
See Also CWindow::SetParent
int GetScrollPos( int nBar ) const;
See GetScrollPos in the Win32 SDK.
Remarks
Retrieves the position of the scroll box.
CWindow Overview | Class Members
See Also CWindow::SetScrollPos
BOOL GetScrollRange( int nBar, LPINT lpMinPos, LPINT lpMaxPos ) const;
See GetScrollRange in the Win32 SDK.
Remarks
Retrieves the scroll bar range.
CWindow Overview | Class Members
See Also CWindow::SetScrollRange
DWORD GetStyle( ) const;
Return Value
The window's styles.
Remarks
Retrieves the window styles of the window.
To retrieve the extended window styles, call GetExStyle.
CWindow Overview | Class Members
See Also CWindow::ModifyStyle
HMENU GetSystemMenu( BOOL bRevert ) const;
See GetSystemMenu in the Win32 SDK.
Remarks
Creates a copy of the system menu for modification.
CWindow Overview | Class Members
See Also CWindow::GetMenu
HWND GetTopLevelParent( ) const;
Return Value
The handle to the top-level parent window.
Remarks
Retrieves the window's top-level parent window.
CWindow Overview | Class Members
See Also CWindow::GetParent, CWindow::GetTopLevelWindow, CWindow::GetWindow
HWND GetTopLevelWindow( ) const;
Return Value
The handle to the top-level owner window.
Remarks
Retrieves the window's top-level parent or owner window.
CWindow Overview | Class Members
See Also CWindow::GetTopLevelParent, CWindow::GetWindow
HWND GetTopWindow( ) const;
See GetTopWindow in the Win32 SDK.
Remarks
Retrieves the top-level child window.
CWindow Overview | Class Members
See Also CWindow::GetWindow
BOOL GetUpdateRect( LPRECT lpRect, BOOL bErase = FALSE );
See GetUpdateRect in the Win32 SDK.
Remarks
Retrieves the coordinates of the smallest rectangle that completely encloses the update region.
CWindow Overview | Class Members
See Also CWindow::GetUpdateRgn
int GetUpdateRgn( HRGN hRgn, BOOL bErase = FALSE );
See GetUpdateRgn in the Win32 SDK.
Remarks
Retrieves the update region and copies it into a specified region.
CWindow Overview | Class Members
See Also CWindow::GetUpdateRect
HWND GetWindow( UINT nCmd ) const;
See GetWindow in the Win32 SDK.
Remarks
Retrieves the specified window.
CWindow Overview | Class Members
See Also CWindow::GetTopWindow, CWindow::GetTopLevelParent, CWindow::GetTopLevelWindow
DWORD GetWindowContextHelpId( ) const;
See GetWindowContextHelpId in the Win32 SDK.
Remarks
Retrieves the window's help context identifier.
CWindow Overview | Class Members
See Also CWindow::SetWindowContextHelpId
HDC GetWindowDC( );
See GetWindowDC in the Win32 SDK.
Remarks
Retrieves a device context for the entire window.
CWindow Overview | Class Members
See Also CWindow::GetDC, CWindow::GetDCEx, CWindow::ReleaseDC
LONG GetWindowLong( int nIndex ) const;
See GetWindowLong in the Win32 SDK.
Remarks
Retrieves a 32-bit value at a specified offset into the extra window memory.
CWindow Overview | Class Members
See Also CWindow::SetWindowLong, CWindow::GetWindowWord
BOOL GetWindowPlacement( WINDOWPLACEMENT FAR* lpwndpl ) const;
See GetWindowPlacement in the Win32 SDK.
Remarks
Retrieves the show state and positions.
CWindow Overview | Class Members
See Also CWindow::SetWindowPlacement
BOOL GetWindowRect( LPRECT lpRect ) const;
See GetWindowRect in the Win32 SDK.
Remarks
Retrieves the window's bounding dimensions.
CWindow Overview | Class Members
See Also CWindow::GetClientRect
int GetWindowText( LPTSTR lpszStringBuf, int nMaxCount ) const;
BOOL GetWindowText( BSTR& bstrText );
See GetWindowText in the Win32 SDK.
Remarks
Retrieves the window's text. The second version of this method allows you to store the text in a BSTR. If the text is successfully copied, the return value is TRUE; otherwise, the return value is FALSE.
CWindow Overview | Class Members
See Also CWindow::GetWindowTextLength, CWindow::SetWindowText
int GetWindowTextLength( ) const;
See GetWindowTextLength in the Win32 SDK.
Remarks
Retrieves the length of the window's text.
CWindow Overview | Class Members
See Also CWindow::GetWindowText
WORD GetWindowWord( int nIndex ) const;
See GetWindowWord in the Win32 SDK.
Remarks
Retrieves a 16-bit value at a specified offset into the extra window memory.
CWindow Overview | Class Members
See Also CWindow::SetWindowWord, CWindow::GetWindowLong
BOOL HideCaret( );
See HideCaret in the Win32 SDK.
Remarks
Hides the system caret.
CWindow Overview | Class Members
See Also CWindow::ShowCaret
BOOL HiliteMenuItem( HMENU hMenu, UINT uHiliteItem, UINT uHilite );
See HiliteMenuItem in the Win32 SDK.
Remarks
Highlights or removes the highlight from a top-level menu item.
CWindow Overview | Class Members
BOOL Invalidate( BOOL bErase = TRUE );
See InvalidateRect in the Win32 SDK.
Remarks
Invalidates the entire client area. Passes NULL for the RECT parameter to the InvalidateRect Win32 function.
CWindow Overview | Class Members
See Also CWindow::InvalidateRect, CWindow::InvalidateRgn, CWindow::ValidateRect, CWindow::ValidateRgn
BOOL InvalidateRect( LPCRECT lpRect, BOOL bErase = TRUE );
See InvalidateRect in the Win32 SDK.
Remarks
Invalidates the client area within the specified rectangle.
CWindow Overview | Class Members
See Also CWindow::Invalidate, CWindow::InvalidateRgn, CWindow::ValidateRect
void InvalidateRgn( HRGN hRgn, BOOL bErase = TRUE );
See InvalidateRgn in the Win32 SDK.
Remarks
Invalidates the client area within the specified region. Specifies a void return type, while the InvalidateRgn Win32 function always returns TRUE.
CWindow Overview | Class Members
See Also CWindow::Invalidate, CWindow::InvalidateRect, CWindow::ValidateRgn
BOOL IsChild( const HWND hWnd ) const;
See IsChild in the Win32 SDK.
Remarks
Determines whether the specified window is a child window.
CWindow Overview | Class Members
UINT IsDlgButtonChecked( int nIDButton ) const;
See IsDlgButtonChecked in the Win32 SDK.
Remarks
Determines the check state of the button.
CWindow Overview | Class Members
See Also CWindow::CheckDlgButton
BOOL IsIconic( ) const;
See IsIconic in the Win32 SDK.
Remarks
Determines whether the window is minimized.
CWindow Overview | Class Members
See Also CWindow::IsZoomed
BOOL IsWindowEnabled( ) const;
See IsWindowEnabled in the Win32 SDK.
Remarks
Determines whether the window is enabled for input.
CWindow Overview | Class Members
See Also CWindow::EnableWindow, CWindow::IsWindowVisible
BOOL IsWindowVisible( ) const;
See IsWindowVisible in the Win32 SDK.
Remarks
Determines the window's visibility state.
CWindow Overview | Class Members
BOOL IsZoomed( ) const;
See IsZoomed in the Win32 SDK.
Remarks
Determines whether the window is maximized.
CWindow Overview | Class Members
See Also CWindow::IsIconic
BOOL KillTimer( UINT nIDEvent );
See KillTimer in the Win32 SDK.
Remarks
Destroys a timer event.
CWindow Overview | Class Members
See Also CWindow::SetTimer
BOOL LockWindowUpdate( BOOL bLock = TRUE );
Return Value
TRUE if the window is successfully locked; otherwise, FALSE.
Parameters
bLock [in] If TRUE (the default value), the window will be locked. Otherwise, it will be unlocked.
Remarks
Disables or enables drawing in the window by calling the LockWindowUpdate Win32 function. If bLock is TRUE, this method passes m_hWnd to the Win32 function; otherwise, it passes NULL.
CWindow Overview | Class Members
int MapWindowPoints( HWND hWndTo, LPPOINT lpPoint, UINT nCount ) const;
int MapWindowPoints( HWND hWndTo, LPRECT lpRect ) const;
See MapWindowPoints in the Win32 SDK.
Remarks
Converts a set of points from the window's coordinate space to the coordinate space of another window. The second version of this method allows you to convert the coordinates of a RECT structure.
CWindow Overview | Class Members
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
See MessageBox in the Win32 SDK.
Remarks
Displays a message box.
CWindow Overview | Class Members
BOOL ModifyStyle( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );
Return Value
TRUE if the window styles are modified; otherwise, FALSE.
Parameters
dwRemove [in] Specifies the window styles to be removed during style modification.
dwAdd [in] Specifies the window styles to be added during style modification.
nFlags [in] Window-positioning flags. For a list of possible values, see the SetWindowPos function in the Win32 SDK.
Remarks
Modifies the window styles of the CWindow object. Styles to be added or removed can be combined by using the bitwise OR ( | ) operator. See the CreateWindow function in the Win32 SDK for information about the available window styles.
If nFlags is nonzero, ModifyStyle calls the Win32 function SetWindowPos, and redraws the window by combining nFlags with the following four flags:
To modify a window's extended styles, call ModifyStyleEx.
CWindow Overview | Class Members
See Also CWindow::GetStyle
BOOL ModifyStyleEx( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );
Return Value
TRUE if the extended window styles are modified; otherwise, FALSE.
Parameters
dwRemove [in] Specifies the extended styles to be removed during style modification.
dwAdd [in] Specifies the extended styles to be added during style modification.
nFlags [in] Window-positioning flags. For a list of possible values, see the SetWindowPos function in the Win32 SDK.
Remarks
Modifies the extended window styles of the CWindow object. Styles to be added or removed can be combined by using the bitwise OR ( | ) operator. See the CreateWindowEx function in the Win32 SDK for information about the available extended styles.
If nFlags is nonzero, ModifyStyleEx calls the Win32 function SetWindowPos, and redraws the window by combining nFlags with the following four flags:
To modify windows using regular window styles, call ModifyStyle.
CWindow Overview | Class Members
See Also CWindow::GetExStyle
BOOL MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );
BOOL MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
See MoveWindow in the Win32 SDK.
Remarks
Changes the window's size and position. The second version of this method uses a RECT structure to determine the window's new position, width, and height.
CWindow Overview | Class Members
See Also CWindow::SetWindowPos
BOOL OpenClipboard( );
See OpenClipboard in the Win32 SDK.
Remarks
Opens the Clipboard.
CWindow Overview | Class Members
BOOL PostMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
See PostMessage in the Win32 SDK.
Remarks
Places a message in the message queue associated with the thread that created the window. Returns without waiting for the thread to process the message.
CWindow Overview | Class Members
See Also CWindow::SendMessage, CWindow::SendNotifyMessage
void Print( HDC hDC, DWORD dwFlags ) const;
Parameters
hDC [in] The handle to a device context.
dwFlags [in] Specifies the drawing options. You can combine one or more of the following flags:
Remarks
Sends a WM_PRINT message to the window to request that it draw itself in the specified device context.
CWindow Overview | Class Members
See Also CWindow::PrintClient
void PrintClient( HDC hDC, DWORD dwFlags ) const;
Parameters
hDC [in] The handle to a device context.
dwFlags [in] Specifies drawing options. You can combine one or more of the following flags:
Remarks
Sends a WM_PRINTCLIENT message to the window to request that it draw its client area in the specified device context.
CWindow Overview | Class Members
See Also CWindow::Print
BOOL RedrawWindow( LPCRECT lpRectUpdate = NULL, HRGN hRgnUpdate = NULL, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
See RedrawWindow in the Win32 SDK.
Remarks
Updates a specified rectangle or region in the client area.
CWindow Overview | Class Members
See Also CWindow::UpdateWindow
int ReleaseDC( HDC hDC );
See ReleaseDC in the Win32 SDK.
Remarks
Releases a device context.
CWindow Overview | Class Members
See Also CWindow::GetDC, CWindow::GetDCEx, CWindow::GetWindowDC
BOOL ScreenToClient( LPPOINT lpPoint ) const;
BOOL ScreenToClient( LPRECT lpRect ) const;
See ScreenToClient in the Win32 SDK.
Remarks
Converts screen coordinates to client coordinates. The second version of this method allows you to convert the coordinates of a RECT structure.
CWindow Overview | Class Members
See Also CWindow::ClientToScreen
BOOL ScrollWindow( int xAmount, int yAmount, LPCRECT lpRect = NULL, LPCRECT lpClipRect = NULL );
See ScrollWindow in the Win32 SDK.
Remarks
Scrolls the specified client area.
CWindow Overview | Class Members
See Also CWindow::ScrollWindowEx
int ScrollWindowEx( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT flags );
See ScrollWindowEx in the Win32 SDK.
Remarks
Scrolls the specified client area with additional features.
CWindow Overview | Class Members
See Also CWindow::ScrollWindow
LRESULT SendDlgItemMessage( int nID, UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
See SendDlgItemMessage in the Win32 SDK.
Remarks
Sends a message to a control.
CWindow Overview | Class Members
See Also CWindow::SendMessage
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
See SendMessage in the Win32 SDK.
Remarks
Sends a message to the window and does not return until the window procedure has processed the message.
CWindow Overview | Class Members
See Also CWindow::PostMessage, CWindow::SendNotifyMessage, CWindow::SendMessageToDescendants
void SendMessageToDescendants( UINT message, WPARAM wParam = 0, LPARAM lParam = 0, BOOL bDeep = TRUE );
Parameters
message [in] The message to be sent.
wParam [in] Additional message-specific information.
lParam [in] Additional message-specific information.
bDeep [in] If TRUE (the default value), the message will be sent to all descendant windows; otherwise, it will be sent only to the immediate child windows.
Remarks
Sends the specified message to all immediate children of the CWindow object. If bDeep is TRUE, the message is additionally sent to all other descendant windows.
CWindow Overview | Class Members
See Also CWindow::SendMessage, CWindow::SendNotifyMessage, CWindow::PostMessage
BOOL SendNotifyMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
See SendNotifyMessage in the Win32 SDK.
Remarks
Sends a message to the window. If the window was created by the calling thread, SendNotifyMessage does not return until the window procedure has processed the message. Otherwise, it returns immediately.
CWindow Overview | Class Members
See Also CWindow::SendMessage, CWindow::SendMessageToDescendants, CWindow::PostMessage
HWND SetActiveWindow( );
See SetActiveWindow in the Win32 SDK.
Remarks
Activates the window.
CWindow Overview | Class Members
HWND SetCapture( );
See SetCapture in the Win32 SDK.
Remarks
Sends all subsequent mouse input to the window.
CWindow Overview | Class Members
HWND SetClipboardViewer( );
See SetClipboardViewer in the Win32 SDK.
Remarks
Adds the window to the Clipboard viewer chain.
CWindow Overview | Class Members
See Also CWindow::ChangeClipboardChain
int SetDlgCtrlID( int nID );
Return Value
If successful, the previous identifier of the window; otherwise 0.
Parameters
nID [in] The new value to set for the window's identifier.
Remarks
Sets the identifier of the window to the specified value.
CWindow Overview | Class Members
See Also CWindow::GetDlgCtrlID
BOOL SetDlgItemInt( int nID, UINT nValue, BOOL bSigned = TRUE );
See SetDlgItemInt in the Win32 SDK.
Remarks
Changes a control's text to the string representation of an integer value.
CWindow Overview | Class Members
See Also CWindow::GetDlgItemInt, CWindow::SetDlgItemText
BOOL SetDlgItemText( int nID, LPCTSTR lpszString );
See SetDlgItemText in the Win32 SDK.
Remarks
Changes a control's text.
CWindow Overview | Class Members
See Also CWindow::GetDlgItemText, CWindow::SetDlgItemInt
HWND SetFocus( );
See SetFocus in the Win32 SDK.
Remarks
Sets the input focus to the window.
CWindow Overview | Class Members
void SetFont( HFONT hFont, BOOL bRedraw = TRUE );
Parameters
hFont [in] The handle to the new font.
bRedraw [in] If TRUE (the default value), the window is redrawn. Otherwise, it is not.
Remarks
Changes the window's current font by sending a WM_SETFONT message to the window.
CWindow Overview | Class Members
See Also CWindow::GetFont
int SetHotKey( WORD wVirtualKeyCode, WORD wModifiers );
Return Value
For a list of possible return values, see WM_SETHOTKEY in the Win32 SDK.
Parameters
wVirtualKeyCode [in] The virtual key code of the hot key.
wModifiers [in] The modifiers of the hot key. For a list of possible values, see WM_SETHOTKEY in the Win32 SDK.
Remarks
Associates a hot key with the window by sending a WM_SETHOTKEY message.
CWindow Overview | Class Members
See Also CWindow::GetHotKey
HICON SetIcon( HICON hIcon, BOOL bBigIcon = TRUE );
Return Value
The handle to the previous icon.
Parameters
hIcon [in] The handle to a new icon.
bBigIcon [in] If TRUE (the default value), the method sets a large icon. Otherwise, it sets a small icon.
Remarks
Sets the window's large or small icon to the icon identified by hIcon. SetIcon sends a WM_SETICON message to the window.
CWindow Overview | Class Members
See Also CWindow::GetIcon
BOOL SetMenu( HMENU hMenu );
See SetMenu in the Win32 SDK.
Remarks
Changes the window's current menu.
CWindow Overview | Class Members
See Also CWindow::GetMenu
HWND SetParent( HWND hWndNewParent );
See SetParent in the Win32 SDK.
Remarks
Changes the parent window.
CWindow Overview | Class Members
See Also CWindow::GetParent
void SetRedraw( BOOL bRedraw = TRUE );
Parameters
bRedraw [in] Specifies the state of the redraw flag. If TRUE (the default value), the redraw flag is set; if FALSE, the flag is cleared.
Remarks
Sets or clears the redraw flag by sending a WM_SETREDRAW message to the window. Call SetRedraw to allow changes to be redrawn or to prevent changes from being redrawn.
CWindow Overview | Class Members
int SetScrollPos( int nBar, int nPos, BOOL bRedraw = TRUE );
See SetScrollPos in the Win32 SDK.
Remarks
Changes the position of the scroll box.
CWindow Overview | Class Members
See Also CWindow::GetScrollPos
BOOL SetScrollRange( int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );
See SetScrollRange in the Win32 SDK.
Remarks
Changes the scroll bar range.
CWindow Overview | Class Members
See Also CWindow::GetScrollRange
UINT SetTimer( UINT nIDEvent, UINT nElapse, void ( CALLBACK EXPORT* lpfnTimer )( HWND, UINT, UINT, DWORD ) );
See SetTimer in the Win32 SDK.
Remarks
Creates a timer event.
CWindow Overview | Class Members
See Also CWindow::KillTimer
BOOL SetWindowContextHelpId( DWORD dwContextHelpId );
See SetWindowContextHelpId in the Win32 SDK.
Remarks
Sets the window's help context identifier.
CWindow Overview | Class Members
See Also CWindow::GetWindowContextHelpId
LONG SetWindowLong( int nIndex, LONG dwNewLong );
See SetWindowLong in the Win32 SDK.
Remarks
Sets a 32-bit value at a specified offset into the extra window memory.
CWindow Overview | Class Members
See Also CWindow::GetWindowLong, CWindow::SetWindowWord
BOOL SetWindowPlacement( const WINDOWPLACEMENT FAR*lpwndpl );
See SetWindowPlacement in the Win32 SDK.
Remarks
Sets the show state and positions.
CWindow Overview | Class Members
See Also CWindow::GetWindowPlacement
BOOL SetWindowPos( HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
BOOL SetWindowPos( HWND hWndInsertAfter, LPCRECT lpRect, UINT nFlags );
See SetWindowPos in the Win32 SDK.
Remarks
Sets the size, position, and Z order. The second version of this method uses a RECT structure to set the window's new position, width, and height.
CWindow Overview | Class Members
See Also CWindow::BringWindowToTop, CWindow::MoveWindow
BOOL SetWindowText( LPCTSTR lpszString );
See SetWindowText in the Win32 SDK.
Remarks
Changes the window's text.
CWindow Overview | Class Members
See Also CWindow::GetWindowText
WORD SetWindowLong( int nIndex, WORD wNewWord );
See SetWindowWord in the Win32 SDK.
Remarks
Sets a 16-bit value at a specified offset into the extra window memory.
CWindow Overview | Class Members
See Also CWindow::GetWindowWord, CWindow::SetWindowLong
BOOL ShowCaret( );
See ShowCaret in the Win32 SDK.
Remarks
Displays the system caret.
CWindow Overview | Class Members
See Also CWindow::HideCaret
BOOL ShowOwnedPopups( BOOL bShow = TRUE );
See ShowOwnedPopups in the Win32 SDK.
Remarks
Shows or hides the pop-up windows owned by the window.
CWindow Overview | Class Members
BOOL ShowScrollBar( UINT nBar, BOOL bShow = TRUE );
See ShowScrollBar in the Win32 SDK.
Remarks
Shows or hides a scroll bar.
CWindow Overview | Class Members
BOOL ShowWindow( int nCmdShow );
See ShowWindow in the Win32 SDK.
Remarks
Sets the window's show state.
CWindow Overview | Class Members
BOOL UpdateWindow( );
See UpdateWindow in the Win32 SDK.
Remarks
Updates the client area.
CWindow Overview | Class Members
See Also CWindow::RedrawWindow
BOOL ValidateRect( LPCRECT lpRect );
See ValidateRect in the Win32 SDK.
Remarks
Validates the client area within the specified rectangle.
CWindow Overview | Class Members
See Also CWindow::ValidateRgn, CWindow::InvalidateRect
BOOL ValidateRgn( HRGN hRgn );
See ValidateRgn in the Win32 SDK.
Remarks
Validates the client area within the specified region.
CWindow Overview | Class Members
See Also CWindow::ValidateRect, CWindow::InvalidateRgn
BOOL WinHelp( LPCTSTR lpszHelp, UINT nCmd = HELP_CONTEXT, DWORD dwData = 0 );
See WinHelp in the Win32 SDK.
Remarks
Starts Windows Help.
CWindow Overview | Class Members
operator HWND( ) const;
Remarks
Converts a CWindow object to an HWND.
CWindow Overview | Class Members
CWindow& operator =( HWND hWnd );
Remarks
Assigns an HWND to the CWindow object by setting the m_hWnd member to hWnd.
CWindow Overview | Class Members
HWND m_hWnd;
Remarks
Contains a handle to the window associated with the CWindow object.
CWindow Overview | Class Members
See Also CWindow::CWindow