共用方式為


CWinApp::m_pszProfileName

Contains the name of the application's .INI file.

LPCTSTR m_pszProfileName;

Remarks

m_pszProfileName is a public variable of type const char*.

注意

If you assign a value to m_pszProfileName, it must be dynamically allocated on the heap. The CWinApp destructor calls free( ) with this pointer. You many want to use the _tcsdup( ) run-time library function to do the allocating. Also, free the memory associated with the current pointer before assigning a new value. For example:

//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)m_pszProfileName);
//Change the name of the .INI file.
//The CWinApp destructor will free the memory.
m_pszProfileName = _tcsdup(_T("c:\\somedir\\myini.ini"));

Requirements

Header: afxwin.h

See Also

Concepts

CWinApp Class

CWinApp Members

Hierarchy Chart

CWinApp::GetProfileString

CWinApp::GetProfileInt

CWinApp::WriteProfileInt

CWinApp::WriteProfileString