I am trying to add a CPropertySheet with three CPropertyPages to my MFC application. My problem is that the Property sheet only shows for less than a second then closes. When I open a different modal dialog after creating the CPropertySheet, the CPropertySheet stays open and I can use it with no problems. Here is my code:
BOOL CSLIMOptCplusplusApp::InitInstance()
{
CWinApp::InitInstance();
SQLHENV m_1;
EnvGetHandle(m_1);
Login lgn;
lgn.DoModal();
CImageSheet* imagedlg = new CImageSheet("Image Capture Dialog" );
CImageDisplay* pageImageDisplay = new CImageDisplay;
CImageDimensions* pageImageDimensions = new CImageDimensions;
ListOption* pageListOption = new ListOption;
ASSERT( imagedlg );
ASSERT( pageImageDisplay );
ASSERT( pageImageDimensions );
ASSERT( pageListOption );
imagedlg->AddPage( pageListOption);
imagedlg->AddPage( pageImageDimensions );
imagedlg->AddPage( pageImageDisplay );
imagedlg->Create( NULL,
-1,
WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW );
imagedlg->ShowWindow( SW_SHOW );
I think my problem may be at imagedlg->Create(
when I use NULL
as the first parameter. The tutorial I was following used this
in place of the NULL
. However, that gives the error:
IntelliSense: argument of type "CSLIMOptCplusplusApp *" is incompatible with parameter of type "CWnd *"
I also tried imagedlg->Create();
and it also only flashes for a moment.
I would like my CPropertySheet to stay open until it is closed. Thanks for any help!
EDIT:
Here is an image of what I wish my property sheet to look like. My first tab used a ListControl to change database options, the other two tabs are going to do other things. My intent is to keep the dialog/propertysheet looking the same as it does now, but to stay open instead of closing.