📄 exportdlg.cpp
字号:
// ExportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FileMaSys.h"
#include "ExportDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CFileMaSysApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CExportDlg dialog
CExportDlg::CExportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CExportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CExportDlg)
m_cExportLoc = _T("");
m_cExportName = _T("");
//}}AFX_DATA_INIT
}
void CExportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExportDlg)
DDX_Control(pDX, IDCANCEL, m_BtnExit);
DDX_Control(pDX, IDC_BTN_EXPORT, m_BtnExport);
DDX_Control(pDX, IDC_BTN_BROFOLDER, m_BtnBroFolder);
DDX_Text(pDX, IDC_EDIT_LOC, m_cExportLoc);
DDX_Text(pDX, IDC_EDIT_NAME, m_cExportName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExportDlg, CDialog)
//{{AFX_MSG_MAP(CExportDlg)
ON_BN_CLICKED(IDC_BTN_EXPORT, OnBtnExport)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExportDlg message handlers
void CExportDlg::OnBtnExport()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CHAR exePath[MAX_PATH];
GetModuleFileName(NULL,exePath,MAX_PATH);
CString StartPath;
StartPath=exePath;
int index=StartPath.ReverseFind('\\');
index++;
StartPath=StartPath.Left(index);
m_cDBPath=StartPath+"ProjectManageSys.mdb";
//导出的绝对路径
m_cExportPath=m_cExportLoc+"\\";
m_cExportPath+=m_cExportName;
CopyFile(m_cDBPath,m_cExportPath,FALSE);
/* SHFILEOPSTRUCT fileOp;
fileOp.hwnd=NULL;
fileOp.wFunc=FO_COPY;
fileOp.pFrom=m_cDBPath;
fileOp.pTo=m_cExportPath;
fileOp.fFlags |= FOF_SIMPLEPROGRESS;
fileOp.lpszProgressTitle="进度";
SHFileOperation(&fileOp);*/
}
BOOL CExportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_cExportLoc="D:\\DBbackup";
CFileFind dirfind;
if (!dirfind.FindFile(m_cExportLoc))
{
CreateDirectory(m_cExportLoc,NULL);
}
CTime now=CTime::GetCurrentTime();
CString strName=now.Format("%Y%m%d");
m_cExportName=strName+".mdb";
UpdateData(FALSE);
HICON iconExit=(HICON)LoadImage(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDI_ICON_ERROR),
IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
//设置退出按钮
m_BtnExit.SetIcon(iconExit);
m_BtnExit.DrawTransparent(TRUE);
m_BtnExit.SetColor(CButtonST::BTNST_COLOR_FG_IN,RGB(255,0,0));
m_BtnExit.SetAlign(CButtonST::ST_ALIGN_HORIZ);
//设置导出数据库按钮
m_BtnExport.SetIcon(IDI_ICON_BORROW);
m_BtnExport.DrawTransparent(TRUE);
m_BtnExport.SetColor(CButtonST::BTNST_COLOR_FG_IN,RGB(255,0,0));
m_BtnExport.SetAlign(CButtonST::ST_ALIGN_HORIZ);
//设置浏览文件夹按钮
m_BtnBroFolder.SetIcon(IDI_ICON_FOLDER);
m_BtnBroFolder.DrawTransparent(TRUE);
m_BtnBroFolder.SetColor(CButtonST::BTNST_COLOR_FG_IN,RGB(255,0,0));
m_BtnBroFolder.SetAlign(CButtonST::ST_ALIGN_HORIZ);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -