📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "FingerDemo.h"
#include "MainFrm.h"
#include "childfrm.h"
#include "Studentcard.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
extern CFingerDemoApp theApp;
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(IDM_MANAGER_DB, OnManagerDb)
ON_UPDATE_COMMAND_UI(IDM_MANAGER_DB, OnUpdateManagerDb)
ON_COMMAND(IDM_AUTHENTICATION, OnAuthentication)
ON_UPDATE_COMMAND_UI(IDM_AUTHENTICATION, OnUpdateAuthentication)
ON_COMMAND(IDM_DISTINGUISH, OnDistinguish)
ON_UPDATE_COMMAND_UI(IDM_DISTINGUISH, OnUpdateDistinguish)
ON_COMMAND(IDM_PROCESS, OnProcess)
ON_UPDATE_COMMAND_UI(IDM_PROCESS, OnUpdateProcess)
ON_COMMAND(IDM_TEST_FORM_DB, OnTestFormDb)
ON_UPDATE_COMMAND_UI(IDM_TEST_FORM_DB, OnUpdateTestFormDb)
ON_COMMAND(IDM_CAP_OPTICAL, OnCapOptical)
ON_UPDATE_COMMAND_UI(IDM_CAP_OPTICAL, OnUpdateCapOptical)
ON_COMMAND(IDM_CAP_SENSOR, OnCapSensor)
ON_UPDATE_COMMAND_UI(IDM_CAP_SENSOR, OnUpdateCapSensor)
ON_COMMAND(IDM_ISSUECARD, OnIssuecard)
ON_COMMAND(IDM_HIGH_GRADE, OnHighGrade)
ON_UPDATE_COMMAND_UI(IDM_HIGH_GRADE, OnUpdateHighGrade)
ON_COMMAND(IDM_LOW_GRADE, OnLowGrade)
ON_UPDATE_COMMAND_UI(IDM_LOW_GRADE, OnUpdateLowGrade)
ON_COMMAND(IDM_MEDIUM_GRADE, OnMediumGrade)
ON_UPDATE_COMMAND_UI(IDM_MEDIUM_GRADE, OnUpdateMediumGrade)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnManagerDb()
{
// TODO: Add your command handler code here
if(!theApp.m_bFingerDBM)
{
theApp.pFingerDBM->OpenDocumentFile(NULL);
theApp.m_bFingerDBM =true;
}
else
{
CChildFrame *pchild=(CChildFrame*)theApp.m_pDBMView->GetParentFrame();
pchild->ActivateFrame(SW_SHOWMAXIMIZED);
}
}
void CMainFrame::OnUpdateManagerDb(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
// pCmdUI->SetCheck(theApp.m_bFingerDBM);
}
void CMainFrame::OnAuthentication()
{
// TODO: Add your command handler code here
if(!theApp.m_bFingerAuthen )
{
theApp.pFingerAuthen->OpenDocumentFile(NULL);
theApp.m_bFingerAuthen =true;
}
else
{
CChildFrame *pchild=(CChildFrame*)theApp.m_pAuthenView->GetParentFrame();
pchild->ActivateFrame(SW_SHOWMAXIMIZED);
}
}
void CMainFrame::OnUpdateAuthentication(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
}
void CMainFrame::OnDistinguish()
{
// TODO: Add your command handler code here
if(!theApp.m_bFingerDistin)
{
theApp.pFingerDistin->OpenDocumentFile(NULL);
theApp.m_bFingerDistin =true;
}
else
{
CChildFrame *pchild=(CChildFrame*)theApp.m_pDistinView->GetParentFrame();
pchild->ActivateFrame(SW_SHOWMAXIMIZED);
}
}
void CMainFrame::OnUpdateDistinguish(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
}
void CMainFrame::OnProcess()
{
// TODO: Add your command handler code here
if(!theApp.m_bProcession)
{
theApp.pProcession->OpenDocumentFile(NULL);
theApp.m_bProcession =true;
}
else
{
CChildFrame *pchild=(CChildFrame*)theApp.m_pProcessionView->GetParentFrame();
pchild->ActivateFrame(SW_SHOWMAXIMIZED);
}
}
void CMainFrame::OnUpdateProcess(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
}
void CMainFrame::OnTestFormDb()
{
// TODO: Add your command handler code here
if(!theApp.m_bArithTest)
{
theApp.pArithTest->OpenDocumentFile(NULL);
theApp.m_bArithTest =true;
}
else
{
CChildFrame *pchild=(CChildFrame*)theApp.m_pArithTest->GetParentFrame();
pchild->ActivateFrame(SW_SHOWMAXIMIZED);
}
}
void CMainFrame::OnUpdateTestFormDb(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
}
void CMainFrame::OnCapOptical()
{
// TODO: Add your command handler code here
theApp.cap_type=1;
}
void CMainFrame::OnUpdateCapOptical(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
if(theApp.cap_type==1)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);
}
void CMainFrame::OnCapSensor()
{
// TODO: Add your command handler code here
theApp.cap_type=2;
}
void CMainFrame::OnUpdateCapSensor(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1);
if(theApp.cap_type==2)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0);
}
void CMainFrame::OnIssuecard()
{
// TODO: Add your command handler code here
CStudentcard m_issuecard;
m_issuecard.DoModal();
}
void CMainFrame::OnHighGrade()
{
// TODO: Add your command handler code here
theApp.secu_grade = 1;
theApp.m_nMatchDoor = 4500;
}
void CMainFrame::OnUpdateHighGrade(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1); //set the tick
if(theApp.secu_grade == 1)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0); //clear the tick
}
void CMainFrame::OnLowGrade()
{
// TODO: Add your command handler code here
theApp.secu_grade = 3;
theApp.m_nMatchDoor = 600;
}
void CMainFrame::OnUpdateLowGrade(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1); //set the tick
if(theApp.secu_grade == 3)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0); //clear the tick
}
void CMainFrame::OnMediumGrade()
{
// TODO: Add your command handler code here
theApp.secu_grade = 2;
theApp.m_nMatchDoor = 2000;
}
void CMainFrame::OnUpdateMediumGrade(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(1); //set the tick
if(theApp.secu_grade == 2)
pCmdUI->SetCheck(1);
else
pCmdUI->SetCheck(0); //clear the tick
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -