?? mainfrm.cpp
字號:
// MainFrm.cpp : CMainFrame 類的實現(xiàn)
//
#include "stdafx.h"
#include "NongCheManage.h"
#include "MainFrm.h"
#include ".\mainfrm.h"
#include "IndexDataSet.h"
#include "UserManage.h"
#include "SystemReg.h"
#include "BakcupDatabase.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_WM_CREATE()
// 全局幫助命令
ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_INDEXDATASET, OnIndexdataset)
ON_COMMAND(ID_USERSET, OnUserset)
ON_COMMAND(ID_OTHERSET, OnOtherset)
ON_COMMAND(ID_LOCKSYSTEM, OnLocksystem)
ON_COMMAND(ID_EXITSYSTEM, OnExitsystem)
ON_COMMAND(ID_INPUTCHEDATA, OnInputchedata)
ON_COMMAND(ID_QUERYCEI, OnQuerycei)
ON_COMMAND(ID_PRINT1TEXT, OnPrint1text)
ON_COMMAND(ID_PRINT2TEXT, OnPrint2text)
ON_COMMAND(ID_PRINT3TEXT, OnPrint3text)
ON_COMMAND(ID_EXCEL1TEXT, OnExcel1text)
ON_COMMAND(ID_EXCEL2TEXT, OnExcel2text)
ON_COMMAND(ID_EXCEL3TEXT, OnExcel3text)
ON_COMMAND(ID_BACKUPDATABASE, OnBackupdatabase)
ON_COMMAND(ID_RESTORDATABASE, OnRestordatabase)
ON_COMMAND(ID_DELDATA, OnDeldata)
ON_COMMAND(ID_INPUTREGFILE, OnInputregfile)
ON_COMMAND(ID_SYSTEMREG, OnSystemreg)
ON_WM_SIZE()
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // 狀態(tài)行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// CMainFrame 構(gòu)造/析構(gòu)
CMainFrame::CMainFrame()
{
EnableActiveAccessibility();
pDoc1=NULL;
pDoc2=NULL;
pDoc3=NULL;
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("未能創(chuàng)建狀態(tài)欄\n");
return -1; // 未能創(chuàng)建
}
ASSERT(m_hWndMDIClient!=NULL);
if (!m_bgcolorwnd.SubclassWindow(m_hWndMDIClient))
return -1;
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此處通過修改 CREATESTRUCT cs 來修改窗口類或
// 樣式
//cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
// | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE | WS_SYSMENU;
return TRUE;
}
// CMainFrame 診斷
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
// CMainFrame 消息處理程序
void CMainFrame::OnIndexdataset()//初始化數(shù)據(jù)
{
CIndexDataSet dlg;
dlg.DoModal();
}
void CMainFrame::OnUserset()//用戶管理
{
CUserManage dlg;
dlg.DoModal();
}
void CMainFrame::OnOtherset()//其它設(shè)置
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnLocksystem()//鎖定系統(tǒng)
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnExitsystem()//退出系統(tǒng)
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnInputchedata()//車輛檔案錄入
{
if(pDoc2==NULL)
{
CNongCheManageApp * pmdisdiapp =(CNongCheManageApp *)AfxGetApp();
pDoc2=(CInputDoc *)pmdisdiapp->pDoctemp2->OpenDocumentFile(NULL);
}
else
{
POSITION pos;
pos=pDoc2->GetFirstViewPosition();
CView * pView;
pView=pDoc2->GetNextView(pos);
pView->GetParentFrame()->ActivateFrame();
}
}
void CMainFrame::OnQuerycei()//查詢所有車輛及駕駛證
{
if(pDoc3==NULL)
{
CNongCheManageApp * pmdisdiapp =(CNongCheManageApp *)AfxGetApp();
pDoc3=(CQueryDoc *)pmdisdiapp->pDoctemp3->OpenDocumentFile(NULL);
}
else
{
POSITION pos;
pos=pDoc3->GetFirstViewPosition();
CView * pView;
pView=pDoc3->GetNextView(pos);
pView->GetParentFrame()->ActivateFrame();
}
}
void CMainFrame::OnPrint1text()//打印登記證書
{
theApp.pringtext=1;
if(pDoc1==NULL)
{
CNongCheManageApp * pmdisdiapp =(CNongCheManageApp *)AfxGetApp();
pDoc1=(CNongCheManageDoc *)pmdisdiapp->pDoctemp1->OpenDocumentFile(NULL);
}
else
{
POSITION pos;
pos=pDoc1->GetFirstViewPosition();
CView * pView;
pView=pDoc1->GetNextView(pos);
pView->GetParentFrame()->ActivateFrame();
}
}
void CMainFrame::OnPrint2text()//打印行駛證
{
theApp.pringtext=2;
if(pDoc1==NULL)
{
CNongCheManageApp * pmdisdiapp =(CNongCheManageApp *)AfxGetApp();
pDoc1=(CNongCheManageDoc *)pmdisdiapp->pDoctemp1->OpenDocumentFile(NULL);
}
else
{
POSITION pos;
pos=pDoc1->GetFirstViewPosition();
CView * pView;
pView=pDoc1->GetNextView(pos);
pView->GetParentFrame()->ActivateFrame();
}
}
void CMainFrame::OnPrint3text()//打印行駛證副頁
{
theApp.pringtext=3;
if(pDoc1==NULL)
{
CNongCheManageApp * pmdisdiapp =(CNongCheManageApp *)AfxGetApp();
pDoc1=(CNongCheManageDoc *)pmdisdiapp->pDoctemp1->OpenDocumentFile(NULL);
}
else
{
POSITION pos;
pos=pDoc1->GetFirstViewPosition();
CView * pView;
pView=pDoc1->GetNextView(pos);
pView->GetParentFrame()->ActivateFrame();
}
}
void CMainFrame::OnExcel1text()//導(dǎo)出登記證書至EXCEL
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnExcel2text()//導(dǎo)出行駛證至EXCEL
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnExcel3text()//導(dǎo)出行駛證副頁至EXCEL
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnBackupdatabase()//備份數(shù)據(jù)
{
CBakcupDatabase dlg;
dlg.m_type=true;//備份,默認(rèn)false為恢復(fù)
dlg.DoModal();
}
void CMainFrame::OnRestordatabase()//恢復(fù)數(shù)據(jù)
{
CBakcupDatabase dlg;
dlg.DoModal();
}
void CMainFrame::OnDeldata()//批量刪除數(shù)據(jù)
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnInputregfile()//導(dǎo)入注冊文件
{
// TODO: 在此添加命令處理程序代碼
}
void CMainFrame::OnSystemreg()//軟件注冊
{
CSystemReg dlg;
dlg.DoModal();
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->hwnd==m_hWndMDIClient && pMsg->message==WM_PAINT)
PostMessage(WM_PAINT);
return CMDIFrameWnd::PreTranslateMessage(pMsg);
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIFrameWnd::OnSize(nType, cx, cy);
Invalidate(TRUE);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -