Print Page | Close Window

Cannot load CXTPMenuBar from archive

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=4277
Printed Date: 04 October 2024 at 1:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Cannot load CXTPMenuBar from archive
Posted By: bigeyes
Subject: Cannot load CXTPMenuBar from archive
Date Posted: 24 May 2006 at 11:29pm

Xtreme Toolkit Pro v9.60,   VC6 ,   win2000

I write an activex,import the xcb file to the resource,use LoadDesignerBars ,but there are exceptions.

xcb file is OK,i can load the file in another winapp project.

error info:

Warning: Cannot load CXTPMenuBar from archive.  Class not defined.
CArchive exception: badClass.
CXTPCommandBars::LoadCommandBarList. Archive exception

related code:

int WSDIFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;

 if (!InitCommandBars())
 {
  return -1;      // fail to create
 }

 return 0;
}

BOOL WSDIFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
 if (!CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
  return FALSE;

 GenerateCommandBars();

 return TRUE;
}

void WSDIFrame::GenerateCommandBars()
{
 CXTPCommandBars* pCommandBars = GetCommandBars();
 pCommandBars->SetMenu(_T("Menu Bar"), IDR_WHITEBOARD);

 HRSRC hRsrs = FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_FORM2), "RT_RCDATA");
 ASSERT(hRsrs);

 if (hRsrs)
 {
  HGLOBAL hGlobal = LoadResource(AfxGetInstanceHandle(), hRsrs);

  if (hGlobal)
  {
   DWORD dwSize = SizeofResource(AfxGetInstanceHandle(), hRsrs);
   LPVOID pData = LockResource(hGlobal);

   CMemFile file((BYTE*)pData, dwSize);
   CArchive ar(&file, CArchive::load | CArchive::bNoFlushOnDelete);
 
 
   // I checked here,CMemFile file has the same content as the input form2.xcb file.
   // so, the input of LoadDesignerBars should be OK
   
   pCommandBars->LoadDesignerBars(ar);
   
   //but there are some exception here.
   //debug info
   //  Warning: Cannot load CXTPMenuBar from archive.  Class not defined.
   //  CArchive exception: badClass.
   //  CXTPCommandBars::LoadCommand BarList. Archive exception   
  }
 }
}

BOOL WSDIFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
 //create some client panes
 //.....

 return TRUE;
}

BOOL WSDIFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if(!CFrameWnd::PreCreateWindow(cs))
  return FALSE;

 cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
 cs.dwExStyle  &=~WS_EX_WINDOWEDGE;
 cs.dwExStyle &=~WS_EX_DLGMODALFRAME;
 return TRUE;

}


//class WSDITemplate : public CSingleDocTemplate 
//here is how the WSDIFrame was created
CFrameWnd* WSDITemplate::CreateNewFrame(CDocument* pDoc,
        CFrameWnd* pOther)
{
  // here m_pFramClass == "WSDIFrame"
    m_pFrameWnd = (CFrameWnd*)m_pFrameClass->CreateObject();
  m_pFrameWnd->LoadFrame(IDR_WHITEBOARD,WS_CHIL D|WS_VISIBLE,m_pParentWnd,&context))
}

 

//class CWCSWhiteBoardCtrl : public WSDIControl
//class WSDIControl : public COleControl
//here is how the WSDITemplate was created
CWCSWhiteBoardCtrl::CWCSWhiteBoardCtrl()
{

 InitializeIIDs(&IID_DWCSWhiteBoard, &IID_DWCSWhiteBoardEvents);
    SetInitialSize(200, 200);

 WSDITemplate* temp=new WSDITemplate(
        RUNTIME_CLASS(WSDIDoc),
        RUNTIME_CLASS(WSDIFrame),
  RUNTIME_CLASS(WSDIView));
 temp->SetContainerInfo(IDR_WHITEBOARD);
  AddDocTemplate(temp);
}




Replies:
Posted By: Oleg
Date Posted: 25 May 2006 at 12:31pm

Hi

Try to link ToolkitPro staitically... It can't find CXTPMenuBar dynamic class.



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


Posted By: bigeyes
Date Posted: 29 May 2006 at 11:28pm
Problem solved.Thank you.


Posted By: gfzhang8
Date Posted: 14 June 2006 at 6:21am

Hi, bigeyes,

I think i have the same problem with you.

I can not load a derived class from the archive in vc.net 2003, windows XP.

Would you tell something about how did you solved your problem?

Best regards!

 

gfzhang




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