Re: Reply needed urgently (PropertySheet and PropertyPages) ...!
There is no way you will be able to do that. CPropertyPage and
CPropertySheet are MFC classes, where CPropertySheet manipulates instance of
CPropertyPage items, it doesn't care or know about any of the pages HWND.
Things might become more apparent if look at the implementation of
CPropertySheet::AddPage
Why is it that you want to do this?
and by the way
if you have this:
WizSheet* wizard = new WizSheet ( );
then your add page call should be like this
wizard->AddPage (page);
Normally you would simply declare the variable on the stack:
WizSheet wizard;
wizard.DoModal();
More things to point out is that if you care your pages like this
WizardPage* page = new WizardPage ( );
you will end up with alot of memory leaks as the PropertySheet never takes
ownership of the property pages and therefore never deletes them, so you
will have to delete them.
Normally the way propertysheets are used is that you should derive a class
CPropetySheet and as many classes from CPropertyPage. The pages are
normally declared as data members of the CPropertySheet derived class, and
get added during the constructor.
class CMySheet : public CPropertySheet
{
public:
CMySheet(UINT nIDCaption,.....);
CMySheet(LPCTSTR pszCaption,.......);
private:
CFirstPage m_Page1;
CSecondPage m_Page2;
CFinalPage m_Page3;
void AddPages();
};
CMySheet::CMySheet(UINT nIDCaption,.....)
:CPropertySheet(....)
{
AddPages();
}
CMySheet::CMySheet(LPCTSTR pszCaption,.......)
:CPropertySheet(....)
{
AddPages();
}
void CMySheet::AddPages()
{
AddPage(&m_Page1);
AddPage(&m_Page2);
AddPage(&m_Page3);
}
AliR.
<jai.reddylm@gmail.com> wrote in message
news:9934024d-ff9b-4c2e-afc7-35576584ca0a@e25g2000prg.googlegroups.com...
Hello,
I have a class derived from CPropertySheet, say WizSheet.
I will create an instance of this class as below.
WizSheet* wizard = new WizSheet ( );
To the above propertysheet, I can add pages normally as below:
WizardPage* page = new WizardPage ( );
wizard.AddPage (page);
But I want to add pages to the above sheet using the handle of it.
To get handle of the above sheet, I can use the below statement.
HWND hwnd = wizard.GetSafeHwnd ( );
By using the above handle of propertysheet, how can I add a property
page to it.
Any suggestions will be of great help to me.
Jay.