Exemplo n.º 1
0
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();
	}
}
void CHD_Player_3D_Network::OnBnClickedButtonSaveas()
{
	// TODO: 在此添加控件通知处理程序代码
	//CFileDialog dlgOpen(TRUE,NULL,NULL,OFN_HIDEREADONLY,strFile);

	CFileDialog dlgSaveAs(FALSE,NULL,NULL,OFN_OVERWRITEPROMPT);
	dlgSaveAs.DoModal();
}
Exemplo n.º 3
0
void CImconDoc::OnFileExport() 
{
	// TODO: Add your command handler code here
  CString strFilter;
  strFilter = ((CImconApp *) AfxGetApp())->m_Convert.GetFilter();
  CFileDialog dlgSaveAs(FALSE, NULL, NULL, OFN_HIDEREADONLY,
                        strFilter, AfxGetMainWnd());
  dlgSaveAs.m_ofn.lpstrTitle = "Exportieren";
  dlgSaveAs.m_ofn.Flags &= ~OFN_SHOWHELP;  // No help
  if (dlgSaveAs.DoModal() != IDOK)
    return;
  CString strFileName = dlgSaveAs.GetPathName();
  if (dlgSaveAs.GetFileName().Find('.') == -1)  // Add extension
    strFileName += "." + ((CImconApp *) AfxGetApp())->m_Convert.GetFormatExtension(
                                                      dlgSaveAs.m_ofn.nFilterIndex);

  ((CImconApp *) AfxGetApp())->m_Convert.WriteImageToFile(dlgSaveAs.m_ofn.nFilterIndex,
                                                          strFileName, m_Dib.GetHandle());
}