次の方法で共有


CWinApp::m_pszRegistryKey

アプリケーションのプロファイル設定がレジストリまたは INI ファイルのどこに格納されているか調べるために使います。

LPCTSTR m_pszRegistryKey;

解説

通常、このデータ メンバーは読み取り専用として扱います。

  • 値はレジストリ キーに格納されます。 アプリケーションのプロファイル設定の名前を次のレジストリ キーに追加されます。HKEY_CURRENT_USER ・ ソフトウェア ・ LocalAppWizard ・生成・。

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

//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)m_pszRegistryKey);
//Change the name of the registry key.
//The CWinApp destructor will free the memory.
m_pszRegistryKey = _tcsdup(
   _T("HKEY_CURRENT_USER\\Software\\mycompany\\myapp\\thissection\\thisvalue"));

必要条件

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

参照

参照

CWinApp クラス

階層図

CWinApp::SetRegistryKey

その他の技術情報

CWinApp のメンバー