www.pudn.com > EthernetSpy.zip > EthernetSpyView.cpp
// EthernetSpyView.cpp : implementation of the CEthernetSpyView class // #include#include "stdafx.h" #include "packet32.h" #include "EthernetSpy.h" #include "EthernetSpyReader.h" #include "filter.h" #include "EthernetSpyGlobStatsDlg.h" #include "EthernetSpyPckTypeDlg.h" #include "EthernetSpyDlg.h" #include "EthernetSpyOptionsDlg.h" #include "EthernetSpyDoc.h" #include "EthernetSpyView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView IMPLEMENT_DYNCREATE(CEthernetSpyView, CView) BEGIN_MESSAGE_MAP(CEthernetSpyView, CView) //{{AFX_MSG_MAP(CEthernetSpyView) ON_MESSAGE(WM_SPYDLGCLOSE, OnSpyDlgClose) ON_MESSAGE(WM_GLOBSTATSDLGCLOSE, OnGlobStatsDlgClose) ON_MESSAGE(WM_PCKTYPEDLGCLOSE, OnPckTypeDlgClose) // ON_MESSAGE(WM_THREADTERMINATED, OnThreadTerminated) //}}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() ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView construction/destruction CEthernetSpyView::CEthernetSpyView() { // TODO: add construction code here } CEthernetSpyView::~CEthernetSpyView() { } BOOL CEthernetSpyView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView drawing void CEthernetSpyView::OnDraw(CDC* pDC) { /* CEthernetSpyDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here char Text[100]; sprintf (Text, "Total: %i", pDoc->Stats.Total); pDC->TextOut (10, 10, CString (Text)); sprintf (Text, "Broadcast: %i", pDoc->Stats.Broadcast); pDC->TextOut (10, 30, CString (Text)); sprintf (Text, "Multicast: %i", pDoc->Stats.Multicast); pDC->TextOut (10, 50, CString (Text)); SetTimer (1, 200, NULL); */ } ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView printing BOOL CEthernetSpyView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CEthernetSpyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CEthernetSpyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView diagnostics #ifdef _DEBUG void CEthernetSpyView::AssertValid() const { CView::AssertValid(); } void CEthernetSpyView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CEthernetSpyDoc* CEthernetSpyView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEthernetSpyDoc))); return (CEthernetSpyDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CEthernetSpyView message handlers LRESULT CEthernetSpyView::OnSpyDlgClose(WPARAM, LPARAM) { GetDocument () -> OnSpyDlgClose(); return 1; } /* LRESULT CEthernetSpyView::OnThreadTerminated(WPARAM, LPARAM) { GetDocument()->OnTerminatedThread(); return 1; } */ LRESULT CEthernetSpyView::OnGlobStatsDlgClose(WPARAM, LPARAM) { GetDocument() -> OnGlobStatsDlgClose(); return 1; } LRESULT CEthernetSpyView::OnPckTypeDlgClose(WPARAM, LPARAM) { GetDocument() -> OnPckTypeDlgClose(); return 1; }