代码拉取完成,页面将自动刷新
// DlgBackupUndo.cpp : implementation file
//
#include "stdafx.h"
#include "autophs.h"
#include "DlgBackupUndo.h"
#include "EDIBgbl.h"
#include "modregistry.h"
#include "userphs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgBackupUndo dialog
CDlgBackupUndo::CDlgBackupUndo(CWnd* pParent /*=NULL*/)
: CDialog(CDlgBackupUndo::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgBackupUndo)
//}}AFX_DATA_INIT
m_strAppInstallPath=_T("");
}
void CDlgBackupUndo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgBackupUndo)
DDX_Control(pDX, IDC_COMBO_HAD_BACKUP, m_comboHadBackup);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgBackupUndo, CDialog)
//{{AFX_MSG_MAP(CDlgBackupUndo)
ON_CBN_SELCHANGE(IDC_COMBO_HAD_BACKUP, OnSelchangeComboHadBackup)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgBackupUndo message handlers
void CDlgBackupUndo::OnSelchangeComboHadBackup()
{
CString str;
m_comboHadBackup.GetLBText(m_comboHadBackup.GetCurSel(),str);
//m_strDes = m_map[str];
UpdateData(FALSE);
}
void CDlgBackupUndo::OnOK()
{
UpdateData(FALSE);
if( AfxMessageBox(IDS_RESTOREDB_YESNO,MB_ICONINFORMATION|MB_YESNO) == IDYES )
{
//在还原以前首先对当前的数据库作备份以防万一
CopyFile(m_strPrjDBPath+"AllPrjDB.mdb",m_strPrjDBPath+"AllPrjDB.bak",FALSE);
CopyFile(m_strPrjDBPath+"Sort.mdb",m_strPrjDBPath+"Sort.bak",FALSE);
EDIBgbl::dbPRJDB.Close();
EDIBgbl::dbSORT.Close();
CString strDir;
m_comboHadBackup.GetLBText(m_comboHadBackup.GetCurSel(),strDir);
CopyFile(m_strAppInstallPath+"BackupDB\\"+strDir+"\\AllPrjDB.mdb",m_strPrjDBPath+"AllPrjDB.mdb",FALSE);
CopyFile(m_strAppInstallPath+"BackupDB\\"+strDir+"\\Sort.mdb",m_strPrjDBPath+"Sort.mdb",FALSE);
AfxMessageBox(IDS_RESTART_AUTOPHS);
CDialog::OnOK();
}
return;
}
BOOL CDlgBackupUndo::OnInitDialog()
{
CDialog::OnInitDialog();
/* CDaoRecordset rsbackup;
rsbackup.m_pDatabase=&EDIBgbl::dbPRJ;
CString strSQL;
strSQL = "SELECT * FROM BackupDBTbl";
rsbackup.Open(AFX_DAO_USE_DEFAULT_TYPE,strSQL);
COleVariant varField;
CString str1,str2,strFirst;
while( !rsbackup.IsEOF() )
{
rsbackup.GetFieldValue(1,varField);//BackupDB_Tablename
str1 = vtos(varField);
rsbackup.GetFieldValue(2,varField);//Description
str2 = vtos(varField);
m_comboHadBackup.AddString(str1);
m_map[str1]=str2;
rsbackup.MoveNext();
}
rsbackup.Close();*/
m_strPrjDBPath = GetRegKey(_T("Directory"), _T("EDInBox_PrjDBDir"), CString(_T("")));
m_strAppInstallPath = GetRegKey(_T("Directory"), _T("EDInBox_InsDir"), CString(_T("")));
CFileFind filefinder;
BOOL bWorking=FALSE;
filefinder.FindFile(m_strAppInstallPath+"BackupDB\\*.*");
do
{
bWorking = filefinder.FindNextFile();
if( filefinder.IsDirectory() )
{
if( !filefinder.IsDots() )
m_comboHadBackup.AddString(filefinder.GetFileName());
}
}while( bWorking );
if( m_comboHadBackup.GetCount()>0 )
{
m_comboHadBackup.SetCurSel(0);
//m_comboHadBackup.GetLBText(0,strFirst);
//m_strDes = m_map[strFirst];
}
else
{
m_comboHadBackup.AddString(_T("暂无备份"));
m_comboHadBackup.SetCurSel(0);
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。