Share via


CWnd::SendMessageToDescendants

Call this member function to send the specified Windows message to all descendant windows.

void SendMessageToDescendants( 
   UINT message, 
   WPARAM wParam = 0, 
   LPARAM lParam = 0, 
   BOOL bDeep = TRUE, 
   BOOL bOnlyPerm = FALSE  
);

Parameters

  • message
    Specifies the message to be sent.

  • wParam
    Specifies additional message-dependent information.

  • lParam
    Specifies additional message-dependent information.

  • bDeep
    Specifies the level to which to search. If TRUE, recursively search all children; if FALSE, search only immediate children.

  • bOnlyPerm
    Specifies whether the message will be received by temporary windows. If TRUE, temporary windows can receive the message; if FALSE, only permanent windows receive the message. For more information on temporary windows see Technical Note 3.

Remarks

If bDeep is FALSE, the message is sent just to the immediate children of the window; otherwise the message is sent to all descendant windows.

If bDeep and bOnlyPerm are TRUE, the search continues below temporary windows. In this case, only permanent windows encountered during the search receive the message. If bDeep is FALSE, the message is sent only to the immediate children of the window.

Example

// The following code fragment is from CMyDlg::OnInitDialog 
// CMyDlg is derived from CDialog. 

// change font of child controls of a dialog
LOGFONT lf = {0};  
// redraw of child controls not needed in OnInitDialog  
// since controls aren't drawn yet. 
short int fRedraw = FALSE; 

lf.lfHeight = 15;                 // Request a 15-pixel-high font 

// with face name "Arial".
wcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Arial"));   

m_font.CreateFontIndirect(&lf);   // Create the font. 

SendMessageToDescendants(WM_SETFONT,
   (WPARAM)m_font.m_hObject,  //handle to font
   MAKELONG ((WORD) fRedraw, 0), 
   FALSE);  // send to all descendants(TRUE) or  
            // just children of *this (FALSE)

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::SendMessage

CWnd::FromHandlePermanent

CWnd::FromHandle