CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Mora,Sweden
    Posts
    38

    Changing the caption on a modal dialog

    I have tried to change the caption for a modal dialog with this code:

    CMyDia dlg;
    dlg.SetWindowsText("Hello World");
    dlg.DoModal();




    The code compiles and runs but the caption will not change. The CMyDia class is just a dialog with a static text. The class is created by ClassWizard.
    The code is in a dll.
    //Anders




  2. #2
    Join Date
    May 1999
    Posts
    48

    Re: Changing the caption on a modal dialog

    Call dlg.SetWindowsText("Hello World"); in dlg.OnInitDialog.
    Sincerely, Mihai


  3. #3
    Join Date
    May 1999
    Posts
    19

    Re: Changing the caption on a modal dialog

    When you call SetWindowTExt() it will try to change the caption of an existing window. In the dialog case, window is created only when you call DoModal(). Till that time window doesn't exist, so calling SetWindowText() before DoModal() won't make any change. You do it in the InitDialog().

    [email protected]
    B'lore
    India.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured