当前位置: 首页>>代码示例>>C++>>正文


C++ CWinApp::GetProfileString方法代码示例

本文整理汇总了C++中CWinApp::GetProfileString方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::GetProfileString方法的具体用法?C++ CWinApp::GetProfileString怎么用?C++ CWinApp::GetProfileString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWinApp的用法示例。


在下文中一共展示了CWinApp::GetProfileString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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", "");
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:31,代码来源:runmap.cpp

示例2: OnBnClickedBrowseAVI

void ImageDialog::OnBnClickedBrowseAVI()
{
    CWinApp* theApp = AfxGetApp();

    char buffer[MAX_PATH];
    string lastSave;
    lastSave = theApp->GetProfileString("Last Config", "lastSave");
    int trim = lastSave.rfind("\\");
    lastSave = lastSave.substr(0, trim);

    buffer[0] = '\0';
    OPENFILENAME browse;
    ZeroMemory(&browse, sizeof(browse));
    browse.lStructSize = sizeof(browse);
    browse.hwndOwner = this->m_hWnd;
    browse.lpstrFile = buffer;
    browse.nMaxFile = sizeof(buffer);
    browse.lpstrFilter = "AVI Files\0*.avi\0";
    browse.nFilterIndex = 1;
    browse.lpstrTitle = "Save to AVI File";
    browse.lpstrFileTitle = 0;
    browse.lpstrInitialDir = lastSave.c_str();
    browse.lpstrDefExt = "avi";
    browse.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT;

    if (GetSaveFileName(&browse) != 0)
    {
        AVIFilename.SetWindowText(buffer);
        SetAviOptions();
        aviwriter->OpenFile();
        compressionButton.EnableWindow(TRUE);
    }
}
开发者ID:grayshen,项目名称:particlevis,代码行数:33,代码来源:ImageDialog.cpp

示例3: 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));
	}
}
开发者ID:zephyrer,项目名称:update-it,代码行数:26,代码来源:OptionsPage.cpp

示例4: AfxGetApp

