Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WriteProfileString()

WriteProfileString()

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    susanne1
    wrote on last edited by
    #1

    after choosing and closing the Font Dialog in an SDI appliction, the last choosen Fon must be saved via WriteProfileString() and by the next call it should be loaded sot that the Font is automatically selected via GetProfileString(). I have the following code: CString strFaceName; CString strFontSize; CString strFontStyle; CString strFontValue; CFont *m_cfont = (CFont*) new CFont(); LOGFONTA *m_lf = new LOGFONTA(); int m_nFontSize = 0; CWinApp* pApp = AfxGetApp(); m_cfdlg.GetCurrentFont(m_lf); strFaceName = m_cfdlg.GetFaceName(); m_nFontSize = m_cfdlg.GetSize() ; m_cfont->CreateFont(m_nFontSize, m_lf->lfWidth,m_lf->lfEscapement,m_lf->lfOrientation, m_lf->lfWeight,m_lf->lfItalic,false,0,1,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,strFaceName); itoa(m_nFontSize,(char*)strFontSize.GetString (),10); pApp->WriteProfileString(strFaceName, strFontSize, strFontStyle); strFontValue = pApp->GetProfileString(strFaceName, strFontSize, strFontStyle); as i know WriteProfileString, write in the registry, but this code needs something more to work properly?

    G 1 Reply Last reply
    0
    • S susanne1

      after choosing and closing the Font Dialog in an SDI appliction, the last choosen Fon must be saved via WriteProfileString() and by the next call it should be loaded sot that the Font is automatically selected via GetProfileString(). I have the following code: CString strFaceName; CString strFontSize; CString strFontStyle; CString strFontValue; CFont *m_cfont = (CFont*) new CFont(); LOGFONTA *m_lf = new LOGFONTA(); int m_nFontSize = 0; CWinApp* pApp = AfxGetApp(); m_cfdlg.GetCurrentFont(m_lf); strFaceName = m_cfdlg.GetFaceName(); m_nFontSize = m_cfdlg.GetSize() ; m_cfont->CreateFont(m_nFontSize, m_lf->lfWidth,m_lf->lfEscapement,m_lf->lfOrientation, m_lf->lfWeight,m_lf->lfItalic,false,0,1,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,strFaceName); itoa(m_nFontSize,(char*)strFontSize.GetString (),10); pApp->WriteProfileString(strFaceName, strFontSize, strFontStyle); strFontValue = pApp->GetProfileString(strFaceName, strFontSize, strFontStyle); as i know WriteProfileString, write in the registry, but this code needs something more to work properly?

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      you could look at this - Im sure he has a save method in his CFontHelper class ... CFontHelper[^] 'g'

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups