How to get the title of CPropertyPage ?
-
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
-
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
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;
-
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;
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
-
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
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:
-
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
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