![]() |
Module state problems loading saved commandbars |
Post Reply ![]() |
Author | |
ZakR ![]() Newbie ![]() Joined: 18 March 2007 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() 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?
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |