Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - help me to solve exception error.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

help me to solve exception error.

 Post Reply Post Reply
Author
Message Reverse Sort Order
vpas View Drop Down
Newbie
Newbie


Joined: 19 January 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote vpas Quote  Post ReplyReply Direct Link To This Post Topic: help me to solve exception error.
    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.



Edited by vpas
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
vpas View Drop Down
Newbie
Newbie


Joined: 19 January 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote vpas Quote  Post ReplyReply Direct Link To This Post 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.



Edited by vpas
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.