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

📄 frmmain.h

📁 应用ARP结构的知识与WinPcap的发送和捕获功能
💻 H
📖 第 1 页 / 共 4 页
字号:
/*******************************************************************************
 *	文件名称:frmMain.h
 *	摘    要:程序的主体文件,实现ARP协议获得局域网内活动主机物理地址
 *	单    位:软件学院
 *	作    者:姚旺
 *	学    号:2120070369
 *	完成日期:2007年11月8日
 *******************************************************************************/


/******************
 * 链接库列表:
 ******************/

#pragma comment(lib,"ws2_32.lib")								
#pragma comment(lib,".\\Lib\\wpcap.lib")


/******************
 * 定义常量:
 ******************/
#define  HAVE_REMOTE	//Winpcap 需要的定义


/******************
 * 头文件列表:
 ******************/

#include <pcap.h>
#include "myClass.h"
#include "myFunctions.h"


/******************
 * 程序主命名空间:
 ******************/

namespace ArpWinPcap {


	/*********************
	 * 引用的系统命名空间:
	 *********************/
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;


	/******************
	 * 主窗体类:
	 ******************/
	public ref class frmMain : public System::Windows::Forms::Form
	{
	private:array<String ^,2>^ strDevInfo;			//类中的公用数组,用于存放设备信息
	public:
		/******************
		 * 主窗体构造函数:
		 ******************/

		frmMain(void)
		{
			InitializeComponent();

		}

	protected:
		/******************
		 * 主窗体析构函数:
		 ******************/

		~frmMain()
		{
			if (components)
			{
				delete components;
			}
		}

		/******************
		 * 主窗体内各控件:
		 ******************/
	private: System::Windows::Forms::Button^  buttStart;
	private: System::Windows::Forms::GroupBox^  groupBox1;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::ComboBox^  cboxDev;
	private: System::Windows::Forms::Button^  buttAutoSel;
	private: System::Windows::Forms::GroupBox^  groupBox2;
	private: System::Windows::Forms::Button^  buttSave;
	private: System::Windows::Forms::ListView^  lvMain;
	private: System::Windows::Forms::ColumnHeader^  colHeader4;
	private: System::Windows::Forms::ColumnHeader^  colHeader5;
	private: System::Windows::Forms::StatusStrip^  statusStrip1;
	private: System::Windows::Forms::ColumnHeader^  colHeader1;
	private: System::Windows::Forms::TabControl^  tabControl1;
	private: System::Windows::Forms::TabPage^  tabPage1;
	private: System::Windows::Forms::TabPage^  tabPage2;
	private: System::Windows::Forms::TextBox^  txtDev;
	private: System::Data::DataSet^  dsAll;

	private: System::Windows::Forms::DataGridView^  dgvOpt;
	private: System::Data::DataTable^  dtRange;
	private: System::Data::DataColumn^  dcChoose;
	private: System::Data::DataColumn^  dcRange;
	private: System::Data::DataColumn^  dcRangeL;
	private: System::Data::DataColumn^  dcRangeH;
	private: System::Data::DataColumn^  dcIPAddr;
	private: System::Data::DataColumn^  dcIPMask;



	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::DataGridViewCheckBoxColumn^  colChooseDataGridViewCheckBoxColumn;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  colRangeDataGridViewTextBoxColumn;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  colRangeLDataGridViewTextBoxColumn;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  colRangeHDataGridViewTextBoxColumn;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  colIPAddrDataGridViewTextBoxColumn;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  colIPMaskDataGridViewTextBoxColumn;
	private: System::Windows::Forms::ColumnHeader^  colHeader3;
	private: System::Windows::Forms::Label^  labStatus;
	private: System::Windows::Forms::ToolStripStatusLabel^  toolStripStatusLabel1;
	private: System::Data::DataColumn^  dataColumn1;
	private: System::Data::DataColumn^  dataColumn3;
	private: System::Windows::Forms::Button^  buttClear;
	private: System::Windows::Forms::ColumnHeader^  colHeader2;
	private: System::Windows::Forms::ImageList^  imageList1;






	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::DataGridViewCheckBoxColumn^  Col1;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Col2;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Col6;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Col3;
	private: System::Windows::Forms::DataGridViewTextBoxColumn^  Col4;
	private: System::Windows::Forms::DataGridViewComboBoxColumn^  Col5;




























































	private: System::ComponentModel::IContainer^  components;

	private:
		/************************
		 * 自动生成的设计器变量:
		 ************************/

#pragma region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要
		/// 使用代码编辑器修改此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = (gcnew System::ComponentModel::Container());
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(frmMain::typeid));
			System::Windows::Forms::DataGridViewCellStyle^  dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
			System::Windows::Forms::DataGridViewCellStyle^  dataGridViewCellStyle4 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
			System::Windows::Forms::DataGridViewCellStyle^  dataGridViewCellStyle2 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
			System::Windows::Forms::DataGridViewCellStyle^  dataGridViewCellStyle3 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
			this->buttStart = (gcnew System::Windows::Forms::Button());
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->dgvOpt = (gcnew System::Windows::Forms::DataGridView());
			this->dsAll = (gcnew System::Data::DataSet());
			this->dtRange = (gcnew System::Data::DataTable());
			this->dcChoose = (gcnew System::Data::DataColumn());
			this->dcRange = (gcnew System::Data::DataColumn());
			this->dcRangeL = (gcnew System::Data::DataColumn());
			this->dcRangeH = (gcnew System::Data::DataColumn());
			this->dcIPAddr = (gcnew System::Data::DataColumn());
			this->dcIPMask = (gcnew System::Data::DataColumn());
			this->dataColumn1 = (gcnew System::Data::DataColumn());
			this->dataColumn3 = (gcnew System::Data::DataColumn());
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
			this->txtDev = (gcnew System::Windows::Forms::TextBox());
			this->buttAutoSel = (gcnew System::Windows::Forms::Button());
			this->cboxDev = (gcnew System::Windows::Forms::ComboBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
			this->labStatus = (gcnew System::Windows::Forms::Label());
			this->buttClear = (gcnew System::Windows::Forms::Button());
			this->buttSave = (gcnew System::Windows::Forms::Button());
			this->lvMain = (gcnew System::Windows::Forms::ListView());
			this->colHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
			this->colHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
			this->colHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
			this->colHeader4 = (gcnew System::Windows::Forms::ColumnHeader());
			this->colHeader5 = (gcnew System::Windows::Forms::ColumnHeader());
			this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
			this->toolStripStatusLabel1 = (gcnew System::Windows::Forms::ToolStripStatusLabel());
			this->colChooseDataGridViewCheckBoxColumn = (gcnew System::Windows::Forms::DataGridViewCheckBoxColumn());
			this->colRangeDataGridViewTextBoxColumn = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->colRangeLDataGridViewTextBoxColumn = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->colRangeHDataGridViewTextBoxColumn = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->colIPAddrDataGridViewTextBoxColumn = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->colIPMaskDataGridViewTextBoxColumn = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Col1 = (gcnew System::Windows::Forms::DataGridViewCheckBoxColumn());
			this->Col2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Col6 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Col3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Col4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
			this->Col5 = (gcnew System::Windows::Forms::DataGridViewComboBoxColumn());
			this->groupBox1->SuspendLayout();
			this->tabControl1->SuspendLayout();
			this->tabPage1->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dgvOpt))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dsAll))->BeginInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dtRange))->BeginInit();
			this->tabPage2->SuspendLayout();
			this->groupBox2->SuspendLayout();
			this->statusStrip1->SuspendLayout();
			this->SuspendLayout();
			// 
			// buttStart
			// 
			this->buttStart->Cursor = System::Windows::Forms::Cursors::Hand;
			this->buttStart->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
			this->buttStart->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
			this->buttStart->ImageIndex = 4;
			this->buttStart->ImageList = this->imageList1;
			this->buttStart->Location = System::Drawing::Point(13, 20);
			this->buttStart->Name = L"buttStart";
			this->buttStart->Size = System::Drawing::Size(105, 27);
			this->buttStart->TabIndex = 2;
			this->buttStart->Text = L"  开始捕获";
			this->buttStart->UseVisualStyleBackColor = true;
			this->buttStart->Click += gcnew System::EventHandler(this, &frmMain::buttStart_Click);
			// 
			// imageList1
			// 
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			this->imageList1->Images->SetKeyName(0, L"webX2.png");
			this->imageList1->Images->SetKeyName(1, L"antispam32.png");
			this->imageList1->Images->SetKeyName(2, L"file32.png");
			this->imageList1->Images->SetKeyName(3, L"pdm32.png");
			this->imageList1->Images->SetKeyName(4, L"scan32.png");
			// 
			// groupBox1
			// 
			this->groupBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->groupBox1->BackColor = System::Drawing::Color::Transparent;
			this->groupBox1->Controls->Add(this->label3);
			this->groupBox1->Controls->Add(this->tabControl1);
			this->groupBox1->Controls->Add(this->buttAutoSel);
			this->groupBox1->Controls->Add(this->cboxDev);
			this->groupBox1->Controls->Add(this->label1);
			this->groupBox1->Location = System::Drawing::Point(9, 12);
			this->groupBox1->Name = L"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(698, 216);
			this->groupBox1->TabIndex = 3;
			this->groupBox1->TabStop = false;
			this->groupBox1->Text = L"捕获选项";
			// 
			// label3
			// 
			this->label3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"label3.Image")));
			this->label3->Location = System::Drawing::Point(197, 48);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(484, 29);
			this->label3->TabIndex = 2;
			// 
			// tabControl1
			// 
			this->tabControl1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->tabControl1->Controls->Add(this->tabPage1);
			this->tabControl1->Controls->Add(this->tabPage2);
			this->tabControl1->ImageList = this->imageList1;
			this->tabControl1->Location = System::Drawing::Point(13, 48);
			this->tabControl1->Multiline = true;
			this->tabControl1->Name = L"tabControl1";
			this->tabControl1->SelectedIndex = 0;
			this->tabControl1->Size = System::Drawing::Size(669, 155);
			this->tabControl1->TabIndex = 5;
			// 
			// tabPage1
			// 

⌨️ 快捷键说明

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