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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to change title of a child dialog?

how to change title of a child dialog?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
18 Posts 7 Posters 1 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.
  • R Rajesh R Subramanian

    Chandrasekharanp wrote:

    u can use SetWindowText().

    You cannot use SMS language here, please. :)

    It is a crappy thing, but it's life -^ Carlo Pallini

    P Offline
    P Offline
    puppya
    wrote on last edited by
    #7

    it is not working coz i will have to refer to child window first. how can i refer to child window? i hv implmented as: IRCNewSim* ptr1=NULL; Markcorr* ptr2=NULL; ptr1=(IRCNewSim*)AfxGetApp()->m_pMainWnd; ptr2=(Markcorr*)ptr1->GetActiveWindow(); ptr2->SetWindowText("Tower1 Scanner1"); thanks

    H 1 Reply Last reply
    0
    • CPalliniC CPallini

      u r -> sir, plz plz u don't blame... :-D It looks like the sms language is appreciated by the OP [^]. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      modified on Tuesday, December 2, 2008 4:39 AM

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #8

      CPallini wrote:

      It looks like the sms language is appreciated by the OP [^].

      Indeed! I will never feel like answering these SMS questions. May be I'll send the reply via an SMS inztd. :laugh:

      It is a crappy thing, but it's life -^ Carlo Pallini

      1 Reply Last reply
      0
      • P puppya

        it is not working coz i will have to refer to child window first. how can i refer to child window? i hv implmented as: IRCNewSim* ptr1=NULL; Markcorr* ptr2=NULL; ptr1=(IRCNewSim*)AfxGetApp()->m_pMainWnd; ptr2=(Markcorr*)ptr1->GetActiveWindow(); ptr2->SetWindowText("Tower1 Scanner1"); thanks

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #9

        Waht was return value of SetWindowText?

        P 1 Reply Last reply
        0
        • H Hamid Taebi

          Waht was return value of SetWindowText?

          P Offline
          P Offline
          puppya
          wrote on last edited by
          #10

          appl is getting crashed and control is going into Setwindowtext void CWnd::SetWindowText(LPCTSTR lpszString) { ASSERT(::IsWindow(m_hWnd)); if (m_pCtrlSite == NULL) ::SetWindowText(m_hWnd, lpszString); else m_pCtrlSite->SetWindowText(lpszString); } m_hwnd is showing as NULL

          H 1 Reply Last reply
          0
          • P puppya

            appl is getting crashed and control is going into Setwindowtext void CWnd::SetWindowText(LPCTSTR lpszString) { ASSERT(::IsWindow(m_hWnd)); if (m_pCtrlSite == NULL) ::SetWindowText(m_hWnd, lpszString); else m_pCtrlSite->SetWindowText(lpszString); } m_hwnd is showing as NULL

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #11

            So I think your problem is of hwnd ptr2.

            P 1 Reply Last reply
            0
            • H Hamid Taebi

              So I think your problem is of hwnd ptr2.

              P Offline
              P Offline
              puppya
              wrote on last edited by
              #12

              ok... do u hv any other suggetion abt how can i implement this by some other method? or can u give me some demo of this type of application? i will b very much greatful to u

              H 1 Reply Last reply
              0
              • P puppya

                i have a dialog based appication. when i click on a button on a dialog(1st dialog), it will open 1 dialog(2nd dialog) and when i click on button on this dialog(2nd dialog) another dialog box(3rd dialog) will get opened and i want to change title of this dialog(3rd dialog). thanks in advance

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #13

                Are you wanting to set the window text of the 3rd dialog dynamically? In that case, you could pass it as a parameter to the constructor of the 3rd dialog class and have a string member variable initialized with that value and then call SetWindowText() in InitDialog(). That sounds viable?

                It is a crappy thing, but it's life -^ Carlo Pallini

                P 1 Reply Last reply
                0
                • P puppya

                  ok... do u hv any other suggetion abt how can i implement this by some other method? or can u give me some demo of this type of application? i will b very much greatful to u

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #14

                  How did you create your child dialog?

                  P 1 Reply Last reply
                  0
                  • P puppya

                    i have a dialog based appication. when i click on a button on a dialog(1st dialog), it will open 1 dialog(2nd dialog) and when i click on button on this dialog(2nd dialog) another dialog box(3rd dialog) will get opened and i want to change title of this dialog(3rd dialog). thanks in advance

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

                    Anjali Patil wrote:

                    ...i want to change title of this dialog(3rd dialog).

                    Call SetWindowText() from within its OnInitDialog() method.

                    "Love people and use things, not love things and use people." - Unknown

                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                    1 Reply Last reply
                    0
                    • C Chandrasekharan P

                      That was not intentional

                      A Offline
                      A Offline
                      A_xin
                      wrote on last edited by
                      #16

                      void CFdView::OnDraw(CDC* pDC) { CFdDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here this->GetDocument()->SetTitle("your title"); }

                      1 Reply Last reply
                      0
                      • H Hamid Taebi

                        How did you create your child dialog?

                        P Offline
                        P Offline
                        puppya
                        wrote on last edited by
                        #17

                        child dialog means after clicking on button i will display 1 more dialog. i want to change title of this dialog at run time.

                        1 Reply Last reply
                        0
                        • R Rajesh R Subramanian

                          Are you wanting to set the window text of the 3rd dialog dynamically? In that case, you could pass it as a parameter to the constructor of the 3rd dialog class and have a string member variable initialized with that value and then call SetWindowText() in InitDialog(). That sounds viable?

                          It is a crappy thing, but it's life -^ Carlo Pallini

                          P Offline
                          P Offline
                          puppya
                          wrote on last edited by
                          #18

                          thanks Rajesh it is working now.

                          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