Partager via


CWnd Class

Provides the base functionality of all window classes in the Microsoft Foundation Class Library.

class CWnd : public CCmdTarget

Members

Public Constructors

Name

Description

CWnd::CWnd

Constructs a CWnd object.

Public Methods

Name

Description

CWnd::accDoDefaultAction

Called by the framework to perform the object's default action.

CWnd::accHitTest

Called by the framework to retrieve the child element or child object at a given point on the screen.

CWnd::accLocation

Called by the framework to retrieve the specified object's current screen location.

CWnd::accNavigate

Called by the framework to traverse to another user interface element within a container and if possible, retrieve the object.

CWnd::accSelect

Called by the framework to modify the selection or move the keyboard focus of the specified object.

CWnd::AnimateWindow

Animates the associated window object.

CWnd::ArrangeIconicWindows

Arranges all the minimized (iconic) child windows.

CWnd::Attach

Attaches a Windows handle to a CWnd object.

CWnd::BeginModalState

Call this member function to make a frame window modal.

CWnd::BeginPaint

Prepares CWnd for painting.

CWnd::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.

CWnd::BindProperty

Binds a cursor-bound property on a data-bound control to a data-source control and registers that relationship with the MFC binding manager.

CWnd::BringWindowToTop

Brings CWnd to the top of a stack of overlapping windows.

CWnd::CalcWindowRect

Called to calculate the window rectangle from the client rectangle.

CWnd::CancelToolTips

Disables the tooltip control.

CWnd::CenterWindow

Centers a window relative to its parent.

CWnd::ChangeClipboardChain

Removes CWnd from the chain of Clipboard viewers.

CWnd::CheckDlgButton

Places a check mark next to or removes a check mark from a button control.

CWnd::CheckRadioButton

Checks the specified radio button and removes the check mark from all other radio buttons in the specified group of buttons.

CWnd::ChildWindowFromPoint

Determines which, if any, of the child windows contains the specified point.

CWnd::ClientToScreen

Converts the client coordinates of a given point or rectangle on the display to screen coordinates.

CWnd::CloseWindow

Minimizes the window.

CWnd::ContinueModal

Continues a window's modal status.

CWnd::Create

Creates and initializes the child window associated with the CWnd object.

CWnd::CreateAccessibleProxy

Creates an Active Accessibility proxy for the specified object.

CWnd::CreateCaret

Creates a new shape for the system caret and gets ownership of the caret.

CWnd::CreateControl

Create an ActiveX control that will be represented in an MFC program by a CWnd object.

CWnd::CreateEx

Creates a Windows overlapped, pop-up, or child window and attaches it to a CWnd object.

CWnd::CreateGrayCaret

Creates a gray block for the system caret and gets ownership of the caret.

CWnd::CreateSolidCaret

Creates a solid block for the system caret and gets ownership of the caret.

CWnd::DeleteTempMap

Called automatically by the CWinApp idle-time handler and deletes any temporary CWnd objects created by FromHandle.

CWnd::DestroyWindow

Destroys the attached Windows window.

CWnd::Detach

Detaches a Windows handle from a CWnd object and returns the handle.

CWnd::DlgDirList

Fills a list box with a file or directory listing.

CWnd::DlgDirListComboBox

Fills the list box of a combo box with a file or directory listing.

CWnd::DlgDirSelect

Retrieves the current selection from a list box.

CWnd::DlgDirSelectComboBox

Retrieves the current selection from the list box of a combo box.

CWnd::DragAcceptFiles

Indicates the window will accept dragged files.

CWnd::DragDetect

Captures the mouse and tracks its movement until the user releases the left button, presses the ESC key, or moves the mouse outside the drag rectangle around the specified point.

CWnd::DrawAnimatedRects

Draws a wire-frame rectangle and animates it to indicate the opening of an icon or the minimizing or maximizing of a window.

CWnd::DrawCaption

Draws a caption.

CWnd::DrawMenuBar

Redraws the menu bar.

CWnd::EnableActiveAccessibility

Enables user-defined Active Accessibility functions.

CWnd::EnableD2DSupport

Enables or disables window D2D support. Call this method before the main window is initialized.

CWnd::EnableScrollBar

Enables or disables one or both arrows of a scroll bar.

CWnd::EnableScrollBarCtrl

Enables or disables a sibling scroll-bar control.

CWnd::EnableToolTips

Enables the tooltip control.

CWnd::EnableTrackingToolTips

Enables the tooltip control in tracking mode.

CWnd::EnableWindow

Enables or disables mouse and keyboard input.

CWnd::EndModalLoop

Ends a window's modal status.

CWnd::EndModalState

Call this member function to change a frame window from modal to modeless.

CWnd::EndPaint

Marks the end of painting.

CWnd::ExecuteDlgInit

Initiates a dialog resource.

CWnd::FilterToolTipMessage

Retrieves the title or text associated with a control in a dialog box.

CWnd::FindWindow

Returns the handle of the window, which is identified by its window name and window class.

CWnd::FindWindowEx

Returns the handle of the window, which is identified by its window name and window class.

CWnd::FlashWindow

Flashes the window once.

CWnd::FlashWindowEx

Flashes the window with additional functionality.

CWnd::FromHandle

Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached.

CWnd::FromHandlePermanent

Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached.

CWnd::get_accChild

Called by the framework to retrieve the address of an IDispatch interface for the specified child.

CWnd::get_accChildCount

Called by the framework to retrieve the number of children belonging to this object.

CWnd::get_accDefaultAction

Called by the framework to retrieve a string that describes the object's default action.

CWnd::get_accDescription

Called by framework to retrieve a string that describes the visual appearance of the specified object.

CWnd::get_accFocus

Called by the framework to retrieve the object that has the keyboard focus.

CWnd::get_accHelp

Called by the framework to retrieve an object's Help property string.

CWnd::get_accHelpTopic

Called by the framework to retrieve the full path of the WinHelp file associated with the specified object and the identifier of the appropriate topic within that file.

CWnd::get_accKeyboardShortcut

Called by the framework to retrieve the specified object's shortcut key or access key.

CWnd::get_accName

Called by the framework to retrieve the name of the specified object.

CWnd::get_accParent

Called by the framework to retrieve the IDispatch interface of the object's parent.

CWnd::get_accRole

Called by the framework to retrieve information that describes the role of the specified object.

CWnd::get_accSelection

Called by the framework to retrieve the selected children of this object.

CWnd::get_accState

Called by the framework to retrieve the current state of the specified object.

CWnd::get_accValue

Called by the framework to retrieve the value of the specified object.

CWnd::GetActiveWindow

Retrieves the active window.

CWnd::GetAncestor

Retrieves the ancestor window object of the specified window.

CWnd::GetCapture

Retrieves the CWnd that has the mouse capture.

CWnd::GetCaretPos

Retrieves the client coordinates of the caret's current position.

CWnd::GetCheckedRadioButton

Returns the ID of the currently checked radio button in a group of buttons.

CWnd::GetClientRect

Gets the dimensions of the CWnd client area.

CWnd::GetClipboardOwner

Retrieves a pointer to the current owner of the Clipboard.

CWnd::GetClipboardViewer

Retrieves a pointer to the first window in the chain of Clipboard viewers.

CWnd::GetControlUnknown

Retrieves a pointer to an unknown ActiveX control.

CWnd::GetDC

Retrieves a display context for the client area.

CWnd::GetDCEx

Retrieves a display context for the client area, and enables clipping while drawing.

CWnd::GetDescendantWindow

Searches all descendant windows and returns the window with the specified ID.

CWnd::GetDesktopWindow

Retrieves the Windows desktop window.

CWnd::GetDlgCtrlID

If the CWnd is a child window, calling this function returns its ID value.

CWnd::GetDlgItem

Retrieves the control with the specified ID from the specified dialog box.

CWnd::GetDlgItemInt

Translates the text of a control in the given dialog box to an integer value.

CWnd::GetDlgItemText

Retrieves the caption or text associated with a control.

CWnd::GetDSCCursor

Retrieves a pointer to the underlying cursor that is defined by the DataSource, UserName, Password, and SQL properties of a data-source control.

CWnd::GetExStyle

Returns the window's extended style.

CWnd::GetFocus

Retrieves the CWnd that currently has the input focus.

CWnd::GetFont

Retrieves the current font.

CWnd::GetForegroundWindow

Returns a pointer to the foreground window (the top-level window with which the user is currently working).

CWnd::GetIcon

Retrieves the handle to an icon.

CWnd::GetLastActivePopup

Determines which pop-up window owned by CWnd was most recently active.

CWnd::GetLayeredWindowAttributes

Retrieves the opacity and transparency color key of a layered window.

CWnd::GetMenu

Retrieves a pointer to the specified menu.

CWnd::GetNextDlgGroupItem

Searches for the next (or previous) control within a group of controls.

CWnd::GetNextDlgTabItem

Retrieves the first control with the WS_TABSTOP style that follows (or precedes) the specified control.

CWnd::GetNextWindow

Returns the next (or previous) window in the window manager's list.

