
How do I change the caption on an MFC Dialog box (dynamically)
CWnd::SetWindowText
void SetWindowText( LPCTSTR lpszString );
Parameters
lpszString
Points to a CString object or null-terminated string to be used as the new
title or control text.
Remarks
Sets the window?s title to the specified text. If the window is a control,
the text within the control is set.
This function causes aWM_SETTEXT message to be sent to this window.
CWnd Overview | Class Members | Hierarchy Chart
See Also CWnd::GetWindowText,::SetWindowText
Quote:
> I have a dialog box that I would like the caption heading for, depending
on
> the selection made from a menu.
> I have tried:
> CString CaptionText = _T("Dynamic Heading");
> dlgDialogBox.SetWindowText(CaptionText);
> and I keep getting an assertion failure. The SetWindowText function is
> supposed to take a CString object, so I'm confused. (My normal state of
> existence!)
> Any suggestions would be appreciated. Thanks.
> Stephen