Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Module state problems loading saved commandbars
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Module state problems loading saved commandbars

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


Joined: 18 March 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZakR Quote  Post ReplyReply Direct Link To This Post Topic: Module state problems loading saved commandbars
    Posted: 18 March 2007 at 7:51am
I have a C++/MFC dll which uses Codejock toolbars.  This dll is loaded dynamically from a C#.NET application through ::LoadLIbrary(). The toolbars have been saved with SaveCommandBars() but LoadCommandBars() fail to restore them. I've traced the problem to the following:
 
When my dll is loaded, Windows automatically also loads the CodeJock dll. Since the Codejock classes uses the DECLARE_SERIAL macro, the various CommandBar class names are registered in MFC's ModuleState->m_classList.  This happens during load of the dll, and the module state at that time is the main application.
 
However, after the dll's are loaded, my dll starts up and tries to restore the commandbars with LoadCommandBars().  LoadCommandBars() will try to load the serialized commandbars, but the serialize code fails to find any CodeJock class names in the ModuleState->m_classList, because at this point, the module state is my dll, and not the main app.  So CRuntimeClass::FromName() will fail, and the MFC serialize code throws an exception.
 
Now what am I doing wrong here? How can I ensure that LoadCommandBars() operate in the same module state as when the CodeJock library was loaded by Windows?
 
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.156 seconds.