CWnd::GetOleControlSite

Retrieves the custom site for the specified ActiveX control.

CWnd::GetOpenClipboardWindow

Retrieves a pointer to the window that currently has the Clipboard open.

CWnd::GetOwner

Retrieves a pointer to the owner of a CWnd.

CWnd::GetParent

Retrieves the parent window of CWnd (if any).

CWnd::GetParentFrame

Retrieves the CWnd object's parent frame window.

CWnd::GetParentOwner

Returns a pointer to a child window's parent window.

CWnd::GetProperty

Retrieves an ActiveX control property.

CWnd::GetRenderTarget

Gets a render target that is associated with this window.

CWnd::GetSafeHwnd

Returns m_hWnd, or NULL if the this pointer is NULL.

CWnd::GetSafeOwner

Retrieves the safe owner for the given window.

CWnd::GetScrollBarCtrl

Returns a sibling scroll-bar control.

CWnd::GetScrollBarInfo

Retrieves information about the specified scroll bar.

CWnd::GetScrollInfo

Retrieves the information that the SCROLLINFO structure maintains about a scroll bar.

CWnd::GetScrollLimit

Retrieves the limit of the scroll bar.

CWnd::GetScrollPos

Retrieves the current position of a scroll box.

CWnd::GetScrollRange

Copies the current minimum and maximum scroll-bar positions for the given scroll bar.

CWnd::GetStyle

Returns the current window style.

CWnd::GetSystemMenu

Allows the application to access the Control menu for copying and modification.

CWnd::GetTitleBarInfo

Retrieves information about the specified title bar.

CWnd::GetTopLevelFrame

Retrieves the window's top-level frame window.

CWnd::GetTopLevelOwner

Retrieves the top-level window.

CWnd::GetTopLevelParent

Retrieves the window's top-level parent.

CWnd::GetTopWindow

Returns the first child window that belongs to the CWnd.

CWnd::GetUpdateRect

Retrieves the coordinates of the smallest rectangle that completely encloses the CWnd update region.

CWnd::GetUpdateRgn

Retrieves the CWnd update region.

CWnd::GetWindow

Returns the window with the specified relationship to this window.

CWnd::GetWindowContextHelpId

Retrieves the help context identifier.

CWnd::GetWindowDC

Retrieves the display context for the whole window, including the caption bar, menus, and scroll bars.

CWnd::GetWindowedChildCount

Returns the number of associated child windows.

CWnd::GetWindowInfo

Returns information about the window.

CWnd::GetWindowlessChildCount

Returns the number of associated windowless child windows.

CWnd::GetWindowPlacement

Retrieves the show state and the normal (restored), minimized, and maximized positions of a window.

CWnd::GetWindowRect

Gets the screen coordinates of CWnd.

CWnd::GetWindowRgn

Retrieves a copy of the window region of a window.

CWnd::GetWindowText

Returns the window text or caption title (if it has one).

CWnd::GetWindowTextLength

Returns the length of the window's text or caption title.

CWnd::HideCaret

Hides the caret by removing it from the display screen.

CWnd::HiliteMenuItem

Highlights or removes the highlighting from a top-level (menu-bar) menu item.

CWnd::HtmlHelp

Called to initiate the HTMLHelp application.

CWnd::Invalidate

Invalidates the entire client area.

CWnd::InvalidateRect

Invalidates the client area within the given rectangle by adding that rectangle to the current update region.

CWnd::InvalidateRgn

Invalidates the client area within the given region by adding that region to the current update region.

CWnd::InvokeHelper

Invokes an ActiveX control method or property.

CWnd::IsChild

Indicates whether CWnd is a child window or other direct descendant of the specified window.

CWnd::IsD2DSupportEnabled

Determines whether D2D support is enabled.

CWnd::IsDialogMessage

Determines whether the given message is intended for the modeless dialog box and, if so, processes it.

CWnd::IsDlgButtonChecked

Determines whether a button control is checked.

CWnd::IsIconic

Determines whether CWnd is minimized (iconic).

CWnd::IsTouchWindow

Specifies whether CWnd has touch support.

CWnd::IsWindowEnabled

Determines whether the window is enabled for mouse and keyboard input.

CWnd::IsWindowVisible

Determines whether the window is visible.

CWnd::IsZoomed

Determines whether CWnd is maximized.

CWnd::KillTimer

Kills a system timer.

CWnd::LockWindowUpdate

Disables or reenables drawing in the given window.

CWnd::MapWindowPoints

Converts (maps) a set of points from the coordinate space of the CWnd to the coordinate space of another window.

