Link to home
Start Free TrialLog in
Avatar of huya
huya

asked on

Dialog title

How do I change the title of a dialog??
ASKER CERTIFIED SOLUTION
Avatar of galkin
galkin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VEngineer
VEngineer

A typical usage would be:

GetDlgItem(IDD_DIALOG_IDENTIFIER)->SetWindowText("New Dialog Title");

SetWindowText is a member function of class CWnd and can be used on any object, including dialogs (class CDialog) derived from CWnd.
No, call SetWindowText for your dialog, not for control. It will set dialog title
Avatar of huya

ASKER

I have tried that... and at the point where I go to change the
title, the program crashes :

Sample code :  


CDoorDescript   doordescriptdlg(pDoc, &rearstruct, false);

doordescriptdlg.SetWindowText(CString("Hello"));

doordescriptdlg.DoModal();
Your mistake is that you call SetWindowText BEFORe dialog is created so you program crahes. You must call this function from inside your dialog OnInitDialog.
Avatar of huya

ASKER

Thanks