次の方法で共有


CWinApp::m_pszProfileName

アプリケーションの INI ファイルの名前を保持します。

LPCTSTR m_pszProfileName;

解説

m_pszProfileName は、const char* 型のパブリック変数です。

注意

m_pszProfileName に値を代入する場合は、ヒープ上に動的に割り当ててください。 CWinApp デストラクターは、free( ) を呼び出すときにこのポインターを使用します。 ランタイム ライブラリ関数 _tcsdup( ) で割り当てることもできます。 新しい値を代入する場合は、その前に現在のポインターに対応するメモリを解放してください。 次に例を示します

//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"));

必要条件

**ヘッダー:**afxwin.h

参照

参照

CWinApp クラス

階層図

CWinApp::GetProfileString

CWinApp::GetProfileInt

CWinApp::WriteProfileInt

CWinApp::WriteProfileString

その他の技術情報

CWinApp のメンバー