【VC开源代码栏目提醒】:网学会员--在 VC开源代码编辑为广大网友搜集整理了:DResume.cpp绩等信息,祝愿广大网友取得需要的信息,参考学习。
// DResume.cpp : implementation file
//
#include "stdafx.h"
#include "qpglxt.h"
#include "DResume.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDResume dialog
CDResume::CDResume(CWnd* pParent /*=NULL*/)
: CDialog(CDResume::IDD, pParent)
{
//{{AFX_DATA_INIT(CDResume)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDResume::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDResume)
DDX_Control(pDX, IDC_PROGRESS, m_Progress);
DDX_Control(pDX, IDC_EDTPATH, m_EdtPath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDResume, CDialog)
//{{AFX_MSG_MAP(CDResume)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDResume message handlers
void CDResume::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CDResume::OnButton1()
{
CFileDialog dlg(true);
dlg.DoModal();
CString sPath;
sPath=dlg.GetPathName();
CString sName;
sName=dlg.GetFileName();
if(sName.Left(2)!="DB")
{
MessageBox("这个文件不是数据备份文件,恢复后要能造成系统不能正常运行!","系统提示",MB_OK|MB_ICONSTOP);
return;
}
else
{
int a=0;
int e=0;
while(a!=-1)
{
a=sName.Find("_",a+1);
e++;
}
if(e!=6)
{
MessageBox("这个文件不是数据备份文件,恢复后要能造成系统不能正常运行!","系统提示",MB_OK|MB_ICONSTOP);
return;
}
}
int a=0;
while(a!=-1)
{
a=sPath.Find("\\",a+1);
if(a!=-1)
{
sPath.Insert(a+1,"\\");
a=a+1;
}
}
m_EdtPath.SetWindowText(sPath);
}
void CDResume::OnButton2()
{
this->m_Progress.SetRange(0,100);
CString sPach;
m_EdtPath.GetWindowText(sPach);
CString pa="qpglxt.mdb";
if(!::CopyFile(sPach,pa,false))
{
MessageBox("数据恢复失败!","系统提示",MB_OK|MB_ICONSTOP);
}
else
{
this->m_Progress.ShowWindow(SW_SHOW);
this->SetTimer(1,5,NULL);
}
}
void CDResume::OnTimer(UINT nIDEvent)
{
this->m_Progress.SetPos(this->m_Progress.GetPos()+1);
if(this->m_Progress.GetPos()==100)
{
this->KillTimer(1);
this->m_Progress.ShowWindow(SW_HIDE);
MessageBox("数据恢复成功!","系统提示",MB_OK|MB_ICONINFORMATION);
}
CDialog::OnTimer(nIDEvent);
}
上一篇:
DrawXSDJ.cpp
下一篇:
中小企业财务战略选择的探讨