📄 vcdemoview.cpp
字号:
// VcDemoView.cpp : implementation of the CVcDemoView class
//
#include "stdafx.h"
#include "VcDemo.h"
#include "VcDemoDoc.h"
#include "VcDemoView.h"
#include "dialogLpt.h"
#include "initDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView
IMPLEMENT_DYNCREATE(CVcDemoView, CView)
BEGIN_MESSAGE_MAP(CVcDemoView, CView)
// add our own message
ON_MESSAGE(WM_INIT, OnInitHandle)
//{{AFX_MSG_MAP(CVcDemoView)
ON_COMMAND(ID_MnuOpen, OnMnuOpen)
ON_COMMAND(ID_MnuClose, OnMnuClose)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView construction/destruction
CVcDemoView::CVcDemoView()
{
// TODO: add construction code here
}
CVcDemoView::~CVcDemoView()
{
}
BOOL CVcDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView drawing
void CVcDemoView::OnDraw(CDC* pDC)
{
CVcDemoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView printing
BOOL CVcDemoView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CVcDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CVcDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView diagnostics
#ifdef _DEBUG
void CVcDemoView::AssertValid() const
{
CView::AssertValid();
}
void CVcDemoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CVcDemoDoc* CVcDemoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVcDemoDoc)));
return (CVcDemoDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CVcDemoView message handlers
// Handle our own message
void CVcDemoView::OnInitHandle(WPARAM wParam,LPARAM lParam)
{
// set "Send one" option
m_pDlgMain->m_optSendOne.SetCheck(1);
// enable ActiveX control
m_pDlgMain->m_btnStartRec.EnableWindow(TRUE);;
m_pDlgMain->m_btnStopRec.EnableWindow(TRUE);;
m_pDlgMain->m_btnRxBufferCount.EnableWindow(TRUE);;
m_pDlgMain->m_btnReset.EnableWindow(TRUE);;
m_pDlgMain->m_btnRecEnabled.EnableWindow(TRUE);;
m_pDlgMain->m_btnRecDisabled.EnableWindow(TRUE);;
m_pDlgMain->m_btnReadBuffer.EnableWindow(TRUE);;
m_pDlgMain->m_btnPauseRec.EnableWindow(TRUE);;
m_pDlgMain->m_btnFrame.EnableWindow(TRUE);;
m_pDlgMain->m_btnClearBuffer.EnableWindow(TRUE);
// Update
m_pDlgMain->UpdateData(FALSE);
//this->MessageBox("Init Sucessful","Test",MB_OK);
}
// open card
void CVcDemoView::OnMnuOpen()
{
// TODO: Add your command handler code here
if(CAN_Open())
{
m_pDlgMain = new dialogLpt(this);
m_hwdMain = m_pDlgMain->DoModal();
}
else
{
this->MessageBox("打不开卡,请检查硬件...");
}
}
// close card
void CVcDemoView::OnMnuClose()
{
// TODO: Add your command handler code here
CAN_Close();
}
void CVcDemoView::OnDestroy()
{
CAN_Close();
CView::OnDestroy();
// TODO: Add your message handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -