Dynamically change the tab labels in a CPropertySheet

2.3k views Asked by At

I want to instantiate 2 property pages from the same class and template, because the settings they show are basically the same.

CCPUSettingsSheet sheet;
CCPUSettingsPage cpucore1, cpucore2;
sheet.AddPage(&cpucore1);
sheet.AddPage(&cpucore2);

The only problem is that they get the same tab label text, which is the caption field in their resource template. I need to assign a different text to each one, however.

1

There are 1 answers

0
Frédéric Hamidi On BEST ANSWER

Assuming CCPUSettingsPage derives from CPropertyPage, you can use its public m_psp member to access its underlying PROPSHEETPAGE structure. From there, you can write something like:

cpucore1.m_psp.dwFlags |= PSP_USETITLE;
cpucore1.m_psp.pszTitle = "First Tab";

cpucore2.m_psp.dwFlags |= PSP_USETITLE;
cpucore2.m_psp.pszTitle = "Second Tab";