|
-
January 31st, 2001, 03:24 AM
#1
Problem with a CPropertyPage object
Hello I have a big problem with dialog. I construct the dialog then I use CPropertyPage
CameraSetup pCameraSetup = new CCameraSetup[MAX_CAMS];
UINT rgID[MAX_CAMS] = {IDS_CAMERA1, IDS_CAMERA2};
CPropertySheet dlgPropertySheet(AFX_IDS_APP_TITLE);
dlgPropertySheet.AddPage(&pCameraSetup[0]);
dlgPropertySheet.AddPage(&pCameraSetup[1]);
for (ULONG i = 1; i <= MAX_CAMS; i++)
{
pCameraSetup[i-1].Construct(rgID[i-1]);
}
dlgPropertySheet.DoModal();
definition of the CCameraSetup:
class CCameraSetup : public CPropertyPage;
By doing DoModal I receive always an Debug Assertion failed in dlgprop.cpp in line 201.
This is the section:
void 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); --->Error
This is happen only when I will give to my Tabs a name (in this case with Construct(..)).
Can anyone help me??
Thanks a lot!
-
January 31st, 2001, 03:39 AM
#2
Re: Problem with a CPropertyPage object
Hi,
Change your code with thisfor (ULONG i = 0; i < MAX_CAMS; i++)
{
pCameraSetup[ i ].Construct(rgID[ i ]);
}
Regards,
Emi.
Regards,
Emanuel Vaduva
-
January 31st, 2001, 03:42 AM
#3
Re: Problem with a CPropertyPage object
Sorry it's the same...
Where do you receive the assertion in your program? At wich line in that code?
Regards,
Emi.
Regards,
Emanuel Vaduva
-
January 31st, 2001, 03:53 AM
#4
Re: Problem with a CPropertyPage object
I receive the asertion when I do DoModal(). Then inside the function PreProcessPageTemplate(...) there is the problem that pTemplate is NULL.
I hope this is the information that you need.
Thanks for your help!
-
January 31st, 2001, 03:59 AM
#5
Re: Problem with a CPropertyPage object
CPropertySheet dlgPropertySheet(AFX_IDS_APP_TITLE);
This (AFX_IDS_APP_TITLE) is your caption ID property?
Try withCPropertySheet dlgPropertySheet("my property sheet");
and see what it happens.
Regards,
Emi.
Regards,
Emanuel Vaduva
-
January 31st, 2001, 04:16 AM
#6
Re: Problem with a CPropertyPage object
It is the name of the tab-dilog box.
I have tested with "my property sheet" and it is happen the same thing.
Thanks a lot!
-
January 31st, 2001, 04:36 AM
#7
Re: Problem with a CPropertyPage object
One moreCPropertySheet dlgPropertySheet(MAKEINTRESOURCE(AFX_IDS_APP_TITLE));
Regards,
Emi.
Regards,
Emanuel Vaduva
-
January 31st, 2001, 04:53 AM
#8
Re: Problem with a CPropertyPage object
Now I receive a Debug assertion error already into to line with CPropertySheet dlgPropertySheet(...)
(file strcore.cpp, line 344)
CPropertySheet::CPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd,
UINT iSelectPage)
{
ASSERT(pszCaption != NULL);
m_strCaption = pszCaption; ----> here is happend (pszCaption is a NULL pointer
CommonConstruct(pParentWnd, iSelectPage);
}
-
June 14th, 2005, 08:41 AM
#9
Re: Problem with a CPropertyPage object
Did you get any solution now?? (ok that was 5 years ago)
I have the same first problem, but trying to use modeless Property Sheet.
One of my page causes this assertion failure... pTemplate is NULL. I don't understand why.
I transformed a Dialog box into a CPropertypage derived class. I changed the properties of the Dialog box to Child window, disabled, and thin border.
Should I change more than that?? all code that was CDialog:: is now CPropertyPage::
Marina
Last edited by Marina Vaillant; June 14th, 2005 at 09:32 AM.
Please go vote for your country!
-
June 14th, 2005, 10:41 AM
#10
Re: Problem with a CPropertyPage object
My problem was solved :
When transforming my CDialog into a CPropertyPage, I forgot to change the page constructor.
Marina
Please go vote for your country!
-
June 14th, 2005, 12:11 PM
#11
Re: Problem with a CPropertyPage object
Hansi,
Property page Construct member takes property page dialog template as first parameter (either UINT or pointer to a string).
It is unclear from your code what exactly you are doing.
If you create array of the property pages, of the same class type, I assume that this class is based on one property page dialog template.
In call to Construct, you are passing different IDs for property page template. That is where I do not see consistency.
Most likely you are passing ID of the template that does not exist, ergo assert.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|