CWnd Methods

Construction and Destruction Methods

Method Description
CWnd Constructs a CWnd object.
DestroyWindow Destroys the attached Windows CE window.

Initialization Methods

Method Description
Create Creates and initializes the child window associated with the CWnd object.
PreCreateWindow Called before the creation of the Windows CE window attached to this CWnd object.
CalcWindowRect Called to calculate the window rectangle from the client rectangle.
GetStyle Returns the current window style.
GetExStyle Returns the window’s extended style.
Attach Attaches a Windows CE handle to a CWnd object.
Detach Detaches a Windows CE handle from a CWnd object and returns the handle.
PreSubclassWindow Allows other necessary subclassing to occur before SubclassWindow is called.
SubclassWindow Attaches a window to a CWnd object and makes it route messages through the CWnd’s message map.
UnsubclassWindow Detaches a window from a CWnd object
FromHandle Returns a pointer to a CWnd object when specified a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached.
FromHandlePermanent Returns a pointer to a CWnd object when specified a handle to a window. If a CWnd object is not attached to the handle, NULL is returned.
DeleteTempMap Called automatically by the CWinApp idle-time handler and deletes any temporary CWnd objects created by FromHandle.
GetSafeHwnd Returns NULL if the this pointer is NULL.
CreateEx Creates a Windows CE overlapped, pop-up, or child window and attaches it to a CWnd object.
CreateControl Creates an ActiveX control that will be represented in an MFC program by a CWnd object.

Window State Methods

Method Description
IsWindowEnabled Determines whether the window is enabled for mouse and keyboard input.
EnableWindow Enables or disables mouse and keyboard input.
GetActiveWindow Retrieves the active window.
SetActiveWindow Activates the window.
GetCapture Retrieves the CWnd that has the mouse capture.
SetCapture Causes all subsequent mouse input to be sent to the CWnd.
GetFocus Retrieves the CWnd that currently has the input focus.
SetFocus Claims the input focus.
GetDesktopWindow Retrieves the desktop window.
GetForegroundWindow Returns a pointer to the foreground window (the top-level window with which the user is currently working).
SetForegroundWindow Puts the thread that created the window into the foreground and activates the window.
GetIcon Retrieves the handle to an icon.
SetIcon Sets the handle to a specific icon.
ModifyStyle Modifies the current window style.
ModifyStyleEx Modifies the window’s extended style.

Window Size and Position Methods

Method Description
IsIconic Determines whether CWnd is minimized (iconic).
MoveWindow Changes the position and/or dimensions of CWnd.
SetWindowPos Changes the size, position, and ordering of child, pop-up, and top-level windows.
BringWindowToTop Brings CWnd to the top of a stack of overlapping windows.
GetWindowRect Gets the screen coordinates of CWnd.
GetClientRect Gets the dimensions of the CWnd client area.

Window Access Methods

Method Description
ChildWindowFromPoint Determines which, if any, of the child windows contains the specified point.
FindWindow Returns the handle to the window, which is identified by its window name and window class.
GetNextWindow Returns the next (or previous) window in the window manager’s list.
GetOwner Retrieves a pointer to the owner of a CWnd.
SetOwner Changes the owner of a CWnd.
GetTopWindow Returns the first child window that belongs to the CWnd.
GetWindow Returns the window with the specified relationship to this window.
IsChild Indicates whether CWnd is a child window or other direct descendant of the specified window.
GetParent Retrieves the parent window of CWnd (if any).
GetSafeOwner Retrieves the safe owner for the specified window.
SetParent Changes the parent window.
WindowFromPoint Identifies the window that contains the specified point.
GetDlgItem Retrieves the control with the specified identifier from the specified dialog box.
GetDlgCtrlID If the CWnd is a child window, calling this method returns its identifier value.
SetDlgCtrlID Sets the window or control identifier for the window (which can be any child window, not only a control in a dialog box).
GetDescendantWindow Searches all descendant windows and returns the window with the specified identifier.
GetParentFrame Retrieves the CWnd object’s parent frame window.
SendMessageToDescendants Sends a message to all descendant windows of the window.
GetTopLevelParent Retrieves the window’s top-level parent.
GetTopLevelOwner Retrieves the top-level window.
GetParentOwner Returns a pointer to a child window’s parent window.
GetTopLevelFrame Retrieves the window’s top-level frame window.
UpdateDialogControls Call to update the state of dialog box buttons and other controls.
UpdateData Initializes or retrieves data from a dialog box.
CenterWindow Centers a window relative to its parent.

Update and Painting Methods

Method Description
BeginPaint Prepares CWnd for painting.
EndPaint Marks the end of painting.
GetDC Retrieves a display context for the client area.
RedrawWindow Updates the specified rectangle or region in the client area.
GetWindowDC Retrieves the display context for the whole window, including the caption bar, menus, and scroll bars.
ReleaseDC Releases client and window device contexts, freeing them for use by other applications.
Print Draws the current window in the specified device context.
PrintClient Draws any window in the specified device context (usually a printer device context).
UpdateWindow Updates the client area.
SetRedraw Allows changes in CWnd to be redrawn or prevents changes from being redrawn.
GetUpdateRect Retrieves the coordinates of the smallest rectangle that completely encloses the CWnd update region.
GetUpdateRgn Retrieves the CWnd update region.
Invalidate Invalidates the entire client area.
InvalidateRect Invalidates the client area within the specified rectangle by adding that rectangle to the current update region.
ValidateRect Validates the client area within the specified rectangle by removing the rectangle from the current update region.
ShowWindow Shows or hides the window.
IsWindowVisible Determines whether the window is visible.

Coordinate Mapping Methods

Method Description
MapWindowPoints Converts (maps) a set of points from the coordinate space of the CWnd to the coordinate space of another window.
ClientToScreen Converts the client coordinates of a specified point or rectangle on the display to screen coordinates.
ScreenToClient Converts the screen coordinates of a specified point or rectangle on the display to client coordinates.

Window Text Methods

Method Description
SetWindowText Sets the window text or caption title (if it has one) to the specified text.
GetWindowText Returns the window text or caption title (if it has one).
GetWindowTextLength Returns the length of the window’s text or caption title.
SetFont Sets the current font.
GetFont Retrieves the current font.

Scrolling Methods

Method Description
GetScrollPos Retrieves the current position of a scroll box.
GetScrollRange Copies the current minimum and maximum scroll-bar positions for the specified scroll bar.
ScrollWindow Scrolls the contents of the client area.
ScrollWindowEx Scrolls the contents of the client area. Similar to ScrollWindow, with additional features.
GetScrollInfo Retrieves the information that the SCROLLINFO structure maintains about a scroll bar.
GetScrollLimit Retrieves the limit of the scroll bar.
SetScrollInfo Sets information about the scroll bar.
SetScrollPos Sets the current position of a scroll box and, if specified, redraws the scroll bar to reflect the new position.
SetScrollRange Sets minimum and maximum position values for the specified scroll bar.
GetScrollBarCtrl Returns a sibling scroll-bar control.
RepositionBars Repositions control bars in the client area.

Caret Methods

Method Description
CreateSolidCaret Creates a solid block for the system caret and gets ownership of the caret.
GetCaretPos Retrieves the client coordinates of the caret’s current position.
SetCaretPos Moves the caret to a specified position.
HideCaret Hides the caret by removing it from the display screen.
ShowCaret Shows the caret on the display at the caret’s current position. Once shown, the caret begins flashing automatically.

Dialog-Box Item Methods

