void CWordPadApp::LoadOptions() { BYTE* pb = NULL; UINT nLen = 0; HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if (hFont == NULL) hFont = (HFONT)GetStockObject(ANSI_VAR_FONT); VERIFY(::GetObject(hFont, sizeof(LOGFONT), &m_lf)); m_bWordSel = GetProfileInt(szSection, szWordSel, TRUE); TCHAR buf[2]; buf[0] = NULL; GetLocaleInfo(GetUserDefaultLCID(), LOCALE_IMEASURE, buf, 2); int nDefUnits = buf[0] == '1' ? 0 : 1; SetUnits(GetProfileInt(szSection, szUnits, nDefUnits)); m_bMaximized = GetProfileInt(szSection, szMaximized, (int)FALSE); if (GetProfileBinary(szSection, szFrameRect, &pb, &nLen)) { ASSERT(nLen == sizeof(CRect)); memcpy(&m_rectInitialFrame, pb, sizeof(CRect)); delete pb; } else m_rectInitialFrame.SetRect(0,0,0,0); CRect rectScreen(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); CRect rectInt; rectInt.IntersectRect(&rectScreen, &m_rectInitialFrame); if (rectInt.Width() < 10 || rectInt.Height() < 10) m_rectInitialFrame.SetRect(0, 0, 0, 0); if (GetProfileBinary(szSection, szPageMargin, &pb, &nLen)) { ASSERT(nLen == sizeof(CRect)); memcpy(&m_rectPageMargin, pb, sizeof(CRect)); delete pb; } else m_rectPageMargin.SetRect(1800, 1440, 1800, 1440); m_optionsText.LoadOptions(szTextSection); m_optionsRTF.LoadOptions(szRTFSection); m_optionsWord.LoadOptions(szWordSection); m_optionsWrite.LoadOptions(szWriteSection); m_optionsIP.LoadOptions(szIPSection); }
UINT64 vmsAppSettingsStore::GetProfileUint64(LPCTSTR pszSection, LPCTSTR pszEntry, UINT64 nDefault) { LPBYTE pData; UINT uSize; if (!GetProfileBinary (pszSection, pszEntry, &pData, &uSize)) return nDefault; UINT64 uRes = uSize == sizeof (UINT64) ? *((UINT64*)pData) : nDefault; delete [] pData; return uRes; }
void CT42App::LoadSettings() { m_bAwayOnScreenSaver = GetProfileInt("Settings","AwayOnScreenSaver",m_bAwayOnScreenSaver); Klever::LoadStringList(m_t42Callees,"T42HotList"); Klever::LoadStringList(m_t42Callers,"T42Callers"); m_bt42AutosaveLayout = GetProfileInt("T42Window","AutosaveLayout",m_bt42AutosaveLayout); m_maxT42Callers = GetProfileInt("Settings","T42MaxCallers",m_maxT42Callers); m_maxT42Callees = GetProfileInt("Settings","T42MaxCallees",m_maxT42Callees); m_t42CallsFile = GetProfileString("Settings","T42CallsLog",m_t42CallsFile); m_T42TalkPort = GetProfileInt("Settings","T42TalkPort",m_T42TalkPort); m_sndT42Bell = GetProfileString("Sounds","T42Bell",m_sndT42Bell); m_sndT42Prompt = GetProfileString("Sounds","T42Prompt",m_sndT42Prompt); m_bT42PromptLoop = GetProfileInt("Sounds","T42PromptLoop",m_bT42PromptLoop); m_sndT42Wake = GetProfileString("Sounds","T42Wake",m_sndT42Wake); m_T42SGreeting = Klever::GetProfileString("Secretary","T42Greeting",m_T42SGreeting); m_T42SBytesLimit = GetProfileInt("Secretary","T42BytesLimit",m_T42SBytesLimit); m_T42STimeLimit = CTimeSpan(GetProfileInt("Secretary","T42TimeLimit",m_T42STimeLimit.GetTotalSeconds())); m_T42SWinLimit = GetProfileInt("Secretary","T42WinLimit",m_T42SWinLimit); m_crT42LocalBG = GetProfileInt("Fonts","T42LocalBG",m_crT42LocalBG); m_crT42RemoteBG = GetProfileInt("Fonts","T42RemoteBG",m_crT42RemoteBG); LPBYTE pdata; UINT pbytes; if(GetProfileBinary("Fonts","T42Local",&pdata,&pbytes)){ if(pbytes==sizeof(m_fmtT42Local)) memmove(&m_fmtT42Local,pdata,sizeof(m_fmtT42Local)); delete pdata; } if(GetProfileBinary("Fonts","T42Remote",&pdata,&pbytes)){ if(pbytes==sizeof(m_fmtT42Remote)) memmove(&m_fmtT42Remote,pdata,sizeof(m_fmtT42Remote)); delete pdata; } if(GetProfileBinary("Fonts","T42System",&pdata,&pbytes)){ if(pbytes==sizeof(m_fmtT42System)) memmove(&m_fmtT42System,pdata,sizeof(m_fmtT42System)); delete pdata; } }