CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Problem with a CPropertyPage object

  1. #1
    Join Date
    Apr 2000
    Location
    Austria
    Posts
    267

    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!






  2. #2
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573

    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

  3. #3
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573

    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

  4. #4
    Join Date
    Apr 2000
    Location
    Austria
    Posts
    267

    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!


  5. #5
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573

    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

  6. #6
    Join Date
    Apr 2000
    Location
    Austria
    Posts
    267

    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!



  7. #7
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573

    Re: Problem with a CPropertyPage object

    One moreCPropertySheet dlgPropertySheet(MAKEINTRESOURCE(AFX_IDS_APP_TITLE));



    Regards,

    Emi.
    Regards,

    Emanuel Vaduva

  8. #8
    Join Date
    Apr 2000
    Location
    Austria
    Posts
    267

    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);
    }





  9. #9
    Join Date
    Feb 2000
    Location
    Rennes, France
    Posts
    624

    Arrow 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!

  10. #10
    Join Date
    Feb 2000
    Location
    Rennes, France
    Posts
    624

    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!

  11. #11
    Join Date
    May 1999
    Location
    DELAWARE, USA
    Posts
    9,917

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)