xxtigerxx
asked on
CPropertySheet::DoModal() Causes an Exception!!!!!!!!
i want to use propertysheet to implement a tabcontrol..
my code is
CPropertySheet dlgPropertySheet("Tab");
CD1 stylePage;
CD2 colorPage;
dlgPropertySheet.AddPage(& stylePage) ;
dlgPropertySheet.AddPage(& colorPage) ;
if (dlgPropertySheet.DoModal( ) == IDOK)
{
}
this cause an exception!!!!!!!!!
First-chance exception in temp.exe: 0xC0000005: Access Violation
i tryied try-catch but nothing.........
try
{
if (0 == dlgPropertySheet.DoModal() )
throw "DoModal() failed!";
}
catch(char * str)
{
TRACE ("Exception thrown: %s\n", str);
}
my code is
CPropertySheet dlgPropertySheet("Tab");
CD1 stylePage;
CD2 colorPage;
dlgPropertySheet.AddPage(&
dlgPropertySheet.AddPage(&
if (dlgPropertySheet.DoModal(
{
}
this cause an exception!!!!!!!!!
First-chance exception in temp.exe: 0xC0000005: Access Violation
i tryied try-catch but nothing.........
try
{
if (0 == dlgPropertySheet.DoModal()
throw "DoModal() failed!";
}
catch(char * str)
{
TRACE ("Exception thrown: %s\n", str);
}
Hmmm try something like this
CPropertySheet* psheet = new CPropertySheet();
psheet->AddPage(&<var>);
psheet->AddPage(&<var>);
psheet->Create(this, WS_CHILD | WS_VISIBLE, 0);
psheet->ModifyStyleEx(0, WS_EX_CONTROLPARENT);
psheet->ModifyStyle(0, WS_TABSTOP);
CRect rect;
GetDlgItem(IDC_PROPSHEET)- >GetWindow Rect(&rect );
ScreenToClient(&rect);
psheet->SetWindowPos(NULL, rect.left+32, rect.top-15,
0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
IDC_PROPSHEET is a static control rectangle that you define in the resource file that you use as a container to put the property pages in.
CPropertySheet* psheet = new CPropertySheet();
psheet->AddPage(&<var>);
psheet->AddPage(&<var>);
psheet->Create(this, WS_CHILD | WS_VISIBLE, 0);
psheet->ModifyStyleEx(0, WS_EX_CONTROLPARENT);
psheet->ModifyStyle(0, WS_TABSTOP);
CRect rect;
GetDlgItem(IDC_PROPSHEET)-
ScreenToClient(&rect);
psheet->SetWindowPos(NULL,
0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
IDC_PROPSHEET is a static control rectangle that you define in the resource file that you use as a container to put the property pages in.
oh yea place that in your OnInitDialog() of your CDlg class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello VinExpert,
My project is a SDI ( Like Expoler ) ( tree / listcontrol)
But as i say before the program crashes the secod time after you run it and close the window.
Even the msdn samples crashes like Propdlg.
I have WinME.
Hello gravteck,
The program crashes when the pages have some controls...
THX.
This may be silly to ask, but are you sure the error is because of the property page tab creations, or is it in the property pages themeselves? Are you handling anything on these specific pages that have to do w/ property page events?
ASKER
hi qravteck..
no i am sure..
but with the above code the program in runnung thx for your help
no i am sure..
but with the above code the program in runnung thx for your help
To all experts,
xxtigerxx has requested that this question be closed.
https://www.experts-exchange.com/questions/20640182/The-wuestion-that-i-asked-was-answered-by-me.html
I will close the question, refund 120 points to xxtigerxx, and PAQ the question.
Best regards,
YensidMod
EE Moderator
xxtigerxx has requested that this question be closed.
https://www.experts-exchange.com/questions/20640182/The-wuestion-that-i-asked-was-answered-by-me.html
I will close the question, refund 120 points to xxtigerxx, and PAQ the question.
Best regards,
YensidMod
EE Moderator
I just tried ur code and it is working fine for me. When it crashes, where it points to in ur code? Property sheet and tab control are different.
Give us some more details like, what kind of project? SDI, Dialog, MDI? How u r trying to pop up property sheet etc. That may help us in solving ur prob.
VinExpert