Print Page | Close Window

error

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=12577
Printed Date: 23 June 2025 at 3:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: error
Posted By: jimmy
Subject: error
Date Posted: 31 October 2008 at 7:51am
Hello,

i've follow code.
    CXTPDockingPaneTabbedContainer* pContainer = GetParentContainer(pWnd);
    if (pContainer && pContainer->GetPanes().GetCount() > 1)
        {
        CXTPDockingPane* pSelected = dynamic_cast<CXTPDockingPane*>(pContainer->GetPanes().GetHead());

after dynamic cast i get error
Eine Ausnahme (erste Chance) bei 0x10227827 (msvcr71d.dll) in Lasal2.exe: 0xC0000005: Zugriffsverletzung-Leseposition 0x00000004.
Eine Ausnahme (erste Chance) bei 0x7c812aeb (kernel32.dll) in Lasal2.exe: Microsoft C++ exception: __non_rtti_object @ 0x0012f20c.

Why ?
corrupt rtti info ?

  Jimmy




Replies:
Posted By: Oleg
Date Posted: 31 October 2008 at 9:03am

Hi,

Show GetParentContainer code.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jimmy
Date Posted: 31 October 2008 at 9:16am
Hi Oleg,

CXTPDockingPaneTabbedContainer *GetParentContainer(CWnd* pParentWnd)
{
    if (pParentWnd == NULL || pParentWnd->GetSafeHwnd() == NULL) // no Window attached
        return NULL;

    while (pParentWnd != NULL)
    {
        CXTPDockingPaneTabbedContainer *pContainer = DYNAMIC_DOWNCAST(CXTPDockingPaneTabbedContainer, pParentWnd);
        if (pContainer)
            return pContainer;
        pParentWnd = pParentWnd->GetParent();
    }
    return NULL;
}

  Jimmy




Posted By: jimmy
Date Posted: 31 October 2008 at 9:21am
Hi Oleg,

After i add this, it will be work.

class CExXTPDockingPane : public CXTPDockingPane
{
public:
    CExXTPDockingPane(CXTPDockingPaneLayout* pLayout) : CXTPDockingPane(pLayout)
    { }
};

class CExDockingPaneManager : public CXTPDockingPaneManager
{
public:
    CXTPDockingPaneLayout *GetLayoutCurrent()        { return m_pLayout; }

    virtual CXTPDockingPaneBase *OnCreatePane(XTPDockingPaneType type, CXTPDockingPaneLayout* pLayout)
    {
        if (type == xtpPaneTypeDockingPane)
        {
            return new CExXTPDockingPane(pLayout);
        }
        return __super::OnCreatePane(type, pLayout);
    }
};

  Jimmy



Posted By: jimmy
Date Posted: 31 October 2008 at 9:33am
Hi Oleg,

i see rtti is not activated in Tookit DLL.
Think, this is the problem.

  Jimmy



Posted By: Oleg
Date Posted: 31 October 2008 at 12:49pm
Hi,
 
You can use C style cast. CXTPDockingPaneTabbedContainer always has only CXTPDockingPane:
 
CXTPDockingPane* pSelected = (CXTPDockingPane*)pContainer->GetPanes().GetHead());
or if you need selected:
 
CXTPDockingPane* pSelected = pContainer->GetSelected()


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jimmy
Date Posted: 03 November 2008 at 4:25am
Thanks Oleg.

  Jimmy




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net