Export (0) Print
Expand All
MFC
Expand Minimize

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.

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.

// change font of child controls of a dialog
BOOL CCtrldilg::OnInitDialog()
{
    CDialog::OnInitDialog();

    LOGFONT lf;  
    // redraw of child controls not needed in OnInitDialog 
    // since controls aren't drawn yet.
    short int fRedraw= FALSE; 

    memset(&lf, 0, sizeof(LOGFONT));  // Clear out structure.
    lf.lfHeight = 15;                 // Request a 15-pixel-high font

    // with face name "Arial".
    strcpy_s(lf.lfFaceName, LF_FACESIZE, "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)

    return TRUE;
}

Community Additions

ADD
Show:
© 2014 Microsoft