CWnd::MessageBox

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

CWnd::ModifyStyle

Modifies the current window style.

CWnd::ModifyStyleEx

Modifies the window's extended style.

CWnd::MoveWindow

Changes the position and dimensions of CWnd.

CWnd::NotifyWinEvent

Signals the system that a predefined event occurred.

CWnd::OnAmbientProperty

Implement ambient property values.

CWnd::OnDrawIconicThumbnailOrLivePreview

Called by the framework when it needs to obtain a bitmap to be displayed on Windows 7 tab thumbnail, or on the client for application peek.

CWnd::OnHelp

Handles F1 Help within the application (using the current context).

CWnd::OnHelpFinder

Handles the ID_HELP_FINDER and ID_DEFAULT_HELP commands.

CWnd::OnHelpIndex

Handles the ID_HELP_INDEX command and provides a default Help topic.

CWnd::OnHelpUsing

Handles the ID_HELP_USING command.

CWnd::OnToolHitTest

Determines whether a point is in the bounding rectangle of the specified tool and retrieves information about the tool.

CWnd::OpenClipboard

Opens the Clipboard. Other applications will not be able to modify the Clipboard until the Windows CloseClipboard function is called.

CWnd::PaintWindowlessControls

Draws windowless controls on the control container.

CWnd::PostMessage

Places a message in the application queue, then returns without waiting for the window to process the message.

CWnd::PreCreateWindow

Called before the creation of the Windows window attached to this CWnd object.

CWnd::PreSubclassWindow

Allows other necessary subclassing to occur before SubclassWindow is called.

CWnd::PreTranslateMessage

Used by CWinApp to filter window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions.

CWnd::Print

Draws the current window in the specified device context.

CWnd::PrintClient

Draws any window in the specified device context (usually a printer device context).

CWnd::PrintWindow

Copies a visual window into the specified device context, typically a printer DC.

CWnd::RedrawWindow

Updates the specified rectangle or region in the client area.

CWnd::RegisterTouchWindow

Register/Unregister window Windows touch support.

CWnd::ReleaseDC

Releases client and window device contexts, freeing them for use by other applications.

CWnd::RepositionBars

Repositions control bars in the client area.

CWnd::RunModalLoop

Retrieves, translates, or dispatches messages for a window that is in modal status.

CWnd::ScreenToClient

Converts the screen coordinates of a given point or rectangle on the display to client coordinates.

CWnd::ScrollWindow

Scrolls the contents of the client area.

CWnd::ScrollWindowEx

Scrolls the contents of the client area. Similar to ScrollWindow, with additional features.

CWnd::SendChildNotifyLastMsg

Provides a notification message to a child window, from the parent window, so the child window can handle a task.

CWnd::SendDlgItemMessage

Sends a message to the specified control.

CWnd::SendMessage

Sends a message to the CWnd object and does not return until it has processed the message.

CWnd::SendMessageToDescendants

Sends a message to all descendant windows of the window.

CWnd::SendNotifyMessage

Sends the specified message to the window and returns as soon as possible, depending on whether the calling thread created the window.

CWnd::SetActiveWindow

Activates the window.

CWnd::SetCapture

Causes all subsequent mouse input to be sent to the CWnd.

CWnd::SetCaretPos

Moves the caret to a specified position.

CWnd::SetClipboardViewer

Adds CWnd to the chain of windows that are notified whenever the contents of the Clipboard are changed.

CWnd::SetDlgCtrlID

Sets the window or control ID for the window (which can be any child window, not only a control in a dialog box).

CWnd::SetDlgItemInt

Sets the text of a control to the string that represents an integer value.

CWnd::SetDlgItemText

Sets the caption or text of a control in the specified dialog box.

CWnd::SetFocus

Claims the input focus.

CWnd::SetFont

Sets the current font.

CWnd::SetForegroundWindow

Puts the thread that created the window into the foreground and activates the window.

CWnd::SetIcon

Sets the handle to a specific icon.

CWnd::SetLayeredWindowAttributes

Sets the opacity and transparency color key of a layered window.

CWnd::SetMenu

Sets the menu to the specified menu.

CWnd::SetOwner

Changes the owner of a CWnd.

CWnd::SetParent

Changes the parent window.

CWnd::SetProperty

Sets an ActiveX control property.

CWnd::SetRedraw

Allows changes in CWnd to be redrawn or prevents changes from being redrawn.

CWnd::SetScrollInfo

Sets information about the scroll bar.

CWnd::SetScrollPos

Sets the current position of a scroll box and, if specified, redraws the scroll bar to reflect the new position.

CWnd::SetScrollRange

Sets minimum and maximum position values for the given scroll bar.

CWnd::SetTimer

Installs a system timer that sends a WM_TIMER message when triggered.

CWnd::SetWindowContextHelpId

Sets the help context identifier.

CWnd::SetWindowPlacement

Sets the show state and the normal (restored), minimized, and maximized positions for a window.

CWnd::SetWindowPos

Changes the size, position, and ordering of child, pop-up, and top-level windows.

CWnd::SetWindowRgn

Sets the region of a window.

CWnd::SetWindowText

Sets the window text or caption title (if it has one) to the specified text.

CWnd::ShowCaret

Shows the caret on the display at the caret's current position. Once shown, the caret begins flashing automatically.

CWnd::ShowOwnedPopups

Shows or hides all pop-up windows owned by the window.

CWnd::ShowScrollBar

Displays or hides a scroll bar.

CWnd::ShowWindow

Shows or hides the window.

CWnd::SubclassDlgItem

Attaches a Windows control to a CWnd object and makes it route messages through the CWnd's message map.

CWnd::SubclassWindow

Attaches a window to a CWnd object and makes it route messages through the CWnd's message map.

CWnd::UnlockWindowUpdate

Unlocks a window that was locked with CWnd::LockWindowUpdate.

CWnd::UnsubclassWindow

Detaches a window from a CWnd object

CWnd::UpdateData

Initializes or retrieves data from a dialog box.

CWnd::UpdateDialogControls

Call to update the state of dialog buttons and other controls.

CWnd::UpdateLayeredWindow

Updates the position, size, shape, content, and translucency of a layered window.

CWnd::UpdateWindow

Updates the client area.

CWnd::ValidateRect

Validates the client area within the given rectangle by removing the rectangle from the current update region.

CWnd::ValidateRgn

Validates the client area within the given region by removing the region from the current update region.

CWnd::WindowFromPoint

Identifies the window that contains the given point.

CWnd::WinHelp

Called to initiate the WinHelp application.

Protected Methods

Name

Description

CWnd::Default

Calls the default window procedure, which provides default processing for any window messages that an application does not process.

CWnd::DefWindowProc

Calls the default window procedure, which provides default processing for any window messages that an application does not process.

CWnd::DoDataExchange

For dialog data exchange and validation. Called by UpdateData.

CWnd::GetCurrentMessage

Returns a pointer to the message this window is currently processing. Should only be called when in an OnMessage message-handler member function.

CWnd::OnActivate

Called when CWnd is being activated or deactivated.

CWnd::OnActivateApp

Called when the application is about to be activated or deactivated.

CWnd::OnAppCommand

Called when the user generates an application command event.

CWnd::OnAskCbFormatName

Called by a Clipboard viewer application when a Clipboard owner will display the Clipboard contents.

CWnd::OnCancelMode

Called to allow CWnd to cancel any internal modes, such as mouse capture.

CWnd::OnCaptureChanged

Sends a message to the window that is losing the mouse capture.

CWnd::OnChangeCbChain

Notifies that a specified window is being removed from the chain.

CWnd::OnChangeUIState

Called when the user interface (UI) state should be changed.

CWnd::OnChar

Called when a keystroke translates to a non-system character.

CWnd::OnCharToItem

Called by a child list box with the LBS_WANTKEYBOARDINPUT style in response to a WM_CHAR message.

CWnd::OnChildActivate

Called for multiple document interface (MDI) child windows whenever the size or position of CWnd changes or CWnd is activated.

CWnd::OnChildNotify

Called by a parent window to give a notifying control a chance to respond to a control notification.

CWnd::OnClipboardUpdate

Called when the contents of the clipboard have changed.

CWnd::OnClose

Called as a signal that CWnd should be closed.

CWnd::OnColorizationColorChanged

Called when the rendering policy for the non-client area has changed.

CWnd::OnCommand

Called when the user selects a command.

CWnd::OnCompacting

Called when Windows detects that system memory is low.

CWnd::OnCompareItem

Called to determine the relative position of a new item in a child sorted owner-draw combo box or list box.

CWnd::OnCompositionChanged

Called for all top-level windows when the Desktop Window Manager (DWM) composition is enabled or disabled.

CWnd::OnContextMenu

Called when the user clicks the right mouse button in the window.

CWnd::OnCopyData

Copies data from one application to another.

CWnd::OnCreate

Called as a part of window creation.

CWnd::OnCtlColor

Called if CWnd is the parent of a control when the control is about to be drawn.

CWnd::OnDeadChar

Called when a keystroke translates to a nonsystem dead character (such as accent characters).

CWnd::OnDeleteItem

Called when an owner-draw child list box or combo box is destroyed or when items are removed from the control.

CWnd::OnDestroy

Called when CWnd is being destroyed.

CWnd::OnDestroyClipboard

Called when the Clipboard is emptied through a call to the Windows EmptyClipboard function.

CWnd::OnDeviceChange

Notifies an application or device driver of a change to the hardware configuration of a device or the computer.

CWnd::OnDevModeChange

Called for all top-level windows when the user changes device-mode settings.

CWnd::OnDrawClipboard

Called when the contents of the Clipboard change.

CWnd::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.

CWnd::OnDropFiles

Called when the user releases the left mouse button over a window that has registered itself as the recipient of dropped files.

CWnd::OnEnable

Called when CWnd is enabled or disabled.

CWnd::OnEndSession

Called when the session is ending.

CWnd::OnEnterIdle

Called to inform an application's main window procedure that a modal dialog box or a menu is entering an idle state.

CWnd::OnEnterMenuLoop

Called when a menu modal loop has been entered.

CWnd::OnEnterSizeMove

Called after the affected window enters a moving or sizing modal loop.

CWnd::OnEraseBkgnd

Called when the window background needs erasing.

CWnd::OnExitMenuLoop

Called when a menu modal loop has been exited.

CWnd::OnExitSizeMove

Called after the affected window exits a moving or sizing modal loop.

CWnd::OnFontChange

Called when the pool of font resources changes.

CWnd::OnGetDlgCode

Called for a control so the control can process arrow-key and TAB-key input itself.

CWnd::OnGetMinMaxInfo

Called whenever Windows needs to know the maximized position or dimensions, or the minimum or maximum tracking size.

CWnd::OnHelpInfo

Called by the framework when the user presses the F1 key.

CWnd::OnHotKey

Called when the user presses a system-wide hot key.

CWnd::OnHScroll

Called when the user clicks the horizontal scroll bar of CWnd.

CWnd::OnHScrollClipboard

Called when a Clipboard owner should scroll the Clipboard image, invalidate the appropriate section, and update the scroll-bar values.

CWnd::OnIconEraseBkgnd

Called when CWnd is minimized (iconic) and the background of the icon must be filled before painting the icon.

CWnd::OnInitMenu

Called when a menu is about to become active.

CWnd::OnInitMenuPopup

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

CWnd::OnInputDeviceChange

Called when an I/O device is added or removed from the system.

CWnd::OnInputLangChange

Called after an application's input language has been changed.

CWnd::OnInputLangChangeRequest

Called when the user chooses a new input language.

CWnd::OnKeyDown

Called when a nonsystem key is pressed.

CWnd::OnKeyUp

Called when a nonsystem key is released.

CWnd::OnKillFocus

Called immediately before CWnd loses the input focus.

CWnd::OnLButtonDblClk

Called when the user double-clicks the left mouse button.

CWnd::OnLButtonDown

Called when the user presses the left mouse button.

CWnd::OnLButtonUp

Called when the user releases the left mouse button.

CWnd::OnMButtonDblClk

Called when the user double-clicks the middle mouse button.

CWnd::OnMButtonDown

Called when the user presses the middle mouse button.

CWnd::OnMButtonUp

Called when the user releases the middle mouse button.

CWnd::OnMDIActivate

Called when an MDI child window is activated or deactivated.

CWnd::OnMeasureItem

Called for an owner-draw child combo box, list box, or menu item when the control is created. CWnd informs Windows of the dimensions of the control.

CWnd::OnMenuChar

Called when the user presses a menu mnemonic character that doesn't match any of the predefined mnemonics in the current menu.

CWnd::OnMenuDrag

Called when the user begins to drag a menu item.

CWnd::OnMenuGetObject

Called when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item.

CWnd::OnMenuRButtonUp

Called when the user releases the right mouse button while the cursor is on a menu item.

CWnd::OnMenuSelect

Called when the user selects a menu item.

CWnd::OnMouseActivate

Called when the cursor is in an inactive window and the user presses a mouse button.

CWnd::OnMouseHover

Called when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.

CWnd::OnMouseHWheel

Called when the current window is composed by the Desktop Window Manager (DWM), and that window is maximized.

CWnd::OnMouseLeave

Called when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.

CWnd::OnMouseMove

Called when the mouse cursor moves.

CWnd::OnMouseWheel

Called when a user rotates the mouse wheel. Uses Windows NT 4.0 message handling.

CWnd::OnMove

