⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dresume.cpp

📁 用VC++编写的汽配管理系统,实用简单,程序简单模块化
💻 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);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -