本文整理汇总了C++中atl::CRegKey::Detach方法的典型用法代码示例。如果您正苦于以下问题:C++ CRegKey::Detach方法的具体用法?C++ CRegKey::Detach怎么用?C++ CRegKey::Detach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atl::CRegKey
的用法示例。
在下文中一共展示了CRegKey::Detach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxGetApp
CMainWizard::CMainWizard(CWnd* pOwnerWnd):
CCustomPropSheet(AFX_IDS_APP_TITLE, pOwnerWnd)
{
CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
ASSERT_VALID(pApp);
// assign CRT locale
static const TCHAR szDefLocale[] = _T("English_USA.1252");
_tsetlocale(LC_ALL, pApp->GetProfileString(SZ_REGK_LOCALE, SZ_REGV_LOCALE_LC_ALL, szDefLocale));
// load dialog's icons
m_hIcon = pApp->LoadIcon(IDI_APP_ICON);
m_hSmIcon = pApp->LoadSmIcon(MAKEINTRESOURCE(IDI_APP_ICON));
static HYPERLINKCOLORS linkColors =
{
RGB(0, 0, 255), // default
RGB(0, 0, 255), // active
RGB(0, 0, 255), // visited
RGB(255, 0, 0) // hover
};
CHyperLink::SetColors(linkColors);
ATL::CRegKey regKeyLangs;
regKeyLangs.Attach(pApp->GetSectionKey(SZ_REGK_LANGUAGES));
int nError = ERROR_SUCCESS;
if (static_cast<HKEY>(regKeyLangs) != NULL)
{
TCHAR szLangNames[128] = { 0 };
ULONG cchNamesMax = _countof(szLangNames);
nError = regKeyLangs.QueryStringValue(NULL, szLangNames, &cchNamesMax);
if (nError == ERROR_SUCCESS)
{
LPCTSTR pszSeps = _T(",;\x20");
LPTSTR pszCurLex = _tcstok(szLangNames, pszSeps);
while (pszCurLex != NULL)
{
m_arrLangNames.Add(pszCurLex);
pszCurLex = _tcstok(NULL, pszSeps);
}
}
::RegCloseKey(regKeyLangs.Detach());
}
g_fRestartInterface = false;
AddPage(&m_pageAbout);
AddPage(&m_pageFirstLaunch);
AddPage(&m_pageOptions);
AddPage(&m_pageFiles);
AddPage(&m_pageAction);
AddPage(&m_pageProgress);
SetWizardMode();
}
示例2: OnLanguageChange
void CMainWizard::OnLanguageChange(UINT uMenuID)
{
CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp());
ASSERT_VALID(pApp);
ATL::CRegKey regKeyLangs;
regKeyLangs.Attach(pApp->GetSectionKey(SZ_REGK_LANGUAGES));
int nError = ERROR_SUCCESS;
if (static_cast<HKEY>(regKeyLangs) != NULL)
{
UINT iLangName = uMenuID - ((ID_LANGUAGE_ENGLISH & 0x00F0) >> 4);
nError = regKeyLangs.SetStringValue(SZ_REGV_LANGUAGES_CURRENT, m_arrLangNames[iLangName]);
if (nError == ERROR_SUCCESS)
{
CheckLangMenuItem(iLangName);
regKeyLangs.Flush();
g_fRestartInterface = true;
PostMessage(PSM_PRESSBUTTON, PSBTN_CANCEL, 0);
}
::RegCloseKey(regKeyLangs.Detach());
}