• 大小: 541.07 KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-08-18
  • 语言: 其他
  • 标签: 流量监控  

资源简介

IP数据包流量监控VC++源码,主要是监控端口IP包的流量

资源截图

代码片段和文件信息

// AnayDlg.cpp : implementation file
//
#include “stdafx.h“
#include “IPControl.h“
#include “AnayDlg.h“

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

/////////////////////////////////////////////////////////////////////////////
// CAnayDlg dialog


CAnayDlg::CAnayDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAnayDlg::IDD pParent)
{
//{{AFX_DATA_INIT(CAnayDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
for(int i=0;i<=59;i++)
{
m_data[i]=0;
}
m_brushBlack.CreateSolidBrush(RGB(000));
m_penRed.CreatePen(PS_SOLID2RGB(25500));
m_Pengreen.CreatePen(PS_SOLID1RGB(02550));
}


void CAnayDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAnayDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAnayDlg CDialog)
//{{AFX_MSG_MAP(CAnayDlg)
ON_WM_PAINT()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAnayDlg message handlers

BOOL CAnayDlg::OnInitDialog() 
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here

return TRUE;  // return TRUE unless you set the focus to a control
              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAnayDlg::OnPaint() 
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect;
GetClientRect(&rect);
rect.left+=30;
rect.top+=30;
rect.right-=30;
rect.bottom-=30;
CDC* pdc=GetDC();

SetBkMode(pdc->GetSafeHdc()TRANSPARENT);

//绘制黑色背景
CBrush* pOldBrush=pdc->Selectobject(&m_brushBlack);
pdc->Rectangle(&rect);
pdc->Selectobject(pOldBrush);

CPen* pOldPen=pdc->Selectobject(&m_Pengreen);
pdc->MoveTo(rect.left-1rect.bottom+1);
pdc->LineTo(rect.right+20rect.bottom+1);
pdc->MoveTo(rect.left-1rect.bottom+1);
pdc->LineTo(rect.left-1rect.top-20);
pdc->TextOut(rect.right+10rect.bottom+3“秒“);
pdc->TextOut(rect.left-20rect.top-20“流量(IP个数/秒)“);
//绘制水平线
double hori=rect.Height()/16; //水平间距 
for(int i=0;i<=16;i++)
{
float y=rect.bottom-hori*i;
if(i%2==0)
{
char data[3];
sprintf(data“%d“i*5);
pdc->TextOut(rect.left-15y-8data);
pdc->MoveTo(rect.left-10y);

}
else
pdc->MoveTo(rect.lefty);
pdc->LineTo(rect.righty);
}
//绘制垂直线
double perLen=rect.Height()/80;
double verti=rect.Width()/60.00; //垂直间距
for(i=0;i<=60;i++)
{
xs[i]=rect.left+verti*i;
if(i%10==0)
{
char data[3];
sprintf(data“%d“i-60);
pdc->TextOut(xs[i]-5rect.bottom+3data);
pdc->MoveTo(xs[i]rect.bottom+6);
}
else
pdc->MoveTo(xs[i]rect.bottom);
pdc->LineTo(xs[i]rect.top);

// //绘制数据
pdc->Selectobject(&m_penRed);//选择红色笔
pdc->MoveTo(xs[i]rect.bottom);
/*
if(rect.bottom-perLen*m_data[i] > 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2006-01-11 10:40  IPtrafficmonitor

    ..AD...         0  2006-01-09 17:32  IPtrafficmonitor\Include

     文件       2901  2002-08-01 10:33  IPtrafficmonitor\Include\bittypes.h

     文件       1620  2002-05-18 12:30  IPtrafficmonitor\Include\bucket_lookup.h

     文件       1600  2002-05-18 12:30  IPtrafficmonitor\Include\count_packets.h

     文件       3963  2002-04-10 13:45  IPtrafficmonitor\Include\DEVIOCTL.H

     文件        829  2002-08-01 10:33  IPtrafficmonitor\Include\Gnuc.h

     文件       5685  2002-08-02 15:25  IPtrafficmonitor\Include\ip6_misc.h

     文件       1784  2002-07-11 08:41  IPtrafficmonitor\Include\key_parser.h

     文件       3218  2002-05-31 20:48  IPtrafficmonitor\Include\memory_t.h

    ..AD...         0  2006-01-09 17:32  IPtrafficmonitor\Include\NET

     文件      17173  2003-01-23 08:24  IPtrafficmonitor\Include\NET\bpf.h

     文件       1672  2002-05-18 12:30  IPtrafficmonitor\Include\normal_lookup.h

     文件      48556  2002-04-10 13:45  IPtrafficmonitor\Include\Ntddndis.h

     文件       1293  2002-05-08 09:04  IPtrafficmonitor\Include\Ntddpack.h

     文件      14467  2002-07-12 15:58  IPtrafficmonitor\Include\Packet32.h

     文件      11052  2003-02-03 15:11  IPtrafficmonitor\Include\PCAP-INT.H

     文件       1593  2002-08-05 09:45  IPtrafficmonitor\Include\pcap-stdinc.h

     文件      15387  2003-02-04 16:54  IPtrafficmonitor\Include\PCAP.H

     文件      34536  2002-03-02 03:04  IPtrafficmonitor\Include\pthread.h

     文件       4692  2002-03-02 03:04  IPtrafficmonitor\Include\sched.h

     文件       4123  2002-03-02 03:04  IPtrafficmonitor\Include\semaphore.h

     文件       2456  2002-05-18 12:30  IPtrafficmonitor\Include\tcp_session.h

     文件       6347  2002-09-19 08:28  IPtrafficmonitor\Include\time_calls.h

     文件       5730  2002-05-31 20:48  IPtrafficmonitor\Include\tme.h

     文件       2810  2003-02-03 15:52  IPtrafficmonitor\Include\Win32-Extensions.h

     目录          0  2006-01-11 10:34  IPtrafficmonitor\IPControl

     文件       4442  2005-11-01 20:13  IPtrafficmonitor\IPControl\AnayDlg.cpp

     文件       1436  2005-11-01 19:21  IPtrafficmonitor\IPControl\AnayDlg.h

     文件       4263  2005-10-26 13:16  IPtrafficmonitor\IPControl\IPControl.cpp

............此处省略39个文件信息

评论

共有 条评论