Method Description
CheckDlgButton Places a check mark next to or removes a check mark from a button control.
CheckRadioButton Checks the specified radio button and removes the check mark from all other radio buttons in the specified group of buttons.
GetCheckedRadioButton Returns the identifier of the currently checked radio button in a group of buttons.
GetDlgItemInt Translates the text of a control in the specified dialog box to an integer value.
GetDlgItemText Retrieves the caption or text associated with a control.
GetNextDlgGroupItem Searches for the next (or previous) control within a group of controls.
GetNextDlgTabItem Retrieves the first control with the WS_TABSTOP style that follows (or precedes) the specified control.
IsDlgButtonChecked Determines whether a button control is checked.
IsDialogMessage Determines whether the specified message is intended for the modeless dialog box and, if so, processes it.
SendDlgItemMessage Sends a message to the specified control.
SetDlgItemInt Sets the text of a control to the string that represents an integer value.
SetDlgItemText Sets the caption or text of a control in the specified dialog box.
SubclassDlgItem Attaches a Windows CE control to a CWnd object and makes it route messages through the CWnd’s message map.
ExecuteDlgInit Initiates a dialog box resource.
RunModalLoop Retrieves, translates, or dispatches messages for a window that is in modal status.
ContinueModal Continues a window’s modal status.
EndModalLoop Ends a window’s modal status.

Data-Binding Methods

Method Description
BindDefaultProperty Binds the calling object's default simple bound property, as marked in the type library, to a cursor associated with a data-source control.
BindProperty Binds a cursour-bound property on a data-bound control to a data-source control and registers that relationship with the MFC binding manager.

Menu Methods

Method Description
GetMenu Retrieves a pointer to the specified menu.

Timer Methods

Method Description
SetTimer Installs a system timer that sends a WM_TIMER message when triggered.
KillTimer Kills a system timer.

Alert Methods

Method Description
MessageBox Creates and displays a window that contains an application-supplied message and caption.

Window Message Methods

Method Description
GetCurrentMessage Returns a pointer to the message this window is currently processing. Should only be called when in an OnMessage message-handler method.
Default Calls the default window procedure, which provides default processing for any window messages that an application does not process.
PreTranslateMessage Used by CWinApp to filter window messages before they are dispatched to the Windows CE TranslateMessage and DispatchMessage functions.
SendMessage Sends a message to the CWnd object and does not return until it has processed the message.
PostMessage Places a message in the application queue, then returns without waiting for the window to process the message.
SendNotifyMessage Sends the specified message to the window and returns as soon as possible, depending on whether the calling thread created the window.

Menu Loop Notification Methods

Method Description
OnEnterMenuLoop Called when a menu modal loop has been entered.
OnExitMenuLoop Called when a menu modal loop has been exited.

Clipboard Methods

Method Description
OpenClipboard Opens the clipboard. Other applications will not be able to modify the clipboard until the Windows CE CloseClipboard function is called.
GetClipboardOwner Retrieves a pointer to the current owner of the clipboard.
GetOpenClipboardWindow Retrieves a pointer to the window that currently has the clipboard open.

ActiveX Controls Methods

Method Description
SetProperty Sets an ActiveX control property.
OnAmbientProperty Implement ambient property values
GetControlUnknown Retrieves a pointer to an unknown ActiveX control.
GetProperty Retrieves an ActiveX control property
InvokeHelper Invokes an ActiveX control method or property.

Overridable Methods

Method Description
GetSuperWndProcAddr Accesses the default WndProc of a subclassed window.
WindowProc Provides a window procedure for a CWnd. The default dispatches messages through the message map.
DefWindowProc Calls the default window procedure, which provides default processing for any window messages that an application does not process.
PostNcDestroy This virtual method is called by the default OnNcDestroy method after the window has been destroyed.
OnChildNotify Called by a parent window to give a notifying control a chance to respond to a control notification.
DoDataExchange For dialog data exchange and validation. Called by UpdateData.

Initialization Message Handlers

Method Description
OnInitMenuPopup Called when a pop-up menu is about to become active.

System Message Handlers

