<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Module state problems loading saved commandbars</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Module state problems loading saved commandbars]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 20 May 2026 14:54:04 +0000</pubDate>
  <lastBuildDate>Sun, 18 Mar 2007 07:51:54 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=6668</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Module state problems loading saved commandbars : I have a C++/MFC dll which uses...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=6668&amp;PID=21233&amp;title=module-state-problems-loading-saved-commandbars#21233</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2859">ZakR</a><br /><strong>Subject:</strong> 6668<br /><strong>Posted:</strong> 18 March 2007 at 7:51am<br /><br />I have a C++/MFC dll which uses Codejock toolbars.&nbsp; 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:<DIV>&nbsp;</DIV><DIV>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&nbsp;MFC's ModuleState-&gt;m_classList.&nbsp; This happens during load of the dll, and the module state at that time is the main application.</DIV><DIV>&nbsp;</DIV><DIV>However, after the dll's are loaded, my dll starts up and tries to restore the commandbars with LoadCommandBars().&nbsp; LoadCommandBars() will try to load the serialized commandbars, but the serialize code fails to find any CodeJock class names in the ModuleState-&gt;m_classList, because at this point, the module state is my dll, and not the main app.&nbsp; So CRuntimeClass::FromName() will fail, and the MFC serialize code throws an exception.</DIV><DIV>&nbsp;</DIV><DIV>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?</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Sun, 18 Mar 2007 07:51:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=6668&amp;PID=21233&amp;title=module-state-problems-loading-saved-commandbars#21233</guid>
  </item> 
 </channel>
</rss>