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 get the title of CPropertyPage ?

How to get the title of CPropertyPage ?

Scheduled Pinned Locked Moved C / C++ / MFC
comdebuggingtutorialquestion
5 Posts 3 Posters 29 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.
  • E Offline
    E Offline
    Eugene Pustovoyt
    wrote on last edited by
    #1

    How to get the title of CPropertyPage before create CPropertySheet: CPropertyPage somePage; CPropertySheet m_sheet; TRACE(_T("Adding page '%'\n"), somePage.GetTitle()); m_sheet.AddPage(&somePage); ... m_sheet.Create(....);

    Eugene Pustovoyt Soft and Hard Developer CPPMessageBox v1.0 CPPToolTip v2.1 CPPDumpCtrl v1.2 CPPHtmlStatic v1.2

    V 1 Reply Last reply
    0
    • E Eugene Pustovoyt

      How to get the title of CPropertyPage before create CPropertySheet: CPropertyPage somePage; CPropertySheet m_sheet; TRACE(_T("Adding page '%'\n"), somePage.GetTitle()); m_sheet.AddPage(&somePage); ... m_sheet.Create(....);

      Eugene Pustovoyt Soft and Hard Developer CPPMessageBox v1.0 CPPToolTip v2.1 CPPDumpCtrl v1.2 CPPHtmlStatic v1.2

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      You cannot get title because you didn't set it. Use overloaded CPropertyPage ctor that accepts the caption Id parameter. If the string with this caption Id exists then it will be stored in the PROPSHEETPAGE m_pPSP structure (in its LPTSTR m_psp.pszTitle member) that is the member of the CPropertyPage class. Then you could do:

      CString title = somePage.GetPSP().pszTitle;

      E 1 Reply Last reply
      0
      • V Victor Nijegorodov

        You cannot get title because you didn't set it. Use overloaded CPropertyPage ctor that accepts the caption Id parameter. If the string with this caption Id exists then it will be stored in the PROPSHEETPAGE m_pPSP structure (in its LPTSTR m_psp.pszTitle member) that is the member of the CPropertyPage class. Then you could do:

        CString title = somePage.GetPSP().pszTitle;

        E Offline
        E Offline
        Eugene Pustovoyt
        wrote on last edited by
        #3

        This doesn't work because this structure will only become valid after the CPropertyPage is created, not before. Before creation pszTitle is empty

        Eugene Pustovoyt Soft and Hard Developer CPPMessageBox v1.0 CPPToolTip v2.1 CPPDumpCtrl v1.2 CPPHtmlStatic v1.2

        V D 2 Replies Last reply
        0
        • E Eugene Pustovoyt

          This doesn't work because this structure will only become valid after the CPropertyPage is created, not before. Before creation pszTitle is empty

          Eugene Pustovoyt Soft and Hard Developer CPPMessageBox v1.0 CPPToolTip v2.1 CPPDumpCtrl v1.2 CPPHtmlStatic v1.2

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          This code works as expected:

          CPropertyPage myPage(IDD_PROPPAGE_SMALL, IDS_STRING_CAPTION);
          text.Format(_T("Property page title:\t%s"), myPage.GetPSP().pszTitle);
          AfxMessageBox(text);

          where IDD_PROPPAGE_SMALL - property page dialog template, IDS_STRING_CAPTION - string resource with the text "My Property page Title" Messagebox shows the text "My Property page Title". :cool:

          1 Reply Last reply
          0
          • E Eugene Pustovoyt

            This doesn't work because this structure will only become valid after the CPropertyPage is created, not before. Before creation pszTitle is empty

            Eugene Pustovoyt Soft and Hard Developer CPPMessageBox v1.0 CPPToolTip v2.1 CPPDumpCtrl v1.2 CPPHtmlStatic v1.2

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

            The CPropertyPage object is created during its construction, not when it is added to the sheet. Since you constructed it without a title, a title you cannot retrieve.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            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