本文整理汇总了C++中CWinApp::GetProfileInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::GetProfileInt方法的具体用法?C++ CWinApp::GetProfileInt怎么用?C++ CWinApp::GetProfileInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWinApp
的用法示例。
在下文中一共展示了CWinApp::GetProfileInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LANG_INIT
// sélection de la langue
void LANG_INIT() {
CWinApp* pApp = AfxGetApp();
if (pApp) {
int test = pApp->GetProfileInt("Language","IntId",0);
LANG_T(pApp->GetProfileInt("Language","IntId",0));
}
}
示例2: AfxGetApp
//----------------------------- FUNCTION -------------------------------------*
void
CWindowPlacement::GetProfileWP(LPCTSTR pszKeyName)
/*>>>>
Get window placement from profile.
Result
void
<<<<*/
{
CWinApp *pApp = AfxGetApp();
ASSERT_VALID(pApp);
showCmd = pApp->GetProfileInt(pszKeyName, WP_SHOW_CMD, showCmd);
flags = pApp->GetProfileInt(pszKeyName, WP_FLAGS, flags);
ptMinPosition.x = pApp->GetProfileInt(pszKeyName, WP_MIN_POS_X,
ptMinPosition.x);
ptMinPosition.y = pApp->GetProfileInt(pszKeyName, WP_MIN_POS_Y,
ptMinPosition.y);
ptMaxPosition.x = pApp->GetProfileInt(pszKeyName, WP_MAX_POS_X,
ptMaxPosition.x);
ptMaxPosition.y = pApp->GetProfileInt(pszKeyName, WP_MAX_POS_Y,
ptMaxPosition.y);
RECT& rc = rcNormalPosition;
rc.left = pApp->GetProfileInt(pszKeyName, WP_LEFT, rc.left);
rc.right = pApp->GetProfileInt(pszKeyName, WP_RIGHT, rc.right);
rc.top = pApp->GetProfileInt(pszKeyName, WP_TOP, rc.top);
rc.bottom = pApp->GetProfileInt(pszKeyName, WP_BOTTOM, rc.bottom);
}
示例3: OnInitDialog
BOOL CLogin::OnInitDialog()
{
CDialog::OnInitDialog();
CWinApp* pApp = AfxGetApp();
//determine range of accounts in history.
//range begins at 1 and ends at and includes latest. Bing: "latest" is actually the count for previous logins.
//
//in this case, if 0 is the latest, then there is no history
//and thus, don't do anything.
UINT latest = pApp->GetProfileInt("History", "Latest", 0);
m_ListBox.SetExtendedStyle( m_ListBox.GetExtendedStyle() | LVS_EX_FULLROWSELECT );
m_ListBox.InsertColumn(0, "Name", LVCFMT_LEFT, 75);
m_ListBox.InsertColumn(1, "Zone", LVCFMT_LEFT, 75);
m_ListBox.InsertColumn(2, "Server Host", LVCFMT_LEFT, 110);
m_ListBox.InsertColumn(3, "Port", LVCFMT_LEFT, 75);
for(UINT i = 1; i <= latest; i++)
{
FillBoxes(i, true);
}
int count = m_ListBox.GetItemCount();
if(count > 0)
{
VERIFY(m_ListBox.SetItemState(count-1, 0xFFFFFFFF, LVIS_SELECTED));
}
// set the last login
int last_login = pApp->GetProfileInt("History", "LastLogin", 0);
if(last_login == 0) /* no last login */
{
if(latest > 0)
{
last_login = latest;
}
}
if(last_login > 0)
{
FillBoxes(last_login, false);
}
CButton *cbox = (CButton *)GetDlgItem(IDC_CHECK_PRELOGINS);
if(pApp->GetProfileInt("ShowPreviousLogins", "YesNo", 1) == 0)
{
cbox->SetCheck(BST_UNCHECKED);
}
else
{
cbox->SetCheck(BST_CHECKED);
}
OnBnClickedCheckPrelogins();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例4: CDialog
CRunMap::CRunMap(CWnd* pParent /*=NULL*/)
: CDialog(CRunMap::IDD, pParent)
{
m_bSwitchMode = FALSE;
//{{AFX_DATA_INIT(CRunMap)
m_iVis = -1;
m_bNoQuake = FALSE;
m_strQuakeParms = _T("");
m_bSaveVisiblesOnly = FALSE;
m_iLight = -1;
m_iCSG = -1;
m_iQBSP = -1;
//}}AFX_DATA_INIT
// read from ini
CWinApp *App = AfxGetApp();
m_iCSG = App->GetProfileInt(pszSection, "CSG", 0);
m_iQBSP = App->GetProfileInt(pszSection, "QBSP", 0);
// The onlyents option was moved to the CSG setting, so don't allow it for BSP.
if (m_iQBSP > 1)
{
m_iQBSP = 1;
}
m_iVis = App->GetProfileInt(pszSection, "Vis", 0);
m_iLight = App->GetProfileInt(pszSection, "Light", 0);
m_bNoQuake = App->GetProfileInt(pszSection, "No Game", 0);
m_strQuakeParms = App->GetProfileString(pszSection, "Game Parms", "");
}
示例5: init
void CChatViewerFont::init()
{
CWinApp* app = AfxGetApp();
name = app->GetProfileString( "Style\\Font", "name", name.c_str() );
size = app->GetProfileInt( "Style\\Font", "size", size );
codepage = app->GetProfileInt( "Style\\Font", "codepage", codepage );
characterSet = app->GetProfileInt( "Style\\Font", "characterSet", characterSet );
}
示例6: Initialize
void CPadView::Initialize()
{
CWinApp* pApp = AfxGetApp();
m_bDefWordWrap = pApp->GetProfileInt(szSettings, szWordWrap, 0);
m_bDefWordWrapOld = m_bDefWordWrap;
m_nDefTabStops = pApp->GetProfileInt(szSettings, szTabStops, 8*4);
m_nDefTabStopsOld = m_nDefTabStops;
GetProfileFont(szFont, &m_lfDefFont);
m_lfDefFontOld = m_lfDefFont;
GetProfileFont(szPrintFont, &m_lfDefPrintFont);
m_lfDefPrintFontOld = m_lfDefPrintFont;
}
示例7: ReadFromRegistry
bool CEsmScriptOptions::ReadFromRegistry (void) {
CWinApp* pApp = AfxGetApp();
bool Result;
/* Input the background color */
m_BackgroundColor = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_BGCOLOR, m_BackgroundColor);
m_NoToolTips = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOTOOLTIPS, (int) m_NoToolTips) != 0);
/* Input the various char format and font options */
Result = ReadRegCharFormat();
Result &= ReadRegFont();
return (Result);
}
示例8: LoadSettings
void nPreUtilities::LoadSettings()
{
SetDefaultSettings();
CWinApp* pApp = AfxGetApp();
bRunWithMinimizedMain = pApp->GetProfileInt("Settings", "RunWithMinimizedMain", bRunWithMinimizedMain);
}
示例9: OnButtonSource
void COptionsPage::OnButtonSource(void)
{
CString strPrompt;
strPrompt.LoadString(IDS_CHOOSE_SOURCE);
CFolderDialog dlgFolder(strPrompt, m_strSource, this, BIF_NEWDIALOGSTYLE);
if (dlgFolder.DoModal() == IDOK)
{
m_strSource = dlgFolder.GetFolderPath();
SetDlgItemText(IDC_EDIT_SOURCE, m_strSource);
#if (_MFC_VER < 0x0700)
CWinApp* pApp = AfxGetApp();
ASSERT_VALID(pApp);
if ((m_timeWrite = pApp->GetProfileInt(SZ_REGK_TIMES, m_strSource, -1)) != -1)
#else
CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
ASSERT_VALID(pApp);
if ((m_timeWrite = pApp->GetProfileTime(SZ_REGK_TIMES, m_strSource, -1)) != -1)
#endif // _MFC_VER
{
m_dtpWrite.SetTime(&m_timeWrite);
}
CString strDefTarget = m_strSource + _T(".Update");
SetDlgItemText(IDC_EDIT_TARGET, pApp->GetProfileString(SZ_REGK_TARGETS, m_strSource, strDefTarget));
}
}
示例10: GetProfileInt
//--------------------------------------------------------------------------------------------------------------//
UINT CChildView::GetProfileInt(LPCTSTR lpszEntry, int nDefault)
{
UINT nResult = nDefault;
CWinApp* pApp = AfxGetApp();
if (pApp) nResult = pApp->GetProfileInt(REG_SECTION_LOG, lpszEntry, nDefault);
return nResult;
}
示例11: OnInitDialog
BOOL CLeashProperties::OnInitDialog()
{
CDialog::OnInitDialog();
pLeashGetTimeServerName(timeServer, TIMEHOST);
SetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer);
if (getenv(TIMEHOST))
GetDlgItem(IDC_EDIT_TIME_SERVER)->EnableWindow(FALSE);
else
GetDlgItem(IDC_STATIC_TIMEHOST)->ShowWindow(FALSE);
CWinApp * pApp = AfxGetApp();
if (pApp)
m_initMissingFiles = m_newMissingFiles =
pApp->GetProfileInt("Settings", "CreateMissingConfig", FALSE_FLAG);
CheckDlgButton(IDC_CHECK_CREATE_MISSING_CFG, m_initMissingFiles);
dw_initMslsaImport = dw_newMslsaImport = pLeash_get_default_mslsa_import();
switch ( dw_initMslsaImport ) {
case 0:
CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_OFF,TRUE);
break;
case 1:
CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_ON,TRUE);
break;
case 2:
CheckDlgButton(IDC_RADIO_MSLSA_IMPORT_MATCH,TRUE);
break;
}
return TRUE;
}
示例12: CDialog
CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_TIP, pParent)
{
//{{AFX_DATA_INIT(CTipDlg)
m_bStartup = TRUE;
//}}AFX_DATA_INIT
// We need to find out what the startup and file position parameters are
// If startup does not exist, we assume that the Tips on startup is checked TRUE.
CWinApp* pApp = AfxGetApp();
m_bStartup = !pApp->GetProfileInt(szSection, szIntStartup, 0);
UINT iFilePos = pApp->GetProfileInt(szSection, szIntFilePos, 0);
// Now try to open the tips file
m_pStream = fopen("Tips.txt", "r");
if (m_pStream == NULL)
{
m_strTip.LoadString(CG_IDS_FILE_ABSENT);
return;
}
// If the timestamp in the INI file is different from the timestamp of
// the tips file, then we know that the tips file has been modified
// Reset the file position to 0 and write the latest timestamp to the
// ini file
struct _stat buf;
_fstat(_fileno(m_pStream), &buf);
CString strCurrentTime = ctime(&buf.st_ctime);
strCurrentTime.TrimRight();
CString strStoredTime =
pApp->GetProfileString(szSection, szTimeStamp, NULL);
if (strCurrentTime != strStoredTime)
{
iFilePos = 0;
pApp->WriteProfileString(szSection, szTimeStamp, strCurrentTime);
}
if (fseek(m_pStream, iFilePos, SEEK_SET) != 0)
{
AfxMessageBox(CG_IDP_FILE_CORRUPT);
}
else
{
GetNextTipString(m_strTip);
}
}
示例13: AfxGetApp
COptionsPage::COptionsPage(void):
CBetterPropPage(IDD_PAGE_OPTIONS),
m_nRecurse(BST_CHECKED),
m_nCleanup(BST_CHECKED),
m_nRecycle(BST_CHECKED),
m_fCompare(BST_UNCHECKED)
{
m_psp.dwFlags |= PSP_PREMATURE;
#if (_MFC_VER < 0x0700)
CWinApp* pApp = AfxGetApp();
#else
CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
#endif // _MFC_VER
ASSERT_VALID(pApp);
// initialize and validate initial input values
m_strSource = pApp->GetConfigString(SZ_ARG_OPTIONS_SOURCE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_SOURCE);
m_nRecurse = pApp->GetConfigCheck(SZ_ARG_OPTIONS_RECURSE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_RECURSE, BST_CHECKED);
m_strExclude = pApp->GetConfigString(SZ_ARG_OPTIONS_EXCLUDE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_EXCLUDE);
m_strTarget = pApp->GetConfigString(SZ_ARG_OPTIONS_TARGET, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_TARGET);
m_nCleanup = pApp->GetConfigCheck(SZ_ARG_OPTIONS_CLEANUP, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_CLEANUP, BST_CHECKED);
if (m_nCleanup == BST_CHECKED)
{
m_nRecycle = pApp->GetConfigCheck(SZ_ARG_OPTIONS_RECYCLE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_RECYCLE, BST_CHECKED);
}
else
{
m_nRecycle = BST_UNCHECKED;
}
#if (_MFC_VER < 0x0700)
m_timeWrite = m_strSource.IsEmpty() ? -1 : pApp->GetProfileInt(SZ_REGK_TIMES, m_strSource, -1);
#else
CArgsParser& argsParser = pApp->m_argsParser;
bool fHasWriteTime = false;
if (argsParser.HasKey(SZ_ARG_OPTIONS_WRITETIME))
{
fHasWriteTime = argsParser.GetTimeValue(SZ_ARG_OPTIONS_WRITETIME, m_timeWrite);
}
if (!fHasWriteTime)
{
m_timeWrite = m_strSource.IsEmpty() ? -1 : pApp->GetProfileTime(SZ_REGK_TIMES, m_strSource, -1);
}
#endif // _MFC_VER
m_fCompare = pApp->GetConfigCheck(SZ_ARG_OPTIONS_COMPARE, SZ_REGK_OPTIONS, SZ_REGV_OPTIONS_COMPARE, BST_UNCHECKED);
// initial validation
if (!::PathFileExists(m_strSource))
{
::GetCurrentDirectory(_MAX_PATH, m_strSource.GetBuffer(_MAX_PATH));
m_strSource.ReleaseBuffer();
m_strTarget = m_strSource + _T(".Update");
}
}
示例14: AfxGetApp
void CID3V2Page::RestoreTagBoxesState()
{
CWinApp* myApp = AfxGetApp();
int nValue = 1;
nValue = myApp->GetProfileInt ("TagBoxes", "Artist2", 1);
m_Artistchk.SetCheck(nValue);
m_Artist.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Title2", 1);
m_Titlechk.SetCheck(nValue);
m_Title.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Album2", 1);
m_Albumchk.SetCheck(nValue);
m_Album.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Year2", 1);
m_Yearchk.SetCheck(nValue);
m_Year.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Comment2", 1);
m_Commentchk.SetCheck(nValue);
m_Comment.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Genre2", 1);
m_Genrechk.SetCheck(nValue);
m_Genre.EnableWindow(nValue);
nValue = myApp->GetProfileInt ("TagBoxes", "Track2", 1);
m_Trackchk.SetCheck(nValue);
m_Track.EnableWindow(nValue);
}
示例15: OnLoginNew
//Creating a new login profile
void CLogin::OnLoginNew()
{
CString name, host, zone, port;
m_NameCombobox.GetWindowText(name);
m_HostCombobox.GetWindowText(host);
m_ZoneCombobox.GetWindowText(zone);
m_PortCombobox.GetWindowText(port);
CString new_profile_id = name + " in " + zone + " at " + host + " | " + port;
CString tmp;
for(int i = 0; i < m_ListBox.GetItemCount(); i++)
{
//tmp = m_ListBox.GetItemText(i, 0);
tmp = m_prevLogins[i];
if(0 == new_profile_id.Compare(tmp))
return; //the profile already exists - do nothing
}
CWinApp* pApp = AfxGetApp();
char buf[256];
UINT latest = pApp->GetProfileInt("History", "Latest", 0);
if(0 == latest)
{
//there is no history - begin a new one.
//never store anything in "History\\0"!
latest = 1;
sprintf(buf, "History\\1");
}
else
{
//create a new slot
sprintf(buf, "History\\%d", ++latest);
}
//adding the new profile to the registry and incrementing latest
pApp->WriteProfileInt("History", "Latest", latest);
pApp->WriteProfileString(buf, "Name", name);
pApp->WriteProfileString(buf, "Host", host);
pApp->WriteProfileString(buf, "Zone", zone);
pApp->WriteProfileString(buf, "Port", port);
//add the new profile to the listbox - remember listbox is always one behind the registry!
//m_ListBox.InsertItem(latest-1, new_profile_id, 0);
int n = m_ListBox.InsertItem(latest-1, name);
latest++;
m_ListBox.SetItemText(n, 1, zone);
m_ListBox.SetItemText(n, 2, host);
m_ListBox.SetItemText(n, 3, port);
m_prevLogins.Add(new_profile_id);
}