本文整理汇总了C++中CWinApp::GetAppRegistryKey方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::GetAppRegistryKey方法的具体用法?C++ CWinApp::GetAppRegistryKey怎么用?C++ CWinApp::GetAppRegistryKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWinApp
的用法示例。
在下文中一共展示了CWinApp::GetAppRegistryKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnScImportSettings
void CMainWizard::OnScImportSettings(void)
{
CString strFilter;
CString strTitle;
CProcessPrivileges processPrivileges;
enum { fdwFlags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST };
strFilter.LoadString(IDS_SETTINGS_FILTER);
#if (_MFC_VER < 0x0700)
CFileDialogEx dlgOpen(TRUE, _T("hive"), AfxGetAppName(), fdwFlags, strFilter);
#else
CFileDialog dlgOpen(TRUE, _T("hive"), AfxGetAppName(), fdwFlags, strFilter);
#endif // _MFC_VER
strTitle.LoadString(IDS_TITLE_IMPORT);
dlgOpen.m_ofn.lpstrTitle = strTitle;
if (dlgOpen.DoModal() == IDOK)
{
BeginWaitCursor();
CWinApp* pApp = AfxGetApp();
ASSERT_VALID(pApp);
processPrivileges[SE_RESTORE_NAME] = SE_PRIVILEGE_ENABLED;
HKEY hAppKey = pApp->GetAppRegistryKey();
::RegRestoreKey(hAppKey, dlgOpen.GetPathName(), REG_FORCE_RESTORE);
::RegCloseKey(hAppKey);
processPrivileges[SE_RESTORE_NAME] = 0;
EndWaitCursor();
}
}
示例2: OnScExportSettings
void CMainWizard::OnScExportSettings(void)
{
CString strFilter;
CString strTitle;
CProcessPrivileges processPrivileges;
enum { fdwFlags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY };
strFilter.LoadString(IDS_SETTINGS_FILTER);
#if (_MFC_VER < 0x0700)
CFileDialogEx dlgSaveAs(FALSE, _T("hive"), AfxGetAppName(), fdwFlags, strFilter);
#else
CFileDialog dlgSaveAs(FALSE, _T("hive"), AfxGetAppName(), fdwFlags, strFilter);
#endif // _MFC_VER
strTitle.LoadString(IDS_TITLE_EXPORT);
dlgSaveAs.m_ofn.lpstrTitle = strTitle;
if (dlgSaveAs.DoModal() == IDOK)
{
BeginWaitCursor();
CWinApp* pApp = AfxGetApp();
ASSERT_VALID(pApp);
processPrivileges[SE_BACKUP_NAME] = SE_PRIVILEGE_ENABLED;
HKEY hAppKey = pApp->GetAppRegistryKey();
::RegSaveKey(hAppKey, dlgSaveAs.GetPathName(), NULL);
::RegCloseKey(hAppKey);
processPrivileges[SE_BACKUP_NAME] = 0;
EndWaitCursor();
}
}