leon123

I want to add dialog(not CPropertyPage) into propertysheet. Is it possible And how to make it.

Thanks!!



Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

PareshC

Have you refered this

Regards,

Paresh.





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

Pintu Shukla

Then What's the Problem here is a Something from MSDN.

Even though CPropertySheet is not derived from CDialog, managing a CPropertySheet object is similar to managing a CDialog object. For example, creation of a property sheet requires two-part construction: call the constructor, and then call DoModal for a modal property sheet or Create for a modeless property sheet.

Thanx






Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

leon123

PareshC
Thanks. I know CPropertyPage can make it, but I want that CDialog could be added like CPropertyPage into PropertySheet.

Pintu

Excuse me. I don't understand why you post part of description from MSDN. I know "CPropertySheet is not derived from CDialog" and I can't find any parameters in constructor would be helpful for me.

I show part of my code

In .h file

CPropertySheet m_sheet;
CSmallDlg m_dlg; ( CSmallDlg is derived from CDialog)

In .cpp ( )

BOOL CPropertySheetTestDlg:SurprisenInitDialog()
{

.

m_sheet.AddPage((CPropertyPage*)&m_dlg);
m_sheet.Create(this,WS_CHILD|WS_VISIBLE,0);

.

.

}

It will crash in "m_sheet.AddPage((CPropertyPage*)&m_dlg);" because of

void CPropertySheet::AddPage(CPropertyPage* pPage)
{

.
ASSERT_KINDOF(CPropertyPage, pPage); <-- this
.

}

Is it possible to make it





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

PareshC

Why are you want only CDialog, though the CPropertyPage is derived from CDialog.

Regards,

Paresh.





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

leon123

I want to make a container with propertysheet, but import dialog may be a CDialog dialog. And the dialog is created by other programers, I can't limit them to use CPropertyPage only.

Thanks!





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

Simple Samples

I am not sure I understand what a "CDialog dialog" is. There is nothing specific that makes a dialog resource a CDialog dialog.






Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

leon123

Sorry, "CDialog dialog" means a dialog that is derived from CDialog. CPropertysheet objects can only add CPropertypage objects, I want to add CDialog object into propertysheet.





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

Simple Samples

It is highly unlikely you need to do that, and it is likely there is an easier way. If you need to do that, then you have not made it clear why. Probably no one has done what you think you need to do and since it seems unlikely you need to, most people are not going to spend time figuring out how to do it.

As best as I understand what you need to do, it seems to me that you need to understand better the previous suggestions. I get the feeling that you did not try to understand my previous reply.

You can continue to try to do it the way you think you need to, but it is probably difficult for anyone to help. Usually people should do the best they can to help others do whatever they need to do in whatever way they want to, but for this, it will likely take time for anyone to figure out how to do it. Since it seems likely there is an easier way, most developers will just advise you to use a property page instead of a dialog.






Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

leon123

Thank you for your reply. I will take your suggestion and discuss with my boss. Thanks again.





Re: Visual C++ General MFC-How to add CDialog into CPropertySheet

Simple Samples

Good.

I hope I am helping; I really do want to help.

If the CDialog is a class derived from CDialog and there is a h and a cpp file, then that might be difficult to use. If however it is just a dialog resource, then the dialog resource can be used as a property page.

Property sheets are more modern versions of tab controls. If you need a tab control instead, then see my Creating Tab Controls Using CTabCtrl simple sample, but property sheets are easier and more flexible, but I don't know what the specific advantages are.