Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Cannot load CXTPMenuBar from archive
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Cannot load CXTPMenuBar from archive

 Post Reply Post Reply
Author
Message
bigeyes View Drop Down
Newbie
Newbie


Joined: 24 May 2006
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bigeyes Quote  Post ReplyReply Direct Link To This Post Topic: Cannot load CXTPMenuBar from archive
    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);
}

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: 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
Back to Top
bigeyes View Drop Down
Newbie
Newbie


Joined: 24 May 2006
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bigeyes Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2006 at 11:28pm
Problem solved.Thank you.
Back to Top
gfzhang8 View Drop Down
Newbie
Newbie


Joined: 14 June 2006
Location: China
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote gfzhang8 Quote  Post ReplyReply Direct Link To This Post 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

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.203 seconds.