📄 portscandlg.cpp
字号:
// PortScanDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BeastScaner.h"
#include "PortScanDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPortScanDlg dialog
IMPLEMENT_DYNAMIC(CPortScanDlg, CDialog)
CPortScanDlg::CPortScanDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPortScanDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPortScanDlg)
dwOriginateIP = 0;
bSingleIP = FALSE;
bSinglePort = FALSE;
dwLastPort = 1024;
dwOriginatePort = 1;
dwLastIP = 0;
//}}AFX_DATA_INIT
}
CPortScanDlg::~CPortScanDlg()
{
}
void CPortScanDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPortScanDlg)
DDX_Control(pDX, IDC_IPADDRESS1, m_OriginateIP);
DDX_Control(pDX, IDC_EDIT2, cLastPortCtrl);
DDX_Control(pDX, IDC_IPADDRESS2, cIPAddressCtrl);
DDX_Control(pDX, IDC_TAB1, cTabCtrl);
DDX_Text(pDX, IDC_IPADD1, dwOriginateIP);
DDX_Check(pDX, IDC_CHECK1, bSingleIP);
DDX_Check(pDX, IDC_CHECK2, bSinglePort);
DDX_Text(pDX, IDC_EDIT2, dwLastPort);
DDV_MinMaxDWord(pDX, dwLastPort, 1, 65535);
DDX_Text(pDX, IDC_EDIT1, dwOriginatePort);
DDV_MinMaxDWord(pDX, dwOriginatePort, 1, 65535);
DDX_Text(pDX, IDC_IPADD2, dwLastIP);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPortScanDlg, CDialog)
//{{AFX_MSG_MAP(CPortScanDlg)
ON_BN_CLICKED(IDC_CHECK1, OnBnClickedSingleIP)
ON_BN_CLICKED(IDC_CHECK2, OnBnClickedSinglePort)
ON_MESSAGE(WM_CONSTRUCT_PARAM ,OnConstructParament)
ON_NOTIFY(IPN_FIELDCHANGED, IDC_IPADDRESS1, OnFieldchangedIpaddress1)
ON_NOTIFY(IPN_FIELDCHANGED, IDC_IPADDRESS2, OnFieldchangedIpaddress2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPortScanDlg message handlers
void CPortScanDlg::OnBnClickedSingleIP()
{
// TODO: Add your control notification handler code here
if(this->bSingleIP==FALSE)
{
this->cIPAddressCtrl.EnableWindow(FALSE);
this->bSingleIP=TRUE;
}
else
{
this->cIPAddressCtrl.EnableWindow(TRUE);
this->bSingleIP=FALSE;
}
}
void CPortScanDlg::OnBnClickedSinglePort()
{
// TODO: Add your control notification handler code here
if(this->bSinglePort==FALSE)
{
this->cLastPortCtrl.EnableWindow(FALSE);
this->bSinglePort=TRUE;
}
else
{
this->cLastPortCtrl.EnableWindow(TRUE);
this->bSinglePort=FALSE;
}
}
LRESULT CPortScanDlg::OnConstructParament(WPARAM wp,LPARAM lp)
{
this->UpdateData();
this->theThreadParament.dwOriginalIP=this->dwOriginateIP;
if(this->bSingleIP)
{
this->theThreadParament.dwLastIP=this->dwOriginateIP;
}
else
{
this->theThreadParament.dwLastIP=this->dwLastIP;
}
this->theThreadParament.dwOriginalPort=this->dwOriginatePort;
if(this->bSinglePort)
{
this->theThreadParament.dwLastPort=this->dwOriginatePort;
}
else
{
this->theThreadParament.dwLastPort=this->dwLastPort;
}
return 0;
}
BOOL CPortScanDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
this->cTcpScanDlg.Create(IDD_TCP_SCAN,&(this->cTabCtrl));
this->cUdpScanDlg.Create(IDD_UDP_SCAN,&(this->cTabCtrl));
this->cTabCtrl.AddTab(&(this->cTcpScanDlg),"TCP Scan",0);
this->cTabCtrl.AddTab(&(this->cUdpScanDlg),"UDP Scan",1);
this->cTabCtrl.SetCurSel(0);
this->cTcpScanDlg.pThreadParament=&(this->theThreadParament);
this->cUdpScanDlg.pThreadParament=&(this->theThreadParament);
this->cUdpScanDlg.pParamentConstructor=this;
this->cTcpScanDlg.pParamentConstructor=this;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPortScanDlg::OnOK()
{
// TODO: 在此添加专用代码和/或调用基类
this->cTabCtrl.SelectNextTab(TRUE);
}
void CPortScanDlg::OnFieldchangedIpaddress1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
m_OriginateIP.GetAddress(dwOriginateIP);
this->UpdateData(FALSE);
*pResult = 0;
}
void CPortScanDlg::OnFieldchangedIpaddress2(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
cIPAddressCtrl.GetAddress(dwLastIP);
this->UpdateData(FALSE);
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -