DoModal() results in an abrupt close of my application
Hi there,
I am in the trouble of CPropertySheet's domodal which result in an
sudden close of my application. What I get confused is that this
happens when my application has another modal dialog open. If my
application has another modeless dialog open, the trouble is gone. I am
wondering if the existing modal dialog took sth. so that the
CPropertySheet dialog cannot go further with DoModal?
I stepped into the code and found that the failure started from the MFC
inside code as below. LockResource always returns null to me so that
exception is thown out.
CPropertyPage::PreProcessPageTemplate(PROPSHEETPAGE& psp, BOOL
bWizard)
{
const DLGTEMPLATE* pTemplate;
if (psp.dwFlags & PSP_DLGINDIRECT)
{
pTemplate = psp.pResource;
}
else
{
HRSRC hResource = ::FindResource(psp.hInstance,
psp.pszTemplate, RT_DIALOG);
HGLOBAL hTemplate = LoadResource(psp.hInstance,
hResource);
pTemplate = (LPCDLGTEMPLATE)LockResource(hTemplate);
}
ASSERT(pTemplate != NULL); // < THIS IS THE LINE THAT ASSERTS
Any suggestions are welcome!
lvcha