CWinApp::m_pszRegistryKey

用來判斷,在登錄或 INI 檔案,應用程式設定檔設定的位置中。

LPCTSTR m_pszRegistryKey;

備註

通常,這個資料成員會被視為唯讀。

  • 值儲存至登錄機碼。 針對應用程式組態檔設定附加至下列登錄機碼:HKEY_CURRENT_USER/Software/LocalAppWizard-Generated/.

如果您將值指派給 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"));

需求

Header: afxwin.h

請參閱

參考

CWinApp 類別

階層架構圖

CWinApp::SetRegistryKey