I found this on internet:

http://www.codeproject.com/docview/FontHelper.asp

It has:

void CFontHelper::Save()
{
// SetSectionName() must be called before this method is used
// SetEntryName() must be called before this method is used
ASSERT(m_szSection.GetLength() > 0);
ASSERT(m_szEntry.GetLength() > 0);
// save the logical font description
CString strBuffer;
strBuffer.Format("%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
m_LogFont.lfHeight,
m_LogFont.lfWidth,
m_LogFont.lfEscapement,
m_LogFont.lfOrientation,
m_LogFont.lfWeight,
m_LogFont.lfItalic,
m_LogFont.lfUnderline,
m_LogFont.lfStrikeOut,
m_LogFont.lfCharSet,
m_LogFont.lfOutPrecision,
m_LogFont.lfClipPrecision,
m_LogFont.lfQuality,
m_LogFont.lfPitchAndFamily);
AfxGetApp()->WriteProfileString (m_szSection, 
               m_szEntry +  _T("_Desc"), strBuffer);
// save the font name
AfxGetApp()->WriteProfileString (m_szSection, 
      m_szEntry + _T("_Name"), m_LogFont.lfFaceName);
}


And

// get the logical font from the INI/Registry
void CFontHelper::Restore()
{
// SetSectionName() must be called before this method is used
// SetEntryName() must be called before this method is used
ASSERT(m_szSection.GetLength() > 0);
ASSERT(m_szEntry.GetLength() > 0);
// get font description from INI/Registry
          CString strBuffer=AfxGetApp()->GetProfileString(m_szSection,
                        m_szEntry + _T("_Desc"));
// nothing is saved 
// --> keep the current font
if (strBuffer.IsEmpty())
return;
LOGFONT LogFont;
int cRead = _stscanf (strBuffer, 
"%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
&LogFont.lfHeight,
&LogFont.lfWidth,
&LogFont.lfEscapement,
&LogFont.lfOrientation,
&LogFont.lfWeight,
&LogFont.lfItalic,
&LogFont.lfUnderline,
&LogFont.lfStrikeOut,
&LogFont.lfCharSet,
&LogFont.lfOutPrecision,
&LogFont.lfClipPrecision,
&LogFont.lfQuality,
&LogFont.lfPitchAndFamily);
if (cRead != 13)
{
TRACE("Restore(): Invalid Registry/INI file entry\n");
return;
}
// get the font name
strBuffer = AfxGetApp()->GetProfileString(m_szSection, 
                                   m_szEntry + _T("_Name"));
if (strBuffer.GetLength() <= 0)
return;
_tcscpy(LogFont.lfFaceName, strBuffer);
// take into account the loaded logical font description
m_LogFont = LogFont;
// create the associated font 
CreateFont();
}


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Jason Teagle
> Sent: 01 April 2005 13:00
> To: [email protected]
> Subject: RE: [msvc] GetProfileBinary and Windows 2003 Server
> 
> 
> > If I can't rely on using ProfileBinary, what else can I do to store 
> > the LOGFONT data?  I have 3 LOGFONTS..
> 
> You probably don't want to hear this but you could, of 
> course, save each member you are interested in from the 
> LOGFONT sttructure individually {:v)
> 
> --
> Jason Teagle
> [EMAIL PROTECTED]
> 
> 
> 
> _______________________________________________
> msvc mailing list
> [email protected]
> See 
> http://beginthread.com/mailman/listinfo/msvc_beginthread.com 
> for subscription changes, and list archive.
> 
> 
> This message has been scanned for viruses by MailControl - 
> (see http://bluepages.wsatkins.co.uk/?4318150)
> 

This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.

_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to