
Changing the Caption of a Modal Dialog at Runtime
Why don't U change it when U are in the dialog, i.e, OnInitDialog()???
if U want to change the data of a static text, U can declare a member variable
of CString type for that control and set it before U call the DoModal function.
But if U know the values inside the Dialog, then U can put it in the
OnInitDialog instead of using the DDX mechanism to do it for U.
There is no separate ID for the DlgBoxItem caption. So if U called SetWindowText
for the dialogbox, it should set the caption of the dialog box.
Quote:
> Hi,
> Does anyone know of a way to change the caption (title) and change static
> text within a modal dialog box at runtime? I'm using MFC 4.2 / Visual
> C++5.0.
> I have been able to successfully to successfully change static text in a
> MODELESS dialog box by displaying the dialog, then calling SetDlgItemText()
> for that dialog. (I think) the problem is that the DoModal function doesn't
> return until OK or Cancel is pressed by the user to close the dialog. By
> this time, it's too late to change the text because the window is gone.
> To summarize, I have 2 questions:
> 1. How do I change any sort of static text in a modal dialog at runtime?
> 2. What is the ID or variable name of the dialog box title that I want to
> change?
> Thank you very much,
> Mike