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

📄 page3.cpp

📁 功能十分强大的拨号程序
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////
// If this program works, it was written by Alexander Fedorov.
// If not, I don't know who wrote it.
// mailto:lamer2000@hotmail.com
// Home Page: http://members.xoom.com/lamer2000/
// This file is part of Alexf Dialer.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
///////////////////////////////////////////////////////////////////////

// Page3.cpp : implementation file
//

#include "stdafx.h"
#include "Afd.h"
#include "Page3.h"

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

extern CAfdApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CPage3 property page

IMPLEMENT_DYNCREATE(CPage3, CPropertyPage)

CPage3::CPage3() : CPropertyPage(CPage3::IDD)
{
	//{{AFX_DATA_INIT(CPage3)
	m_sLog = _T("");
	m_sPing = _T("");
	m_sSpeed = _T("");
	m_sTermKB = _T("");
	m_sTermTime = _T("");
	m_sTimeout = _T("");
	m_iTonePulse = -1;
	m_bHangUp = FALSE;
	m_bLog = FALSE;
	m_bPing = FALSE;
	m_bRedial = FALSE;
	m_bSpeed = FALSE;
	m_bTerm = FALSE;
	m_bTimeout = FALSE;
	m_bInterfaceStartMinimized = FALSE;
	m_bInterfaceMinimizeOnConnect = FALSE;
	//}}AFX_DATA_INIT
	dwTraffic = new DWORD[200 * sizeof(DWORD)];
	if (dwTraffic)
	{
		for (int i = 0; i < 200; i++) dwTraffic[i] = 0;
	}
	uTimer = UINT_MAX;
}

CPage3::~CPage3()
{
	if (dwTraffic) delete [] dwTraffic;
}

void CPage3::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPage3)
	DDX_Text(pDX, IDC_EDIT_LOG, m_sLog);
	DDX_Text(pDX, IDC_EDIT_PING, m_sPing);
	DDX_Text(pDX, IDC_EDIT_SPEED, m_sSpeed);
	DDX_Text(pDX, IDC_EDIT_TERMINATE, m_sTermKB);
	DDX_Text(pDX, IDC_EDIT_TERMTIME, m_sTermTime);
	DDX_Text(pDX, IDC_EDIT_TIMEOUT, m_sTimeout);
	DDX_Radio(pDX, IDC_RADIO1, m_iTonePulse);
	DDX_Check(pDX, IDC_CHECK_HANGUP, m_bHangUp);
	DDX_Check(pDX, IDC_CHECK_LOG, m_bLog);
	DDX_Check(pDX, IDC_CHECK_PING, m_bPing);
	DDX_Check(pDX, IDC_CHECK_REDIAL, m_bRedial);
	DDX_Check(pDX, IDC_CHECK_SPEED, m_bSpeed);
	DDX_Check(pDX, IDC_CHECK_TERMINATE, m_bTerm);
	DDX_Check(pDX, IDC_CHECK_TIMEOUT, m_bTimeout);
	DDX_Check(pDX, IDC_CHECK_INTERFACE_START_MINIMIZED, m_bInterfaceStartMinimized);
	DDX_Check(pDX, IDC_CHECK_INTERFACE_START_MINIMIZED2, m_bInterfaceMinimizeOnConnect);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPage3, CPropertyPage)
	//{{AFX_MSG_MAP(CPage3)
	ON_WM_DESTROY()
	ON_WM_TIMER()
	ON_BN_CLICKED(IDC_BUTTON_FILE_LOG, OnButtonFileLog)
	ON_BN_CLICKED(IDC_BUTTON_VEW_LOG, OnButtonVewLog)
	ON_BN_CLICKED(IDC_CHECK_HANGUP, OnCheckHangup)
	ON_BN_CLICKED(IDC_CHECK_LOG, OnCheckLog)
	ON_BN_CLICKED(IDC_CHECK_PING, OnCheckPing)
	ON_BN_CLICKED(IDC_CHECK_REDIAL, OnCheckRedial)
	ON_BN_CLICKED(IDC_CHECK_SPEED, OnCheckSpeed)
	ON_BN_CLICKED(IDC_CHECK_TERMINATE, OnCheckTerminate)
	ON_BN_CLICKED(IDC_CHECK_TIMEOUT, OnCheckTimeout)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_EN_KILLFOCUS(IDC_EDIT_LOG, OnKillfocusEditLog)
	ON_EN_KILLFOCUS(IDC_EDIT_PING, OnKillfocusEditPing)
	ON_EN_KILLFOCUS(IDC_EDIT_SPEED, OnKillfocusEditSpeed)
	ON_EN_KILLFOCUS(IDC_EDIT_TERMINATE, OnKillfocusEditTerminate)
	ON_EN_KILLFOCUS(IDC_EDIT_TERMTIME, OnKillfocusEditTermtime)
	ON_EN_KILLFOCUS(IDC_EDIT_TIMEOUT, OnKillfocusEditTimeout)
	ON_BN_CLICKED(IDC_CHECK_INTERFACE_START_MINIMIZED, OnCheckInterfaceStartMinimized)
	ON_BN_CLICKED(IDC_CHECK_INTERFACE_START_MINIMIZED2, OnCheckInterfaceStartMinimized2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPage3 message handlers

BOOL CPage3::InitPropertyPage()
{
	if (!dwTraffic) return FALSE;
//	PingIP(0x7B7B7B7B);
	// first-time log file init
	CString sModFileName;
	GetModuleFileName(NULL, sModFileName.GetBuffer(MAX_PATH), MAX_PATH);
	sModFileName.ReleaseBuffer();
	sModFileName.MakeReverse();
	m_sLog = sModFileName.Right(sModFileName.GetLength() - sModFileName.Find('\\'));
	m_sLog.MakeReverse();
	m_sLog += _T("afd.log");
	UpdateData(FALSE);
	LoadAllFromIni();
	dwInitBytesRecv = theApp.pPerf[PERF_BytesRecvd]->GetData();
	dwInitBytesSent = theApp.pPerf[PERF_BytesXmit]->GetData();
	TimeBeginSession = CTime::GetCurrentTime();
	LastTrafficCheck = CTime::GetCurrentTime();
	LastPingCheck = CTime::GetCurrentTime();
	if (UINT_MAX == uTimer) uTimer = SetTimer(1, 1000 * 60, NULL);
	theApp.LOG("Program started.");
	return TRUE;
}

BOOL CPage3::OnInitDialog()
{
	CPropertyPage::OnInitDialog();
	return TRUE;
}

void CPage3::OnDestroy()
{
	KillTimer(uTimer);
	theApp.LOG("Program finished.");
	theApp.LOG("-----------------");
	CPropertyPage::OnDestroy();
}

void CPage3::OnTimer(UINT nIDEvent)
{
	for (int i = 199; i > 0; i--) dwTraffic[i] = dwTraffic[i - 1];
	DWORD dwBytesSent = theApp.pPerf[PERF_BytesXmit]->GetData();
	dwBytesSent -= dwInitBytesSent;
	DWORD dwBytesRecv = theApp.pPerf[PERF_BytesRecvd]->GetData();
	dwBytesRecv -= dwInitBytesRecv;
	dwTraffic[0] = dwBytesSent + dwBytesRecv;
	BOOL bConnected = theApp.IsConnected();
	// 镳铥屦赅 磬 镨眍忄龛

⌨️ 快捷键说明

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