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 CPropertyPage's Title

How to Change CPropertyPage's Title

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasetutorial
7 Posts 3 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.
  • Z Offline
    Z Offline
    zt9788
    wrote on last edited by
    #1

    How to Change CPropertyPage's Title i wrote the following code, however, the exception occurs in int index = m_sheet.GetPageIndex(this);//make a Exception Thanks //Main.h CPropertySheet m_sheet; CAboutDlg m_about; //Main.cpp ... m_sheet.AddPage(&m_about); m_sheet.Create(this, WS_CHILD|WS_VISIBLE,WS_EX_CONTROLPARENT); m_sheet.SetWindowPos(NULL, 4, 4,25, 50, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); .... //CAbout.cpp ... m_sheet = GetPrient(); CString szDlgName(_T("test")); TC_ITEM TabCtrlItem; TabCtrlItem.mask = TCIF_TEXT; TabCtrlItem.dwState = TCIS_BUTTONPRESSED; TabCtrlItem.pszText = buf; strcpy(TabCtrlItem.pszText,szDlgName); int index = m_sheet.GetPageIndex(this);//make a Exception // probably the m_sheet is null caused exception, why it is happened m_sheet.GetTabControl()->SetItem(index,&TabCtrlItem); ... hi -- modified at 1:26 Friday 19th May, 2006

    _ P 2 Replies Last reply
    0
    • Z zt9788

      How to Change CPropertyPage's Title i wrote the following code, however, the exception occurs in int index = m_sheet.GetPageIndex(this);//make a Exception Thanks //Main.h CPropertySheet m_sheet; CAboutDlg m_about; //Main.cpp ... m_sheet.AddPage(&m_about); m_sheet.Create(this, WS_CHILD|WS_VISIBLE,WS_EX_CONTROLPARENT); m_sheet.SetWindowPos(NULL, 4, 4,25, 50, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); .... //CAbout.cpp ... m_sheet = GetPrient(); CString szDlgName(_T("test")); TC_ITEM TabCtrlItem; TabCtrlItem.mask = TCIF_TEXT; TabCtrlItem.dwState = TCIS_BUTTONPRESSED; TabCtrlItem.pszText = buf; strcpy(TabCtrlItem.pszText,szDlgName); int index = m_sheet.GetPageIndex(this);//make a Exception // probably the m_sheet is null caused exception, why it is happened m_sheet.GetTabControl()->SetItem(index,&TabCtrlItem); ... hi -- modified at 1:26 Friday 19th May, 2006

      _ Offline
      _ Offline
      _anil_
      wrote on last edited by
      #2

      You can change the caption of the dialog to cahnge the title. in your case m_about.SetWindowText( "test" ); Regards Anil

      Z 1 Reply Last reply
      0
      • Z zt9788

        How to Change CPropertyPage's Title i wrote the following code, however, the exception occurs in int index = m_sheet.GetPageIndex(this);//make a Exception Thanks //Main.h CPropertySheet m_sheet; CAboutDlg m_about; //Main.cpp ... m_sheet.AddPage(&m_about); m_sheet.Create(this, WS_CHILD|WS_VISIBLE,WS_EX_CONTROLPARENT); m_sheet.SetWindowPos(NULL, 4, 4,25, 50, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); .... //CAbout.cpp ... m_sheet = GetPrient(); CString szDlgName(_T("test")); TC_ITEM TabCtrlItem; TabCtrlItem.mask = TCIF_TEXT; TabCtrlItem.dwState = TCIS_BUTTONPRESSED; TabCtrlItem.pszText = buf; strcpy(TabCtrlItem.pszText,szDlgName); int index = m_sheet.GetPageIndex(this);//make a Exception // probably the m_sheet is null caused exception, why it is happened m_sheet.GetTabControl()->SetItem(index,&TabCtrlItem); ... hi -- modified at 1:26 Friday 19th May, 2006

        P Offline
        P Offline
        Peter Weyzen
        wrote on last edited by
        #3

        It sounds to me that you are calling this function before the window has been created. The exception you get is probably about the hWnd being 0. From where are you calling this? What function? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc.](http://www.soonr.com)

        Z 1 Reply Last reply
        0
        • _ _anil_

          You can change the caption of the dialog to cahnge the title. in your case m_about.SetWindowText( "test" ); Regards Anil

          Z Offline
          Z Offline
          zt9788
          wrote on last edited by
          #4

          Thanks for you reply! but SetWindowText is not ok! CPropertySheet* pSheet = (CPropertySheet*)this->GetParent(); //Exception!!! //addition to the above code COptionDlg* dlg = (COptionDlg*)this->GetParentOwner(); TCHAR buf[MAX_PATH]; TC_ITEM TabCtrlItem; hi

          _ 1 Reply Last reply
          0
          • P Peter Weyzen

            It sounds to me that you are calling this function before the window has been created. The exception you get is probably about the hWnd being 0. From where are you calling this? What function? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc.](http://www.soonr.com)

            Z Offline
            Z Offline
            zt9788
            wrote on last edited by
            #5

            Thanks i call the function which to change CPropertypage's title,when i click the button in the CPropertypage(others)! Main.h CPropertySheet m_sheet; CAboutDlg m_about; Main.cpp BOOL COptionDlg::OnInitDialog() { ..... m_sheet.AddPage(&m_about); m_sheet.Create(this, WS_CHILD|WS_VISIBLE,WS_EX_CONTROLPARENT); m_sheet.SetWindowPos(NULL, 4, 4,25, 50, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); .... } CAbout.cpp //the CAboutDlg was Created void CAboutDlg::UpdateUI() { CPropertySheet* pSheet = (CPropertySheet*)GetParent();//Exception } hi

            1 Reply Last reply
            0
            • Z zt9788

              Thanks for you reply! but SetWindowText is not ok! CPropertySheet* pSheet = (CPropertySheet*)this->GetParent(); //Exception!!! //addition to the above code COptionDlg* dlg = (COptionDlg*)this->GetParentOwner(); TCHAR buf[MAX_PATH]; TC_ITEM TabCtrlItem; hi

              _ Offline
              _ Offline
              _anil_
              wrote on last edited by
              #6

              Just check if the CAboutDlg is derived from CDialog or CPropertyPage. It should be CPropertyPaeg and must have done CPropertyPage but I am just asking to check it once more. so we can think of other options. Regards Anil

              Z 1 Reply Last reply
              0
              • _ _anil_

                Just check if the CAboutDlg is derived from CDialog or CPropertyPage. It should be CPropertyPaeg and must have done CPropertyPage but I am just asking to check it once more. so we can think of other options. Regards Anil

                Z Offline
                Z Offline
                zt9788
                wrote on last edited by
                #7

                yes,my CAboutDlg is derved from CPropertyPage!! hi

                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