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

📄 portpcioview.cpp

📁 并口PCI调试工具
💻 CPP
字号:
// PortPCIOView.cpp : implementation of the CPortPCIOView class
//

#include "stdafx.h"
#include "PortPCIO.h"
#include "PortPCIODoc.h"
#include "PortPCIOView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPortPCIOView

IMPLEMENT_DYNCREATE(CPortPCIOView, CView)

BEGIN_MESSAGE_MAP(CPortPCIOView, CView)
	 ON_MESSAGE( WM_NEW_MESSAGE,OnNewMessage)
	//{{AFX_MSG_MAP(CPortPCIOView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPortPCIOView construction/destruction
int index=0;
CPortPCIOView::CPortPCIOView()
{
	// TODO: add construction code here


}

CPortPCIOView::~CPortPCIOView()
{
}

BOOL CPortPCIOView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	CFileException e;
	if  (m_parallel.OpenLPT(1, &e) )
		m_parallel.Listen(
		100, // size of message header
		-1, // position of size of message body in header -1 means all message lengths are fixed
		&m_queue, // CWzdQue to store new messages
		this, // pWnd of window to send“new message” message
		WM_NEW_MESSAGE, // “new message” to send
		0 // the user defined id of which port sent the message
		);


	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CPortPCIOView drawing

void CPortPCIOView::OnDraw(CDC* pDC)
{
	CPortPCIODoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
//	pDC->TextOut(20,20,"safdsafadsf");
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CPortPCIOView diagnostics

#ifdef _DEBUG
void CPortPCIOView::AssertValid() const
{
	CView::AssertValid();
}

void CPortPCIOView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CPortPCIODoc* CPortPCIOView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPortPCIODoc)));
	return (CPortPCIODoc*)m_pDocument;
}
#endif //_DEBUG

LRESULT CPortPCIOView::OnNewMessage( WPARAM, LPARAM )
{
	CWzdMsg *pMsg = NULL;
	while ( pMsg = m_queue.Remove() )
	{
		// pMsg contains:
		// m_nID --the user defined id of which port sent
		// the message
		// m_pHdr --the message header
		// m_pBody --the message body
		// m_len --the total message length
		// m_error --any errors
		// make sure to delete the message after processing!
	/*
		CString Data;
		Data.Format("Port LPT%d: %s, Length is %d",pMsg->m_nID,pMsg->m_pBody,pMsg->m_len);
		AfxMessageBox(Data);*/
		CPortPCIODoc* pDoc = GetDocument();
		CDC* pDC = GetDC();
		CRect rc;
		GetClientRect(&rc);

		pDC->TextOut(rc.left,rc.top+index,pMsg->m_pBody,pMsg->m_len-1);	   	   	   						
		index++;
		pDC->TextOut(1,1,"asdas123123123s");



		delete pMsg;
	}
	
	return 0L;
}


/////////////////////////////////////////////////////////////////////////////
// CPortPCIOView message handlers

⌨️ 快捷键说明

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