Dialog title

How do I change the title of a dialog??
huyaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
galkinConnect With a Mentor Commented:
SetWindowText
0
 
VEngineerCommented:
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.
0
 
galkinCommented:
No, call SetWindowText for your dialog, not for control. It will set dialog title
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
huyaAuthor Commented:
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();
0
 
galkinCommented:
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.
0
 
huyaAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.