Click here to Skip to main content
15,923,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: string formatting Pin
jamiehale19-Sep-02 5:50
jamiehale19-Sep-02 5:50 
GeneralRe: string formatting Pin
jhwurmbach19-Sep-02 5:25
jhwurmbach19-Sep-02 5:25 
GeneralRe: string formatting Pin
jamiehale19-Sep-02 5:44
jamiehale19-Sep-02 5:44 
GeneralRe: string formatting Pin
Todd Smith19-Sep-02 7:00
Todd Smith19-Sep-02 7:00 
GeneralRe: string formatting Pin
jamiehale19-Sep-02 7:46
jamiehale19-Sep-02 7:46 
GeneralRe: string formatting Pin
Michael Dunn19-Sep-02 7:59
sitebuilderMichael Dunn19-Sep-02 7:59 
GeneralDoModal() and CDialog caption Pin
ns19-Sep-02 4:36
ns19-Sep-02 4:36 
GeneralRe: DoModal() and CDialog caption Pin
TyMatthews19-Sep-02 4:46
TyMatthews19-Sep-02 4:46 
Your dialog doesn't exist as a window yet in the context you're trying to set its caption. There is no m_hwnd yet and so the call to SetWindowText kicks out. It's not until you call DoModal() that your window is created. If you want to set the caption prior to it even existing, throw in a string member variable in your CTest class and set it like you are with SetWindowText, except write some other cool function:

class CTest : public CDialog
{
private:
    CString m_strCaption;

public:
    ....
    SetCaption( const char *szCaption )
    {
        m_strCaption = szCaption;
    }
};

DoStuff()
{
   CTest myDlg;
   myDlg.SetCaption( "Cool caption" );
   myDlg.DoModal();
}


Then call SetWindowText in your OnInitDialog(), passing in your new m_strCaption variable.



Ty


"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein


GeneralThanks! Pin
ns19-Sep-02 4:51
ns19-Sep-02 4:51 
GeneralRe: DoModal() and CDialog caption Pin
ns19-Sep-02 5:08
ns19-Sep-02 5:08 
GeneralRe: DoModal() and CDialog caption Pin
TyMatthews19-Sep-02 5:27
TyMatthews19-Sep-02 5:27 
GeneralRe: DoModal() and CDialog caption Pin
ns19-Sep-02 8:21
ns19-Sep-02 8:21 
GeneralRe: DoModal() and CDialog caption Pin
Maximilien19-Sep-02 5:37
Maximilien19-Sep-02 5:37 
GeneralRe: DoModal() and CDialog caption Pin
ns19-Sep-02 8:18
ns19-Sep-02 8:18 
GeneralVolatile variable... Pin
Anonymous19-Sep-02 4:40
Anonymous19-Sep-02 4:40 
GeneralRe: Volatile variable... Pin
TyMatthews19-Sep-02 4:50
TyMatthews19-Sep-02 4:50 
GeneralRe: Volatile variable... Pin
Raphael Kindt19-Sep-02 5:31
Raphael Kindt19-Sep-02 5:31 
GeneralRe: Volatile variable... Pin
Michael Dunn19-Sep-02 5:44
sitebuilderMichael Dunn19-Sep-02 5:44 
GeneralRe: Volatile variable... Pin
Raphael Kindt19-Sep-02 5:58
Raphael Kindt19-Sep-02 5:58 
GeneralPreTranslateMessage return value Pin
ns19-Sep-02 4:20
ns19-Sep-02 4:20 
GeneralRe: PreTranslateMessage return value Pin
dazinith19-Sep-02 4:34
dazinith19-Sep-02 4:34 
Generalfile permissions check and cleanup Pin
dazinith19-Sep-02 4:14
dazinith19-Sep-02 4:14 
GeneralRe: file permissions check and cleanup Pin
TyMatthews19-Sep-02 5:11
TyMatthews19-Sep-02 5:11 
GeneralRe: file permissions check and cleanup Pin
dazinith19-Sep-02 5:46
dazinith19-Sep-02 5:46 
GeneralRe: file permissions check and cleanup Pin
TyMatthews19-Sep-02 5:50
TyMatthews19-Sep-02 5:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.