Called after the position of the CWnd has been changed.

CWnd::OnMoving

Indicates that a user is moving a CWnd object.

CWnd::OnNcActivate

Called when the non-client area needs to be changed to indicate an active or inactive state.

CWnd::OnNcCalcSize

Called when the size and position of the client area need to be calculated.

CWnd::OnNcCreate

Called prior to OnCreate when the non-client area is being created.

CWnd::OnNcDestroy

Called when the non-client area is being destroyed.

CWnd::OnNcHitTest

Called by Windows every time the mouse is moved if CWnd contains the cursor or has captured mouse input with SetCapture.

CWnd::OnNcLButtonDblClk

Called when the user double-clicks the left mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcLButtonDown

Called when the user presses the left mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcLButtonUp

Called when the user releases the left mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcMButtonDblClk

Called when the user double-clicks the middle mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcMButtonDown

Called when the user presses the middle mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcMButtonUp

Called when the user releases the middle mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcMouseHover

Called when the cursor hovers over the non-client area of the window for the period of time specified in a prior call to TrackMouseEvent.

CWnd::OnNcMouseLeave

The framework calls this member function when the cursor leaves the non-client area of the window specified in a prior call to TrackMouseEvent.

CWnd::OnNcMouseMove

Called when the cursor is moved within a non-client area of CWnd.

CWnd::OnNcPaint

Called when the non-client area needs painting.

CWnd::OnNcRButtonDblClk

Called when the user double-clicks the right mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcRButtonDown

Called when the user presses the right mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcRButtonUp

Called when the user releases the right mouse button while the cursor is within a non-client area of CWnd.

CWnd::OnNcRenderingChanged

Called when the rendering policy for the non-client area has changed.

CWnd::OnNcXButtonDblClk

Called when the user double-clicks XBUTTON1 or XBUTTON2 while the cursor is in the non-client area of a window.

CWnd::OnNcXButtonDown

Called when the user presses XBUTTON1 or XBUTTON2 of the mouse while the cursor is in the non-client area of a window.

CWnd::OnNcXButtonUp

Called when the user releases XBUTTON1 or XBUTTON2 of the mouse while the cursor is in the non-client area of a window.

CWnd::OnNextMenu

Called when the right or left arrow key is used to switch between the menu bar and the system menu.

CWnd::OnNotify

Called by the framework to inform a parent window an event has occurred in one of its controls or that the control needs information.

CWnd::OnNotifyFormat

Called to determine if the current window accepts ANSI or Unicode structures in the WM_NOTIFY notification message.

CWnd::OnPaint

Called to repaint a portion of the window.

CWnd::OnPaintClipboard

Called when the client area of the Clipboard viewer needs repainting.

CWnd::OnPaletteChanged

Called to allow windows that use a color palette to realize their logical palettes and update their client areas.

CWnd::OnPaletteIsChanging

Informs other applications when an application is going to realize its logical palette.

CWnd::OnParentNotify

Called when a child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window.

CWnd::OnPowerBroadcast

Called when a power-management event occurs.

CWnd::OnQueryDragIcon

Called when a minimized (iconic) CWnd is about to be dragged by the user.

CWnd::OnQueryEndSession

Called when the user chooses to end the Windows session.

CWnd::OnQueryNewPalette

Informs CWnd that it is about to receive the input focus.

CWnd::OnQueryOpen

Called when CWnd is an icon and the user requests that the icon be opened.

CWnd::OnQueryUIState

Called to retrieve the user interface (UI) state for a window.

CWnd::OnRawInput

Called when the current window gets raw input.

CWnd::OnRButtonDblClk

Called when the user double-clicks the right mouse button.

CWnd::OnRButtonDown

Called when the user presses the right mouse button.

CWnd::OnRButtonUp

Called when the user releases the right mouse button.

CWnd::OnRenderAllFormats

Called when the owner application is being destroyed and needs to render all its formats.

CWnd::OnRenderFormat

Called for the Clipboard owner when a particular format with delayed rendering needs to be rendered.

CWnd::OnSessionChange

Called to notify an application of a change in session state.

CWnd::OnSetCursor

Called if mouse input is not captured and the mouse causes cursor movement within a window.

CWnd::OnSetFocus

Called after CWnd gains the input focus.

CWnd::OnSettingChange

Called when the Win32 SystemParametersInfo function changes a system-wide setting.

CWnd::OnShowWindow

Called when CWnd is to be hidden or shown.

CWnd::OnSize

Called after the size of CWnd has changed.

CWnd::OnSizeClipboard

Called when the size of the client area of the Clipboard-viewer window has changed.

