Print Page | Close Window

help me to solve exception error.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1683
Printed Date: 05 March 2025 at 10:19pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: help me to solve exception error.
Posted By: vpas
Subject: help me to solve exception error.
Date Posted: 19 January 2005 at 9:41pm

hi , everyone. nice day.

when press the button of pane that i make to control toolbar, toolbar hide or show nicely.

But...when the application close, occur exception error in dbgheap.c

How i make.

1. i make pane of dialog and make button to hide or show toolbar.

 CXTPToolBar* pToolBar2    <= CMainFrm.h declaration
  pToolBar2 = NULL; 

2. add in CMainFrame::OnCreate

 pToolBar2 = (CXTPToolBar*)pCommandBars->Add(_T("Standard2"), xtpBarTop);

// .... //

3. int CMainFrame::ValidToolBar(void)
{
     if(pToolBar2->IsVisible())
    {
        pToolBar2->SetVisible(FALSE); AfxMessageBox(" hide toolbar2~ ^^ ");
    }
    else 
    {
        pToolBar2->SetVisible(TRUE); AfxMessageBox(" show toolbar2~ ^^ ");
    }

 return 0;
}

4. button of pane that i make.

void CNavigationView::OnBnClickedOk()
{
 CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd();

 pMainFrame->ValidToolBar();
}

i have hardly been try to solve, but i dont know.

if did you want source, i  would send. leave email.

Um... i used .Net C++ in Win 2000.

why occur exception error? Um... help me.




Replies:
Posted By: Oleg
Date Posted: 20 January 2005 at 1:42am

It can happens if you Save State in OnDestroy instead of OnClose.

Show me how you save it.



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


Posted By: vpas
Date Posted: 20 January 2005 at 5:24am

hello, thanks a lot.

i didn't use OnDestroy and use OnClose.

void CMainFrame::OnClose()
{

// Save the current state for toolbars and menus.
    SaveCommandBars(_T("CommandBars"));

    // Save the current state for docking panes.
    CXTPDockingPaneLayout layoutNormal(&m_paneManager);
    m_paneManager.GetLayout(&layoutNormal);
    layoutNormal.Save(_T("NormalLayout"));

 CMDIFrameWnd::OnClose();

}

The main points may be summarized as follows.

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    // i use "pToolBar2" instead of "CXTPToolBar* pToolBar2"
    pToolBar2 = (CXTPToolBar*)pCommandBars->Add(_T("Standard2"), xtpBarTop);
    if (!pToolBar2 || !pToolBar2->LoadToolBar(IDR_TOOLBAR2))
    {
        TRACE0("Failed to create toolbar2\n");
        return -1;
    }
}

so, before that,

class CMainFrame : public CXTPMDIFrameWnd
{
 protected: 
  CXTPToolBar* pToolBar2;   // declaration.
}
and,

CMainFrame::CMainFrame()
{
 pToolBar2 = NULL;
}

used as above.

1. when using commonly "CXTPToolBar* pToolBar2" in OnCreate() and application end , error is not occur.
2. But... when using as above code and application end , error message  occured with debbuging window.




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