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

📄 framesview.cpp

📁 操作系统是Windows 98
💻 CPP
字号:
// FramesView.cpp : implementation file
//

#include "stdafx.h"
#include "VCStyle.h"
#include "FramesView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#include "sja\\sjamacro.h"
#include "data.h"

/////////////////////////////////////////////////////////////////////////////
// CFramesView

IMPLEMENT_DYNCREATE(CFramesView, CEditView)

CFramesView::CFramesView()
{
	m_nCount = 0;
}

CFramesView::~CFramesView()
{
}


BEGIN_MESSAGE_MAP(CFramesView, CEditView)
	//{{AFX_MSG_MAP(CFramesView)
	ON_MESSAGE(WM_RECEIVEFRAME,OnReceiveFrame)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFramesView drawing

void CFramesView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CFramesView diagnostics

#ifdef _DEBUG
void CFramesView::AssertValid() const
{
	CEditView::AssertValid();
}

void CFramesView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}
CFramesDoc *CFramesView::GetDocument ()  // non-debug version is inline
{
	ASSERT (m_pDocument->IsKindOf (RUNTIME_CLASS (CFramesDoc)));

	return (CFramesDoc *) m_pDocument;
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CFramesView message handlers

LRESULT CFramesView::OnReceiveFrame(WPARAM w,LPARAM l)
{
	int i;
	CString tmp;
	CFramesDoc* pDoc=GetDocument();

	m_nCount++;
	if(m_nCount>500){
		pDoc->m_frames="";//太长了
		m_nCount = 1;
	}

	for(i=0;i<FRAMELEN;i++){
		tmp.Format("%2x ",RC_BUF[i]);
		pDoc->m_frames += tmp;
	}
	CTime tm;
	tm = CTime::GetCurrentTime();
	tmp = tm.Format("\t\t%H小时,%M分,%S秒\r\n");
	pDoc->m_frames += tmp;
	SetWindowText(pDoc->m_frames);
	GetEditCtrl().SetSel(pDoc->m_frames.GetLength()-1,pDoc->m_frames.GetLength()-1);

	return 1;
}

void CFramesView::OnInitialUpdate() 
{
	CEditView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	GetEditCtrl().SetReadOnly();

	CFramesDoc* pDoc=GetDocument();
	ASSERT(pDoc);
	SetWindowText(pDoc->m_frames);
	GetEditCtrl().SetSel(pDoc->m_frames.GetLength()-1,pDoc->m_frames.GetLength()-1);

	m_bkbrush.CreateSolidBrush(RGB(235,240,245));
}

HBRUSH CFramesView::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	// TODO: Change any attributes of the DC here
	return (HBRUSH)m_bkbrush;
	// TODO: Return a non-NULL brush if the parent's handler should not be called
//	return NULL;
}

⌨️ 快捷键说明

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