Set title text of CPropertyPage in wizard at runtime

Ah hello.

I have a wizard based on CPropertyPage.  The pages of my app look very similar to that shown at

http://www.codeproject.com/property/Conquering_Wizard97/Fig-5b.jpg

Now, if you look at this image, you will see it has the text "Title" and "Sub Title".  This has been set up in the constructor like so

CSecondPage::CSecondPage()
    : CPropertyPage(CSecondPage::IDD)
{
    m_psp.dwFlags |= PSP_DEFAULT|PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
    m_psp.pszHeaderTitle = _T("Title");
    m_psp.pszHeaderSubTitle = _T("And subtitle");
}

Now, the simple question: I need to be able to change this text at runtime, but cannot see at all a method of allowing me to do so.

Does anyone know how ?

TIA
LVL 19
mrwad99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
The only way I can think of would be to iterate through the child controls of the sheet, find the one with the text you want to replace and then replace that window text with the new text.

(Not tried it so it may not function correctly)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITSpgrmrCommented:
I would do something like adding a function to CSecondPage to set the Header.  Like this(the same for pszHeaderSubTitle) :
void CSecondPage::ChangeHeader(LPSTR pNewHeader)
{
      m_psp.pszHeaderTitle = _T(pNewHeader);
}
 Then you can change the variable like this:
m_pgSecond.ChangeHeader("NewHeader");
0
mrwad99Author Commented:
ITSpgrmr

Thanks for posting.  However, if it was that easy, I would not need to post.  It appears that the m_psp structure is used somehow that I cannot find by tracing stepping into and out of my code.  Once it is set up in the constructor, whatever is reading the values from it is not being called to read them again.  This is why your suggestion does not work.

Andy

That is possible, but an outrageous hack ( ;0) ) that I would like to avoid if at all possible.

Does anyone know where the m_psp variable is read and used ?

Thanks.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

AndyAinscowFreelance programmer / ConsultantCommented:
I agree - hack (but if it works only a few lines of simple code).  Why the MFC doesn't seem to support it I can't quite understand.

m_psp usage - I think it is *only* used when the page is created.
0
mrwad99Author Commented:
Not what I was hoping for, but it will do.

Thanks Andy.
0
AndyAinscowFreelance programmer / ConsultantCommented:
Sometimes we have to be satisfied with what works ;-)
0
alexcohnCommented:
I am sorry to disappoint, but unfortunately the wizard page does not contain a child for the header and subheader. It's not a coincidence that these features depend on IE version installed: they are rendered via IE mechanisms, bypassing child windows.
0
mrwad99Author Commented:
Heh, quite an old question this one... thanks for the follow up though alexcohn!
0
alexcohnCommented:
I was looking for the solution, found this thread and saw that Andy suggested some way that I already had rejected. I have settled for brute-force approach: I create two STATIC controls on the PropertySheet surface, set the fonts and positions exactly as the Wizard does for header and subheader, and make sure they are drawn with transparent background.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.