<?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 : Saving To an INI</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : General Discussion : Saving To an INI]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 14 May 2026 06:32:13 +0000</pubDate>
  <lastBuildDate>Thu, 19 Aug 2004 06:52:52 +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=307</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[Saving To an INI : The LoadStateFromString and SaveStateToString...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=2814&amp;title=saving-to-an-ini#2814</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=702">timhards</a><br /><strong>Subject:</strong> 307<br /><strong>Posted:</strong> 19 August 2004 at 6:52am<br /><br /><P>The LoadStateFromString and SaveStateToString functions that Oleg has given are incorrect (and don't compile). To correct them make the following changes.</P><P>In LoadStateFromString, change:<BR>&nbsp; (pData)&#091;i/2&#093; = (BYTE)<BR>&nbsp;&nbsp; (((str&#091;i+1&#093; - 'A') &lt;&lt; 4) + (str - 'A'));<BR>to:<BR>&nbsp; (pData)&#091;i/2&#093; = (BYTE)<BR>&nbsp;&nbsp; (((str&#091;i+1&#093; - 'A') &lt;&lt; 4) + (str&#091;i&#093; - 'A'));</P><P>In SaveStateToString, change:<BR>&nbsp; lpsz&#091;i*2&#093; = (TCHAR)((pData &amp; 0x0F) + 'A'); //low nibble<BR>&nbsp; lpsz&#091;i*2+1&#093; = (TCHAR)(((pData &gt;&gt; 4) &amp; 0x0F) + 'A'); //high nibble<BR>to:<BR>&nbsp; lpsz&#091;i*2&#093; = (TCHAR)((pData&#091;i&#093; &amp; 0x0F) + 'A'); //low nibble<BR>&nbsp; lpsz&#091;i*2+1&#093; = (TCHAR)(((pData&#091;i&#093; &gt;&gt; 4) &amp; 0x0F) + 'A'); //high nibble</P><P>Tim<BR></P>]]>
   </description>
   <pubDate>Thu, 19 Aug 2004 06:52:52 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=2814&amp;title=saving-to-an-ini#2814</guid>
  </item> 
  <item>
   <title><![CDATA[Saving To an INI :  These functions decode/encode...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=923&amp;title=saving-to-an-ini#923</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 307<br /><strong>Posted:</strong> 02 February 2004 at 12:06am<br /><br /><FONT color=#0000ff><P><FONT color=#000000><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>These functions decode/encode state to string. You can save this sting to INI or registry for each user.&nbsp; see: </FONT>WritePrivateProfileString("CommandBars", "State", str, strPath);</FONT></P><P>&nbsp;</P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>void LoadStateFromString(CXTPCommandBars* pCommandBars, CString str, BOOL bSerializeControls)<BR>{<BR>&nbsp;int nLen = str.GetLength();<BR>&nbsp;if ((nLen == 0) || (nLen % 2 != 0) )<BR>&nbsp;&nbsp;return;&nbsp;<BR>&nbsp;<BR>&nbsp;int nBytes = nLen/2;<BR>&nbsp;BYTE* pData = new BYTE&#091;nBytes&#093;;</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;for (int i = 0; i &lt; nLen; i += 2)<BR>&nbsp;{<BR>&nbsp;&nbsp;(pData)&#091;i/2&#093; = (BYTE)<BR>&nbsp;&nbsp;&nbsp;(((str&#091;i+1&#093; - 'A') &lt;&lt; 4) + (str<EM> - 'A'));<BR>&nbsp;}</EM></FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;CMemFile memFile(pData, nBytes);<BR>&nbsp;CArchive ar (&amp;memFile,CArchive::load);<BR>&nbsp;<BR>&nbsp;try<BR>&nbsp;{&nbsp;<BR>&nbsp;&nbsp;pCommandBars-&gt;SerializeBarState(ar, bSerializeControls);<BR>&nbsp;}<BR>&nbsp;catch (COleException* pEx)<BR>&nbsp;{<BR>&nbsp;&nbsp;pEx-&gt;Delete ();<BR>&nbsp;}<BR>&nbsp;catch (CArchiveException* pEx)<BR>&nbsp;{<BR>&nbsp;&nbsp;pEx-&gt;Delete ();<BR>&nbsp;}</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;delete&#091;&#093; pData;</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>}</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>CString SaveStateToString(CXTPCommandBars* pCommandBars, BOOL bSerializeControls)<BR>{<BR>&nbsp;CMemFile memFile;<BR>&nbsp;CArchive ar (&amp;memFile,CArchive::store);</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp;pCommandBars-&gt;SerializeBarState(ar, bSerializeControls);<BR>&nbsp;}<BR>&nbsp;catch (COleException* pEx)<BR>&nbsp;{<BR>&nbsp;&nbsp;pEx-&gt;Delete ();<BR>&nbsp;}<BR>&nbsp;catch (CArchiveException* pEx)<BR>&nbsp;{<BR>&nbsp;&nbsp;pEx-&gt;Delete ();<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;ar.Flush();</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;DWORD nBytes = (DWORD)memFile.GetPosition();<BR>&nbsp;BYTE* pData = memFile.Detach();</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;CString str;<BR>&nbsp;LPTSTR lpsz = str.GetBufferSetLength(nBytes * 2);<BR>&nbsp;<BR>&nbsp;// convert to string and write out<BR>&nbsp;for (UINT i = 0; i &lt; nBytes; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;lpsz&#091;i*2&#093; = (TCHAR)((pData &amp; 0x0F) + 'A'); //low nibble<BR>&nbsp;&nbsp;lpsz&#091;i*2+1&#093; = (TCHAR)(((pData &gt;&gt; 4) &amp; 0x0F) + 'A'); //high nibble<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;ar.Close();<BR>&nbsp;memFile.Close();<BR>&nbsp;free(pData);&nbsp;</FONT></P><P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>&nbsp;return str;<BR>}</FONT></FONT></P><span style="font-size:10px"><br /><br />Edited by oleg</span>]]>
   </description>
   <pubDate>Mon, 02 Feb 2004 00:06:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=923&amp;title=saving-to-an-ini#923</guid>
  </item> 
  <item>
   <title><![CDATA[Saving To an INI : Can ANYONE help me with this issue....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=750&amp;title=saving-to-an-ini#750</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=251">JamesC</a><br /><strong>Subject:</strong> 307<br /><strong>Posted:</strong> 06 January 2004 at 4:23pm<br /><br />Can ANYONE help me with this issue. It is rather important for our app to be able to save to multiple INI files. It appears that it will only save to the WIN.INI file. Is there any other way of saving the data.<span style="font-size:10px"><br /><br />Edited by JamesC</span>]]>
   </description>
   <pubDate>Tue, 06 Jan 2004 16:23:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=750&amp;title=saving-to-an-ini#750</guid>
  </item> 
  <item>
   <title><![CDATA[Saving To an INI : Does anyone know how to save to...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=685&amp;title=saving-to-an-ini#685</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=251">JamesC</a><br /><strong>Subject:</strong> 307<br /><strong>Posted:</strong> 18 December 2003 at 11:18am<br /><br />Does anyone know how to save to the INI file. SaveCommandBars Description says that lpszProfileName&nbsp;'Points to a null-terminated string that specifies the name of a section in the initialization file or a key in the Windows registry where state information is stored.' I would like to know what is the initialization file and how do you specify it.&nbsp;My app has different users and each user will have a different layout. I need to be able to specify different INI file to save and load from. But I dont see how to specify the INI file to get the data&nbsp;from. Documentation states to hand it the Section name of the INI file. ]]>
   </description>
   <pubDate>Thu, 18 Dec 2003 11:18:16 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=307&amp;PID=685&amp;title=saving-to-an-ini#685</guid>
  </item> 
 </channel>
</rss>