/////////////////////////////////////////////////////////////////////////////
// Create font from info in the application profile.  Reads info in the form
// facename, ptsize, weight, italic
//
zBOOL
ZFontUI::GetProfileFont( zCPCHAR cpcKey,
                         zCPCHAR cpcVal,
                         CFont&  font,
                         CDC     *pDC )
{
   CWinApp *pApp = AfxGetApp( );
   ASSERT_VALID( pApp );
   CString zs = pApp->GetProfileString( cpcKey, cpcVal );
   if ( zs.IsEmpty( ) )
      return( FALSE );

   LOGFONT lf;
   zmemset( &lf, 0, sizeof( LOGFONT ) );
   lf.lfCharSet = DEFAULT_CHARSET;
   int bItalic;
   int nPtSize;

   // scanf is overkill, but I'm lazy
   if ( sscanf( (zCPCHAR) zs, "%[a-zA-Z ],%d,%d,%d",
                  lf.lfFaceName, &nPtSize, &lf.lfWeight, &bItalic ) != 4 )
   {
      return( FALSE );
   }

   lf.lfHeight = MulDiv( -nPtSize,  // convert ptsize to logical units
       ::GetDeviceCaps( pDC ? pDC->m_hDC : ::GetDC( 0 ), LOGPIXELSY ), 72 );

   lf.lfItalic = bItalic;     // because lf.lfItalic is a BYTE
   font.DeleteObject( );      // bye
   return( font.CreateFontIndirect( &lf ) );
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:36,代码来源:ZDrFont.cpp

示例5: ClearHistory

// removes all the items from the history list, and optionally deletes
// the registry items. Note that if the history list is generated from
// a CRecentFileList, then registry entries will not be deleted
void CHistoryCombo::ClearHistory(BOOL bDeleteRegistryEntries/*=TRUE*/)
{
	ResetContent();
	if (! m_sSection.IsEmpty() && bDeleteRegistryEntries)
	{
		// remove profile entries
		CWinApp* pApp = AfxGetApp();
		ASSERT(pApp);
		CString sKey;

		for (int n = 0; n < 1000/* prevent runaway*/; n++)
		{
			sKey.Format(KEY_PREFIX_FORMAT, m_sKeyPrefix, n);
			CString sText = pApp->GetProfileString(m_sSection, sKey);
			if (sText.IsEmpty())
				break;
			pApp->WriteProfileString(m_sSection, sKey, NULL); // remove entry
		}

		if (! m_sKeyCurItem.IsEmpty())
			sKey = m_sKeyCurItem;
		else if (m_sKeyPrefix.IsEmpty())
			sKey = _T("Last");
		else
			sKey = m_sKeyPrefix;

		pApp->WriteProfileString(m_sSection, sKey, NULL);
	}
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:32,代码来源:XHistoryCombo.cpp

示例6: OnBnClickedBrowse

void ImageDialog::OnBnClickedBrowse()
{
    CWinApp* theApp = AfxGetApp();

    char buffer[MAX_PATH];
    string lastSave;
    lastSave = theApp->GetProfileString("Last Config", "lastSave");
    int trim = lastSave.rfind("\\");
    lastSave = lastSave.substr(0, trim);

    buffer[0] = '\0';
    OPENFILENAME browse;
    ZeroMemory(&browse, sizeof(browse));
    browse.lStructSize = sizeof(browse);
    browse.hwndOwner = this->m_hWnd;
    browse.lpstrFile = buffer;
    browse.nMaxFile = sizeof(buffer);
    browse.lpstrFilter = "All Files\0*.*\0";
    browse.nFilterIndex = 1;
    browse.lpstrTitle = "Select Save Path/Filename";
    browse.lpstrFileTitle = 0;
    browse.lpstrInitialDir = lastSave.c_str();
    browse.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

    if (GetSaveFileName(&browse) != 0)
    {
        string file(buffer);
        pngwriter->SetFileName(file);
        filePath.SetWindowText(pngwriter->GetFileName().c_str());
    }
}
开发者ID:grayshen,项目名称:particlevis,代码行数:31,代码来源:ImageDialog.cpp

示例7: OnCreate

// MmView message handlers
int MmView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_timer_id = SetTimer(1, 500, 0);

	// Set static handle
	s_hwnd = GetSafeHwnd();
	ModifyStyle(0, WS_CLIPCHILDREN); // reduce flicker
#ifdef WITH_SPLASH_SCREEN
	LocateWelcomeDoc(TEXT(WITH_SPLASH_SCREEN));
#else
	if(LocateWelcomeDoc(TEXT("..\\..\\Extras\\Welcome\\Welcome.smil")) ||
		LocateWelcomeDoc(TEXT("Extras\\Welcome\\Welcome.smil")) ||
		LocateWelcomeDoc(TEXT("Welcome.smil"))){;}
#endif

#ifdef WITH_SPLASH_SCREEN
	PostMessage(WM_COMMAND, ID_HELP_WELCOME);
#else
	CWinApp* pApp = AfxGetApp();
	CString val = pApp->GetProfileString(_T("Settings"), _T("Welcome"));
	if(val.IsEmpty()) {
		// first time; write the string and play welcome
		pApp->WriteProfileString(_T("Settings"), _T("Welcome"),  _T("1"));
		if(!m_welcomeDocFilename.IsEmpty())
			PostMessage(WM_COMMAND, ID_HELP_WELCOME);
	}
#endif
	return 0;
}
开发者ID:InfowareConsulting,项目名称:Signage-Ambulant-Study,代码行数:33,代码来源:MmView.cpp

示例8: AfxGetApp

CString
TestRunnerModel::loadHistoryEntry( int idx )
{
  CWinApp *app = AfxGetApp();
  ASSERT( app != NULL );

  return app->GetProfileString( _T("CppUnit"), getHistoryEntryName( idx ) );
}
开发者ID:asir6,项目名称:Colt,代码行数:8,代码来源:TestRunnerModel.cpp

示例9: 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 );
}
开发者ID:aurusov,项目名称:localchat,代码行数:8,代码来源:chatviewerstyle.cpp

示例10: SaveHistory

// saves the history to the profile specified when calling LoadHistory
// if no profile information (ie LoadHistory() wasn't called with it) then
// this function does nothing
void CHistoryCombo::SaveHistory(BOOL bAddCurrentItemToHistory/*=TRUE*/)
{
	TRACE(_T("in CHistoryCombo::SaveHistory\n"));

  if (m_sSection.IsEmpty())
    return;

  CWinApp* pApp = AfxGetApp();
  ASSERT(pApp);

  if (bAddCurrentItemToHistory)
  {
    CString sCurItem;
    GetWindowText(sCurItem);
    // trim it, so we items which differ only by a leading/trailing space
    sCurItem.TrimLeft();
    sCurItem.TrimRight();
    if (! sCurItem.IsEmpty())
      AddString(sCurItem);
  }

  // save history to info cached earlier
  int nMax = min(GetCount(), m_nMaxHistoryItems + 1);
  int n = 0;
  for (n = 0; n < nMax; n++)
  {
    CString sKey;
    sKey.Format(KEY_PREFIX_FORMAT, m_sKeyPrefix, n);
    CString sText;
    GetLBText(n, sText);
    pApp->WriteProfileString(m_sSection, sKey, sText);
	//TRACE(_T("m_sSection=%s  sKey=%s  sText=%s\n"), m_sSection, sKey, sText);
  }
  // remove redundant items
  for (n = nMax; n < 1000/* prevent runaway*/; n++)
  {
    CString sKey;
    sKey.Format(KEY_PREFIX_FORMAT, m_sKeyPrefix, n);
	TRACE(_T("m_sKeyPrefix=%s\n"), m_sKeyPrefix);
    CString sText = pApp->GetProfileString(m_sSection, sKey);
    if (sText.IsEmpty())
      break;
    pApp->WriteProfileString(m_sSection, sKey, NULL); // remove entry
  }
  if (m_bSaveRestoreLastCurrent)
  {
    CString sText;
    GetWindowText(sText);
    CString sKey;
    if (!m_sKeyCurItem.IsEmpty())
      sKey = m_sKeyCurItem;
    else if (m_sKeyPrefix.IsEmpty())
      sKey = _T("Last");
    else
      sKey = m_sKeyPrefix;
    pApp->WriteProfileString(m_sSection, sKey, sText);
  }
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:61,代码来源:XHistoryCombo.cpp

示例11: ReadFromRegistry

bool CEsmOptions::ReadFromRegistry (void) {
  CWinApp* pApp = AfxGetApp();
  CString  Buffer;
  bool	   Result;

	/* General options */
  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_GENERAL, ESMSCR_REGENTRY_AUTHORNAME, NULL);
  SetAuthorName(Buffer);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_GENERAL, ESMSCR_REGENTRY_DATAPATH, NULL);
  SetDataPath(Buffer);
  TerminatePath(m_DataPath);

  if (Buffer.IsEmpty()) {
    FindMWRegistryPath();
  }
  else {
    SetMWDataPath(Buffer);
  }

  m_BackupSaves    = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_BACKUPSAVES,    m_BackupSaves) != 0);
  m_AllowExtFuncs  = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWEXTFUNCS,  m_AllowExtFuncs) != 0);
  m_StrictIDs      = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_STRICTIDS,      m_StrictIDs) != 0);
  m_AllowBloodmoon = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWBLOODMOON, m_AllowBloodmoon) != 0);
  m_AllowTribunal  = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWTRIBUNAL,  m_AllowTribunal) != 0);

	/* Script options */
  m_ScriptWarnLevel    = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_WARNLEVEL,     m_ScriptWarnLevel);
  m_NoScriptFormat     = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOSCRFORMAT,  m_NoScriptFormat) != 0);
  m_UseExtraFile       = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_USEEXTRAFILE, m_UseExtraFile) != 0);
  m_NoScriptPrompt     = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOSCRPROMPT,  m_NoScriptPrompt) != 0);
  m_InitialIndentLevel = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_INITIALINDENTLEVEL,  m_InitialIndentLevel) != 0);
  m_IndentCommentsMore = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_INDENTCOMMENTSMORE,  m_IndentCommentsMore) != 0);
  m_ScriptFormatType   = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT,  ESMSCR_REGENTRY_SCRFORMAT,    m_ScriptFormatType);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_EXTRAFILE, m_ExtraFile);
  SetExtraFile(Buffer);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_SCRIPTINDENTSTRING, m_ScriptIndentString);
  SetScriptIndentString(Buffer);

	/* Script user format */
  Result = m_UserScriptOptions.ReadFromRegistry();
  return (Result);
 }
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:45,代码来源:EsmOptions.cpp

示例12: testRegistration

bool CRegistrationDlg::testRegistration( bool initializingDialog ) 
{
	if( initializingDialog )
	{
		// Get the app.
		CWinApp * pApp = AfxGetApp( );
		if( ! pApp )
			return false;

		// Read all the settings.
		m_emailAddress	  = pApp->GetProfileString( REGISTRY_SECTION_REGISTRATION_INFO, REGISTRY_ENTRY_EMAIL_ADDRESS );
		m_registrationKey = pApp->GetProfileString( REGISTRY_SECTION_REGISTRATION_INFO, REGISTRY_ENTRY_REGISTRATION_KEY );
	}
	else
	{
		UpdateData( );
	}

	// Get the expected registration key from this email address.
	CString generatedKey;
	CRegistrationHelper registrationHelper;
	registrationHelper.generateRegistrationKey( m_emailAddress, generatedKey );

	// Does the key match?
	if( generatedKey == m_registrationKey )
	{
		// Get the app.
		CWinApp * pApp = AfxGetApp( );
		if( ! pApp )
			return false;

		// Save the settings for the future.
		pApp->WriteProfileString( REGISTRY_SECTION_REGISTRATION_INFO, REGISTRY_ENTRY_EMAIL_ADDRESS, m_emailAddress );
		pApp->WriteProfileString( REGISTRY_SECTION_REGISTRATION_INFO, REGISTRY_ENTRY_REGISTRATION_KEY, m_registrationKey );

		// Update us and the drawing.
		UpdateData( FALSE );
		m_pG3DCallback->updateDrawing( );

		return true;
	}

	return false;
}
开发者ID:roice3,项目名称:Gravitation3D,代码行数:44,代码来源:registrationDlg.cpp

示例13: LoadHistory

// loads the history from the specified profile area, and returns the 
// text selected
// the profile area is kept so that in doesn't need to specified again
// when saving the history
CString CHistoryCombo::LoadHistory(LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix, 
				   BOOL bSaveRestoreLastCurrent/*=TRUE*/, 
				   LPCTSTR lpszKeyCurItem/*=NULL*/)
{
  if (lpszSection == NULL || lpszKeyPrefix == NULL || *lpszSection == '\0')
    return "";

  m_sSection = lpszSection;
  m_sKeyPrefix = lpszKeyPrefix;
  m_sKeyCurItem = lpszKeyCurItem == NULL ? "" : lpszKeyCurItem;
  m_bSaveRestoreLastCurrent = bSaveRestoreLastCurrent;
  CWinApp* pApp = AfxGetApp();

  int n = 0;
  CString sText;
  do
  {
    CString sKey;
    sKey.Format("%s%d", m_sKeyPrefix, n++);
    sText = pApp->GetProfileString(m_sSection, sKey);
    if (!sText.IsEmpty())
      CComboBox::AddString(sText);
  }while (!sText.IsEmpty());
  if (m_bSaveRestoreLastCurrent)
  {
    CString sKey;
    if (!m_sKeyCurItem.IsEmpty())
      sKey = m_sKeyCurItem;
    else if (m_sKeyPrefix.IsEmpty())
      sKey = "Last";
    else
      sKey = m_sKeyPrefix;
    sText = pApp->GetProfileString(m_sSection, sKey);
    if (!sText.IsEmpty())
    {
      int nIndex = FindStringExact(-1, sText);
      if (nIndex != -1)
	SetCurSel(nIndex);
      else if (GetStyle() & CBS_DROPDOWN)
	SetWindowText(sText);
    }
  }
  return sText;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:48,代码来源:HistoryCombo.cpp

示例14: Help

void FindDialog::Help()
{
	CString str;
	CWinApp *app;

	app = AfxGetApp();
	str = app->GetProfileString("help", "path");
	str = str + "\\find_dialog.html";
	ShellExecute(m_hWnd, "open", str, NULL, NULL, SW_SHOWNORMAL);
}
开发者ID:DavidDeAngelo,项目名称:Evolve,代码行数:10,代码来源:FindDialog.cpp

示例15: documentPath

void AppSetting:: loadApplicationSetting()
{
	CWinApp* pApp = AfxGetApp();

	showNavigation = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_SHOW_NAVIGATION, 1) != 0;//0 -> false; 1 -> true

	bShowHelpText = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_TEXT, 1) != 0;
	bShowAxis = pApp->GetProfileInt(REGKEY_APP_NAME, REGKEY_DISPLAY_AXIS, 1) != 0;
	objPath = pApp->GetProfileString(REGKEY_APP_NAME, REGKEY_OBJECT_PATH);
	simulationDataPath = pApp->GetProfileString(REGKEY_APP_NAME, REGKEY_SIM_DATA_PATH);

	CHAR my_documents[MAX_PATH];
	HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
	CString documentPath(my_documents);
	documentPath.AppendFormat("\\%s", SETTING_NAME);
	if (GetFileAttributes(documentPath) == INVALID_FILE_ATTRIBUTES)
	{
		CreateDirectory(documentPath,NULL);
	}
}
开发者ID:pigoblock,项目名称:TFYP,代码行数:20,代码来源:AppSetting.cpp


注:本文中的CWinApp::GetProfileString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。