Method Description
OnSysChar Called when a keystroke translates to a system character.
OnSysCommand Called when the user selects a command from the Control menu, or when the user selects the Maximize or Minimize button.
OnSysDeadChar Called when a keystroke translates to a system dead character (such as accent characters).
OnSysKeyDown Called when the user holds down the ALT key and then presses another key.
OnSysKeyUp Called when the user releases a key that was pressed while the ALT key was held down.
OnFontChange Called when the pool of font resources changes.
OnPaletteChanged Called to allow windows that use a color palette to realize their logical palettes and update their client areas.
OnWindowPosChanged Called when the size, position, or z-order has changed as a result of a call to SetWindowPos or another window-management function.
OnWinIniChange Called for all top-level windows after the Windows CE initialization file is changed.

General Message Handlers

Method Description
OnCommand Called when the user selects a command.
OnActivate Called when CWnd is being activated or deactivated.
OnCancelMode Called to allow CWnd to cancel any internal modes, such as mouse capture.
OnClose Called as a signal that CWnd should be closed.
OnCopyData Copies data from one application to another.
OnCreate Called as a part of window creation.
OnCtlColor Called if CWnd is the parent of a control when the control is about to be drawn.
OnDestroy Called when CWnd is being destroyed.
OnEnable Called when CWnd is enabled or disabled.
OnEraseBkgnd Called when the window background needs erasing.
OnKillFocus Called immediately before CWnd loses the input focus.
OnMenuChar Called when the user presses a menu mnemonic character that does not match any of the predefined mnemonics in the current menu.
OnMove Called after the position of the CWnd has been changed.
OnStyleChanged Indicates that the Windows CE SetWindowLong function has changed one or more of the window's styles.
OnPaint Called to repaint a portion of the window.
OnSetFocus Called after CWnd gains the input focus.
OnShowWindow Called when CWnd is to be hidden or shown.
OnSize Called after the size of CWnd has changed.
OnStyleChanged Indicates that one or more of the window's styles has changed.

Control Message Handlers

Method Description
OnCharToItem Called by a child list box with the LBS_WANTKEYBOARDINPUT style in response to a WM_CHAR message.
OnCompareItem Called to determine the relative position of a new item in a child sorted owner-draw combo box or list box.
OnDeleteItem Called when an owner-draw child list box or combo box is destroyed or when items are removed from the control.
OnDrawItem Called when a visual aspect of an owner-draw child button control, combo-box control, list-box control, or menu needs to be drawn.
OnGetDlgCode Called for a control so the control can process arrow-key and TAB-key input itself.
OnMeasureItem Called for an owner-draw child combo box, list box, or menu item when the control is created. CWnd informs Windows CE of the dimensions of the control.
SendChildNotifyLastMsg Provides a notification message to a child window, from the parent window, so the child window can handle a task.
ReflectChildNotify Helper method which reflects a message to its source.
OnWndMsg Indicates if a windows message was handled.
ReflectLastMsg Reflects the last message to the child window.
OnVKeyToItem Called by a list box owned by CWnd in response to a WM_KEYDOWN message.

Input Message Handlers

Method Description
OnChar Called when a keystroke translates to a nonsystem character.
OnDeadChar Called when a keystroke translates to a nonsystem dead character (such as accent characters).
OnHScroll Called when the user clicks the horizontal scroll bar of CWnd.
OnKeyDown Called when a nonsystem key is pressed.
OnKeyUp Called when a nonsystem key is released.
OnLButtonDblClk Called when the user double-clicks the left mouse button.
OnLButtonDown Called when the user presses the left mouse button.
OnLButtonUp Called when the user releases the left mouse button.
OnMouseMove Called when the mouse cursor moves.
OnTimer Called after each interval specified in SetTimer.
OnVScroll Called when the user clicks the window’s vertical scroll bar.
OnCaptureChanged Sends a message to the window that is losing the mouse capture.

Nonclient-Area Message Handlers

Method Description
OnNcDestroy Called when the nonclient area is being destroyed.

Clipboard Message Handlers

Method Description
OnDestroyClipboard Called when the clipboard is emptied through a call to the Windows CE EmptyClipboard function.
OnRenderAllFormats Called when the owner application is being destroyed and needs to render all its formats.
OnRenderFormat Called for the clipboard owner when a particular format with delayed rendering needs to be rendered.