CWnd::OnSizing

Indicates that the user is resizing the rectangle.

CWnd::OnSpoolerStatus

Called from Print Manager whenever a job is added to or removed from the Print Manager queue.

CWnd::OnStyleChanged

Indicates that the SetWindowLong Windows function has changed one or more of the window's styles.

CWnd::OnStyleChanging

Indicates that the SetWindowLong Windows function is about to change one or more of the window's styles.

CWnd::OnSysChar

Called when a keystroke translates to a system character.

CWnd::OnSysColorChange

Called for all top-level windows when a change is made in the system color setting.

CWnd::OnSysCommand

Called when the user selects a command from the Control menu, or when the user selects the Maximize or Minimize button.

CWnd::OnSysDeadChar

Called when a keystroke translates to a system dead character (such as accent characters).

CWnd::OnSysKeyDown

Called when the user holds down the ALT key and then presses another key.

CWnd::OnSysKeyUp

Called when the user releases a key that was pressed while the ALT key was held down.

CWnd::OnTCard

Called when the user clicks an authorable button.

CWnd::OnTimeChange

Called for all top-level windows after the system time changes.

CWnd::OnTimer

Called after each interval specified in SetTimer.

CWnd::OnTouchInput

Process single input from Windows touch.

CWnd::OnTouchInputs

Process inputs from Windows touch.

CWnd::OnUniChar

Called when a key is pressed. That is, the current window has the keyboard focus and a WM_KEYDOWN message is translated by the TranslateMessage function.

CWnd::OnUnInitMenuPopup

Called when a drop-down menu or submenu has been destroyed.

CWnd::OnUpdateUIState

Called to change the user interface (UI) state for the specified window and all its child windows.

CWnd::OnUserChanged

Called after the user has logged on or off.

CWnd::OnVKeyToItem

Called by a list box owned by CWnd in response to a WM_KEYDOWN message.

CWnd::OnVScroll

Called when the user clicks the window's vertical scroll bar.

CWnd::OnVScrollClipboard

Called when the owner should scroll the Clipboard image, invalidate the appropriate section, and update the scroll-bar values.

CWnd::OnWindowPosChanged

Called when the size, position, or Z-order has changed as a result of a call to SetWindowPos or another window-management function.

CWnd::OnWindowPosChanging

Called when the size, position, or Z-order is about to change as a result of a call to SetWindowPos or another window-management function.

CWnd::OnWinIniChange

Called for all top-level windows after the Windows initialization file, WIN.INI, is changed.

CWnd::OnWndMsg

Indicates if a windows message was handled.

CWnd::OnXButtonDblClk

Called when the user double-clicks XBUTTON1 or XBUTTON2 while the cursor is in the client area of a window.

CWnd::OnXButtonDown

Called when the user presses XBUTTON1 or XBUTTON2 while the cursor is in the client area of a window.

CWnd::OnXButtonUp

Called when the user releases XBUTTON1 or XBUTTON2 while the cursor is in the client area of a window.

CWnd::PostNcDestroy

This virtual function is called by the default OnNcDestroy function after the window has been destroyed.

CWnd::ReflectChildNotify

Helper function which reflects a message to its source.

CWnd::ReflectLastMsg

Reflects the last message to the child window.

CWnd::WindowProc

Provides a window procedure for a CWnd. The default dispatches messages through the message map.

Public Operators

Name

Description

CWnd::operator HWND

Call to get a handle to a window.

CWnd::operator !=

Determines if a window is not the same as the window whose handle is m_hWnd.

CWnd::operator ==

Determines if a window is the same as the window whose handle is m_hWnd.

Public Data Members

Name

Description

CWnd::m_hWnd

Indicates the HWND attached to this CWnd.

Remarks

A CWnd object is 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 a Create member function and destroyed by the CWnd virtual destructor. The DestroyWindow function 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 OnMessage CWnd member functions. You override an OnMessage member function to handle a member's particular message in your derived classes.

The CWnd class also lets you create a Windows child window for your application. Derive a class from CWnd, then 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.

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.

Within the Microsoft Foundation Class Library, further classes are derived from CWnd to provide specific window types. Many of these classes, including CFrameWnd, CMDIFrameWnd, CMDIChildWnd, CView, and CDialog, are designed for further derivation. The control classes derived from CWnd, such as CButton, can be used directly or can be used for further derivation of classes.

For more information on using CWnd, see Frame Windows and Window Objects.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

Requirements

Header: afxwin.h

See Also

Reference

CCmdTarget Class

Hierarchy Chart

CFrameWnd Class

CView Class