Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing Dialog Caption at run time

Changing Dialog Caption at run time

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestionworkspace
18 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C C NewBe

    It does not work...

    A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #7

    Do you mean it wont compile or nothing happens when the code executes? Can you show your code fragment. SetWindowText() is the correct method to use, there must be something else wrong.

    C 1 Reply Last reply
    0
    • A Anonymous

      Do you mean it wont compile or nothing happens when the code executes? Can you show your code fragment. SetWindowText() is the correct method to use, there must be something else wrong.

      C Offline
      C Offline
      C NewBe
      wrote on last edited by
      #8

      It gives me an Unhandled exception....see code below and remember that my environment is net 7.1, MFC. void SystemAlign::OnBnClickedOk() { GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One"); //CPropertySheet mySheet; //mySheet.SetTitle("System: Signal-To-Noise", 0); //mySheet.DoModal(); }

      D 1 Reply Last reply
      0
      • C C NewBe

        Using the basic code below, I am tring to change the caption(title bar) of the Dialog at run time. It does not work for me........my environment is net 7.1,MFC. Any ideas on how to solve my problem? void SystemAlign::OnBnClickedOk() { CPropertySheet mySheet; mySheet.SetTitle(_T("Junk One"), 0); mySheet.DoModal(); }

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #9

        This works fine in v6. It must be something specific to v7.x, or you have other code in place that is masking the problem.


        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

        1 Reply Last reply
        0
        • C C NewBe

          It gives me an Unhandled exception....see code below and remember that my environment is net 7.1, MFC. void SystemAlign::OnBnClickedOk() { GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One"); //CPropertySheet mySheet; //mySheet.SetTitle("System: Signal-To-Noise", 0); //mySheet.DoModal(); }

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #10

          C++NewBe wrote: GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One"); Going this route, you'd need to call SetWindowText() in the sheet's OnInitDialog() method.


          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

          C 1 Reply Last reply
          0
          • C C NewBe

            Using the basic code below, I am tring to change the caption(title bar) of the Dialog at run time. It does not work for me........my environment is net 7.1,MFC. Any ideas on how to solve my problem? void SystemAlign::OnBnClickedOk() { CPropertySheet mySheet; mySheet.SetTitle(_T("Junk One"), 0); mySheet.DoModal(); }

            P Offline
            P Offline
            Prakash Nadar
            wrote on last edited by
            #11

            SetWindowText(...) will work i suppose.


            God is Real, unless declared Integer.

            1 Reply Last reply
            0
            • D David Crow

              C++NewBe wrote: GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One"); Going this route, you'd need to call SetWindowText() in the sheet's OnInitDialog() method.


              "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

              C Offline
              C Offline
              C NewBe
              wrote on last edited by
              #12

              I get the same Unhandle exception by placing it in OnInitDialog(). I think it is a different method call in net 7.1......I am wasting so much time digging for such a simple problem.....

              D 1 Reply Last reply
              0
              • C C NewBe

                I get the same Unhandle exception by placing it in OnInitDialog(). I think it is a different method call in net 7.1......I am wasting so much time digging for such a simple problem.....

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #13

                C++NewBe wrote: I get the same Unhandle exception by placing it in OnInitDialog(). But how are you calling the SetWindowText() in there?


                "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                C 1 Reply Last reply
                0
                • D David Crow

                  C++NewBe wrote: I get the same Unhandle exception by placing it in OnInitDialog(). But how are you calling the SetWindowText() in there?


                  "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                  C Offline
                  C Offline
                  C NewBe
                  wrote on last edited by
                  #14

                  I'm calling it like this GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One");

                  D 1 Reply Last reply
                  0
                  • C C NewBe

                    I'm calling it like this GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One");

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #15

                    Which is incorrect. Remove the call to GetDlgItem().


                    "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                    C 1 Reply Last reply
                    0
                    • D David Crow

                      Which is incorrect. Remove the call to GetDlgItem().


                      "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                      C Offline
                      C Offline
                      C NewBe
                      wrote on last edited by
                      #16

                      David, It works on both ends, referencing the GetDlgItem was my problem. Thanks a lot....

                      D 1 Reply Last reply
                      0
                      • C C NewBe

                        David, It works on both ends, referencing the GetDlgItem was my problem. Thanks a lot....

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #17

                        C++NewBe wrote: It works on both ends... Both ends of what?


                        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                        C 1 Reply Last reply
                        0
                        • D David Crow

                          C++NewBe wrote: It works on both ends... Both ends of what?


                          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                          C Offline
                          C Offline
                          C NewBe
                          wrote on last edited by
                          #18

                          never mind

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups