This documentation is archived and is not being maintained.


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 


Specifies the message to be sent.
Specifies additional message-dependent information.
Specifies additional message-dependent information.
Specifies the level to which to search. If TRUE, recursively search all children; if FALSE, search only immediate children.
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()

   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
   strcpy(lf.lfFaceName, "Arial");   // with face name "Arial".
   m_font.CreateFontIndirect(&lf);   // Create the font. 

      (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;

See Also

CWnd Overview | Class Members | Hierarchy Chart | CWnd::SendMessage | CWnd::FromHandlePermanent | CWnd::FromHandle