@ -0,0 +1,35 @@
|
||||
[config]
|
||||
transparency=100
|
||||
always_on_top=0
|
||||
lock_window_pos=0
|
||||
show_notify_icon=1
|
||||
show_cpu_memory=1
|
||||
mouse_penetrate=0
|
||||
show_task_bar_wnd=1
|
||||
position_x=1420
|
||||
position_y=900
|
||||
text_color=14547455
|
||||
hide_main_window=0
|
||||
skin_selected=\皮肤07
|
||||
font_name=微软雅黑
|
||||
font_size=10
|
||||
swap_up_down=0
|
||||
hide_main_wnd_when_fullscreen=1
|
||||
up_string=上传: $
|
||||
down_string=下载: $
|
||||
cpu_string=CPU: $
|
||||
memory_string=内存: $
|
||||
[connection]
|
||||
auto_select=1
|
||||
connection_name=Intel(R) Wi-Fi 6 AX200 160MHz-WFP Native MAC Layer LightWeight Filter-0000
|
||||
[task_bar]
|
||||
task_bar_back_color=0
|
||||
task_bar_text_color=16777215
|
||||
tack_bar_show_cpu_memory=1
|
||||
tack_bar_font_name=微软雅黑
|
||||
tack_bar_font_size=9
|
||||
task_bar_swap_up_down=0
|
||||
up_string=↑: $
|
||||
down_string=↓: $
|
||||
cpu_string=CPU: $
|
||||
memory_string=内存: $
|
@ -0,0 +1,4 @@
|
||||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
@ -0,0 +1,9 @@
|
||||
2023/11/06 5
|
||||
2017/11/16 35534
|
||||
2017/11/15 105882
|
||||
2017/11/14 152433
|
||||
2017/10/23 11649
|
||||
2017/07/28 7405
|
||||
2017/07/05 47
|
||||
2017/07/04 984
|
||||
2017/06/25 133
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=16384
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=3803808
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=9844741
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=16777215
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=16777215
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=335674
|
||||
skin_author=zy_
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=16773870
|
||||
skin_author=zy
|
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,3 @@
|
||||
[skin]
|
||||
text_color=14547455
|
||||
skin_author=zy
|
@ -0,0 +1,52 @@
|
||||
// DonateDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TrafficMonitor.h"
|
||||
#include "DonateDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CDonateDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CDonateDlg, CDialog)
|
||||
|
||||
CDonateDlg::CDonateDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_DONATE_DIALOG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CDonateDlg::~CDonateDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CDonateDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_DONATE_PIC, m_donate_pic);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDonateDlg, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CDonateDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL CDonateDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
CWindowDC dc(this);
|
||||
HDC hDC = dc.GetSafeHdc();
|
||||
int dpi = GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
int side = 304 * dpi / 96;
|
||||
|
||||
m_donate_pic.SetWindowPos(&CWnd::wndTop, 0, 0, side, side, SWP_NOMOVE); //更改控件的宽和高
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "afxwin.h"
|
||||
|
||||
|
||||
// CDonateDlg 对话框
|
||||
|
||||
class CDonateDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CDonateDlg)
|
||||
|
||||
public:
|
||||
CDonateDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CDonateDlg();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DONATE_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CStatic m_donate_pic;
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
};
|
@ -0,0 +1,78 @@
|
||||
// HistoryTrafficDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TrafficMonitor.h"
|
||||
#include "HistoryTrafficDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CHistoryTrafficDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CHistoryTrafficDlg, CDialog)
|
||||
|
||||
CHistoryTrafficDlg::CHistoryTrafficDlg(deque<HistoryTraffic>& history_traffics, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_HISTORY_TRAFFIC_DIALOG, pParent), m_history_traffics(history_traffics)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CHistoryTrafficDlg::~CHistoryTrafficDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CHistoryTrafficDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_HISTORY_INFO_LIST, m_history_list);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHistoryTrafficDlg, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CHistoryTrafficDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL CHistoryTrafficDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
//获取dpi设置
|
||||
CWindowDC dc(this);
|
||||
HDC hDC = dc.GetSafeHdc();
|
||||
int dpi = GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
|
||||
//初始化列表控件
|
||||
CRect rect;
|
||||
m_history_list.GetClientRect(rect);
|
||||
m_history_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
|
||||
int width0, width1;
|
||||
width0 = rect.Width() / 5 * 2;
|
||||
width1 = rect.Width() - width0 - 21 * dpi / 96;
|
||||
m_history_list.InsertColumn(0, _T("日期"), LVCFMT_LEFT, width0); //插入第0列
|
||||
m_history_list.InsertColumn(1, _T("使用的流量(上传+下载)"), LVCFMT_LEFT, width1); //插入第1列
|
||||
|
||||
for (int i{}; i<m_history_traffics.size(); i++)
|
||||
{
|
||||
CString date_str;
|
||||
CString k_bytes_str;
|
||||
date_str.Format(_T("%.4d/%.2d/%.2d"), m_history_traffics[i].year, m_history_traffics[i].month, m_history_traffics[i].day);
|
||||
|
||||
if (m_history_traffics[i].kBytes < 1024)
|
||||
k_bytes_str.Format(_T("%dKB"), m_history_traffics[i].kBytes);
|
||||
else if (m_history_traffics[i].kBytes < 1024*1024)
|
||||
k_bytes_str.Format(_T("%.2fMB"), m_history_traffics[i].kBytes / 1024.0);
|
||||
else
|
||||
k_bytes_str.Format(_T("%.2fGB"), m_history_traffics[i].kBytes / 1024.0 / 1024.0);
|
||||
|
||||
m_history_list.InsertItem(i, date_str);
|
||||
m_history_list.SetItemText(i, 1, k_bytes_str);
|
||||
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
#include "Common.h"
|
||||
|
||||
// CHistoryTrafficDlg 对话框
|
||||
|
||||
class CHistoryTrafficDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CHistoryTrafficDlg)
|
||||
|
||||
public:
|
||||
CHistoryTrafficDlg(deque<HistoryTraffic>& history_traffics, CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CHistoryTrafficDlg();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_HISTORY_TRAFFIC_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CListCtrl m_history_list;
|
||||
deque<HistoryTraffic>& m_history_traffics;
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
};
|
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CMainWndSettingsDlg 对话框
|
||||
|
||||
class CMainWndSettingsDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CMainWndSettingsDlg)
|
||||
|
||||
public:
|
||||
CMainWndSettingsDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CMainWndSettingsDlg();
|
||||
|
||||
//选项设置数据
|
||||
CString m_font_name;
|
||||
int m_font_size;
|
||||
COLORREF m_text_color;
|
||||
wstring m_up_string; //默认为“上传: ”
|
||||
wstring m_down_string; //默认为“下载: ”
|
||||
wstring m_cpu_string; //默认为“CPU: ”
|
||||
wstring m_memory_string; //默认为“内存: ”
|
||||
bool m_swap_up_down; //是否交换上传和下载的位置
|
||||
bool m_hide_main_wnd_when_fullscreen; //有程序全屏运行时隐藏悬浮窗
|
||||
|
||||
void DrawStaticColor();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_MAIN_WND_SETTINGS_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CStatic m_color_static;
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnEnChangeUploadEdit();
|
||||
afx_msg void OnEnChangeDownloadEdit();
|
||||
afx_msg void OnEnChangeCpuEdit();
|
||||
afx_msg void OnEnChangeMemoryEdit();
|
||||
// afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
// afx_msg void OnStnClickedTextColorStatic();
|
||||
afx_msg void OnBnClickedSetColorButton1();
|
||||
afx_msg void OnBnClickedSetDefaultButton();
|
||||
afx_msg void OnBnClickedSetFontButton();
|
||||
afx_msg void OnBnClickedSwitchUpDownCheck();
|
||||
afx_msg void OnBnClickedFullscreenHideCheck();
|
||||
};
|
@ -0,0 +1,251 @@
|
||||
// CNetworkInfoDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TrafficMonitor.h"
|
||||
#include "NetworkInfoDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CNetworkInfoDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CNetworkInfoDlg, CDialog)
|
||||
|
||||
CNetworkInfoDlg::CNetworkInfoDlg(MIB_IFROW network_info, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_NETWORK_INFO_DIALOG, pParent), m_network_info(network_info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CNetworkInfoDlg::~CNetworkInfoDlg()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CNetworkInfoDlg::GetIPAddress()
|
||||
{
|
||||
PIP_ADAPTER_INFO pIpAdapterInfo = new IP_ADAPTER_INFO(); //PIP_ADAPTER_INFO结构体指针存储本机网卡信息
|
||||
unsigned long stSize = sizeof(IP_ADAPTER_INFO); //得到结构体大小,用于GetAdaptersInfo参数
|
||||
int nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize); //调用GetAdaptersInfo函数,填充pIpAdapterInfo指针变量;其中stSize参数既是一个输入量也是一个输出量
|
||||
|
||||
if (ERROR_BUFFER_OVERFLOW == nRel)
|
||||
{
|
||||
//如果函数返回的是ERROR_BUFFER_OVERFLOW
|
||||
//则说明GetAdaptersInfo参数传递的内存空间不够,同时其传出stSize,表示需要的空间大小
|
||||
//这也是说明为什么stSize既是一个输入量也是一个输出量
|
||||
delete pIpAdapterInfo; //释放原来的内存空间
|
||||
pIpAdapterInfo = (PIP_ADAPTER_INFO)new BYTE[stSize]; //重新申请内存空间用来存储所有网卡信息
|
||||
nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize); //再次调用GetAdaptersInfo函数,填充pIpAdapterInfo指针变量
|
||||
}
|
||||
|
||||
PIP_ADAPTER_INFO pIpAdapterInfoHead = pIpAdapterInfo; //保存pIpAdapterInfo链表中第一个元素的地址
|
||||
if (ERROR_SUCCESS == nRel)
|
||||
{
|
||||
string current_network_descr{ (const char*)m_network_info.bDescr }; //MIB_IFROW结构中的当前选中的网络连接的描述
|
||||
//获取网卡信息
|
||||
//可能有多网卡,因此通过循环来查找当前要显示的网卡
|
||||
while (pIpAdapterInfo)
|
||||
{
|
||||
if(current_network_descr.find(pIpAdapterInfo->Description) != string::npos)
|
||||
{
|
||||
m_ip_address = CCommon::StrToUnicode(pIpAdapterInfo->IpAddressList.IpAddress.String);
|
||||
m_subnet_mask = CCommon::StrToUnicode(pIpAdapterInfo->IpAddressList.IpMask.String);
|
||||
m_default_gateway = CCommon::StrToUnicode(pIpAdapterInfo->GatewayList.IpAddress.String);
|
||||
break;
|
||||
}
|
||||
pIpAdapterInfo = pIpAdapterInfo->Next;
|
||||
}
|
||||
}
|
||||
//释放内存空间
|
||||
if (pIpAdapterInfoHead)
|
||||
{
|
||||
delete pIpAdapterInfoHead;
|
||||
}
|
||||
}
|
||||
|
||||
void CNetworkInfoDlg::ShowInfo()
|
||||
{
|
||||
CString temp;
|
||||
m_info_list.InsertItem(0, _T("接口名"));
|
||||
m_info_list.SetItemText(0, 1, m_network_info.wszName);
|
||||
|
||||
m_info_list.InsertItem(1, _T("接口描述"));
|
||||
m_info_list.SetItemText(1, 1, CCommon::StrToUnicode((const char*)m_network_info.bDescr).c_str());
|
||||
|
||||
m_info_list.InsertItem(2, _T("连接类型"));
|
||||
switch (m_network_info.dwType)
|
||||
{
|
||||
case IF_TYPE_OTHER: temp = _T("其他类型网络"); break;
|
||||
case IF_TYPE_ETHERNET_CSMACD: temp = _T("以太网网络"); break;
|
||||
case IF_TYPE_ISO88025_TOKENRING: temp = _T("令牌环网络"); break;
|
||||
case IF_TYPE_FDDI: temp = _T("光纤分布式数据接口 (FDDI) 网络"); break;
|
||||
case IF_TYPE_PPP: temp = _T("PPP 网络"); break;
|
||||
case IF_TYPE_SOFTWARE_LOOPBACK: temp = _T("软件环回网络"); break;
|
||||
case IF_TYPE_ATM: temp = _T("ATM 网络"); break;
|
||||
case IF_TYPE_IEEE80211: temp = _T("IEEE 802.11 无线网络"); break;
|
||||
case IF_TYPE_TUNNEL: temp = _T("隧道类型封装网络"); break;
|
||||
case IF_TYPE_IEEE1394: temp = _T("IEEE 1394 (Firewire) 高性能串行总线网络"); break;
|
||||
case IF_TYPE_IEEE80216_WMAN: temp = _T("对于 WiMax 设备的移动宽带"); break;
|
||||
case IF_TYPE_WWANPP: temp = _T("基于 GSM 网络设备的移动宽带"); break;
|
||||
case IF_TYPE_WWANPP2: temp = _T("基于 CDMA 的设备移动宽带"); break;
|
||||
default: temp = _T("未知网络"); break;
|
||||
}
|
||||
m_info_list.SetItemText(2, 1, temp);
|
||||
|
||||
//m_info_list.InsertItem(3, _T("最大传输单位大小"));
|
||||
//temp.Format(_T("%u"), m_network_info.dwMtu);
|
||||
//m_info_list.SetItemText(3, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(3, _T("速度"));
|
||||
temp.Format(_T("%dMbps"), m_network_info.dwSpeed / 1000000);
|
||||
m_info_list.SetItemText(3, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(4, _T("适配器物理地址"));
|
||||
temp = _T("");
|
||||
char buff[3];
|
||||
for (int i{}; i < m_network_info.dwPhysAddrLen; i++)
|
||||
{
|
||||
//_itoa_s(m_network_info.bPhysAddr[i], buff, 16);
|
||||
sprintf_s(buff, "%.2x", m_network_info.bPhysAddr[i]);
|
||||
temp += buff;
|
||||
if (i != m_network_info.dwPhysAddrLen - 1)
|
||||
temp += _T('-');
|
||||
}
|
||||
m_info_list.SetItemText(4, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(5, _T("IP地址"));
|
||||
m_info_list.SetItemText(5, 1, m_ip_address.c_str());
|
||||
|
||||
m_info_list.InsertItem(6, _T("子网掩码"));
|
||||
m_info_list.SetItemText(6, 1, m_subnet_mask.c_str());
|
||||
|
||||
m_info_list.InsertItem(7, _T("默认网关"));
|
||||
m_info_list.SetItemText(7, 1, m_default_gateway.c_str());
|
||||
|
||||
////temp.Format(_T("物理地址长度:%d\r\n"), m_network_info.dwPhysAddrLen);
|
||||
////out_info += temp;
|
||||
////temp = _T("适配器物理地址:");
|
||||
////temp += StrToUnicode((const char*)m_network_info.bPhysAddr).c_str();
|
||||
////out_info += temp;
|
||||
////out_info += _T("\r\n");
|
||||
|
||||
//m_info_list.InsertItem(5, _T("管理员状态"));
|
||||
//m_info_list.SetItemText(5, 1, m_network_info.dwAdminStatus ? _T("启用") : _T("禁用"));
|
||||
|
||||
m_info_list.InsertItem(8, _T("连接状态"));
|
||||
switch (m_network_info.dwOperStatus)
|
||||
{
|
||||
case IF_OPER_STATUS_NON_OPERATIONAL: temp = _T("LAN 适配器已被禁用"); break;
|
||||
case IF_OPER_STATUS_UNREACHABLE: temp = _T("WAN 适配器未连接"); break;
|
||||
case IF_OPER_STATUS_DISCONNECTED: temp = _T("网络电缆断开连接或无载体"); break;
|
||||
case IF_OPER_STATUS_CONNECTING: temp = _T("WAN 适配器正在连接"); break;
|
||||
case IF_OPER_STATUS_CONNECTED: temp = _T("WAN 适配器连接到远程对等方"); break;
|
||||
case IF_OPER_STATUS_OPERATIONAL: temp = _T("LAN 适配器已连接"); break;
|
||||
default: temp = _T("未知状态"); break;
|
||||
}
|
||||
m_info_list.SetItemText(8, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(9, _T("已接收字节数"));
|
||||
temp.Format(_T("%u (%s)"), m_network_info.dwInOctets, CCommon::DataSizeToString(m_network_info.dwInOctets));
|
||||
m_info_list.SetItemText(9, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(10, _T("已发送字节数"));
|
||||
temp.Format(_T("%u (%s)"), m_network_info.dwOutOctets, CCommon::DataSizeToString(m_network_info.dwOutOctets));
|
||||
m_info_list.SetItemText(10, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(11, _T("自程序启动以来已接收字节数"));
|
||||
temp.Format(_T("%u (%s)"), m_in_bytes, CCommon::DataSizeToString(m_in_bytes));
|
||||
m_info_list.SetItemText(11, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(12, _T("自程序启动以来已发送字节数"));
|
||||
temp.Format(_T("%u (%s)"), m_out_bytes, CCommon::DataSizeToString(m_out_bytes));
|
||||
m_info_list.SetItemText(12, 1, temp);
|
||||
|
||||
m_info_list.InsertItem(13, _T("程序已运行时间"));
|
||||
SYSTEMTIME current_time, time;
|
||||
GetLocalTime(¤t_time);
|
||||
time = CCommon::CompareSystemTime(current_time, m_start_time);
|
||||
temp.Format(_T("%d小时%d分%d秒"), time.wHour, time.wMinute, time.wSecond);
|
||||
m_info_list.SetItemText(13, 1, temp);
|
||||
}
|
||||
|
||||
void CNetworkInfoDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_INFO_LIST1, m_info_list);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNetworkInfoDlg, CDialog)
|
||||
ON_COMMAND(ID_COPY_TEXT, &CNetworkInfoDlg::OnCopyText)
|
||||
ON_NOTIFY(NM_RCLICK, IDC_INFO_LIST1, &CNetworkInfoDlg::OnNMRClickInfoList1)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CNetworkInfoDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL CNetworkInfoDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
|
||||
//获取dpi设置
|
||||
CWindowDC dc(this);
|
||||
HDC hDC = dc.GetSafeHdc();
|
||||
int dpi = GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
|
||||
//获取IP地址
|
||||
GetIPAddress();
|
||||
|
||||
//初始化列表控件
|
||||
CRect rect;
|
||||
m_info_list.GetClientRect(rect);
|
||||
m_info_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
|
||||
int width0, width1;
|
||||
width0 = rect.Width() / 4;
|
||||
width1 = rect.Width() - width0 - 21 * dpi / 96;
|
||||
m_info_list.InsertColumn(0, _T("项目"), LVCFMT_LEFT, width0); //插入第0列
|
||||
m_info_list.InsertColumn(1, _T("值"), LVCFMT_LEFT, width1); //插入第1列
|
||||
|
||||
//显示列表中的信息
|
||||
ShowInfo();
|
||||
|
||||
//SetWindowPos(&wndNoTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); //取消置顶
|
||||
m_info_list.GetToolTips()->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||
|
||||
m_menu.LoadMenu(IDR_INFO_MENU); //装载右键菜单
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
||||
|
||||
|
||||
void CNetworkInfoDlg::OnCopyText()
|
||||
{
|
||||
// TODO: 在此添加命令处理程序代码
|
||||
if (!CCommon::CopyStringToClipboard(wstring(m_selected_string)))
|
||||
MessageBox(_T("复制到剪贴板失败!"), NULL, MB_ICONWARNING);
|
||||
}
|
||||
|
||||
|
||||
void CNetworkInfoDlg::OnNMRClickInfoList1(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
{
|
||||
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
|
||||
//获取鼠标点击处的文本
|
||||
int item, sub_item;
|
||||
item = pNMItemActivate->iItem;
|
||||
sub_item = pNMItemActivate->iSubItem;
|
||||
m_selected_string = m_info_list.GetItemText(item, sub_item);
|
||||
|
||||
//弹出右键菜单
|
||||
CMenu* pContextMenu = m_menu.GetSubMenu(0); //获取第一个弹出菜单
|
||||
CPoint point1; //定义一个用于确定光标位置的位置
|
||||
GetCursorPos(&point1); //获取当前光标的位置,以便使得菜单可以跟随光标
|
||||
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point1.x, point1.y, this); //在指定位置显示弹出菜单
|
||||
|
||||
*pResult = 0;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include"Common.h"
|
||||
#include "afxcmn.h"
|
||||
|
||||
// CNetworkInfoDlg 对话框
|
||||
|
||||
class CNetworkInfoDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CNetworkInfoDlg)
|
||||
|
||||
public:
|
||||
CNetworkInfoDlg(MIB_IFROW network_info ,CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CNetworkInfoDlg();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_NETWORK_INFO_DIALOG };
|
||||
#endif
|
||||
|
||||
unsigned int m_in_bytes; //当前查看的网络自启动以来已接收字节数
|
||||
unsigned int m_out_bytes; //当前查看的网络自启动以来已发送字节数
|
||||
|
||||
SYSTEMTIME m_start_time; //程序启动的时间
|
||||
|
||||
protected:
|
||||
|
||||
MIB_IFROW m_network_info; //当前查看的网络连接信息
|
||||
wstring m_ip_address{ L"-.-.-.-" }; //IP地址
|
||||
wstring m_subnet_mask{ L"-.-.-.-" }; //子网掩码
|
||||
wstring m_default_gateway{ L"-.-.-.-" }; //默认网关
|
||||
|
||||
CListCtrl m_info_list;
|
||||
CMenu m_menu;
|
||||
|
||||
CString m_selected_string;
|
||||
|
||||
void GetIPAddress(); //获取IP地址
|
||||
void ShowInfo();
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
public:
|
||||
afx_msg void OnCopyText();
|
||||
afx_msg void OnNMRClickInfoList1(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
};
|
@ -0,0 +1,121 @@
|
||||
// OptionsDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TrafficMonitor.h"
|
||||
#include "OptionsDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// COptionsDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(COptionsDlg, CDialog)
|
||||
|
||||
COptionsDlg::COptionsDlg(int tab, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_OPTIONS_DIALOG, pParent), m_tab_selected{ tab }
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
COptionsDlg::~COptionsDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void COptionsDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_TAB1, m_tab);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, &COptionsDlg::OnTcnSelchangeTab1)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// COptionsDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL COptionsDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
//插入标签
|
||||
m_tab.InsertItem(0, _T("主窗口设置"));
|
||||
m_tab.InsertItem(1, _T("任务栏窗口设置"));
|
||||
//创建子对话框
|
||||
m_tab1_dlg.Create(IDD_MAIN_WND_SETTINGS_DIALOG, &m_tab);
|
||||
m_tab2_dlg.Create(IDD_TASKBAR_SETTINGS_DIALOG, &m_tab);
|
||||
//调整子对话框的大小和位置
|
||||
CRect rect;
|
||||
m_tab.GetClientRect(rect);
|
||||
CRect rcTabItem;
|
||||
m_tab.GetItemRect(0, rcTabItem);
|
||||
rect.top += rcTabItem.Height() + 4;
|
||||
rect.left += 4;
|
||||
rect.bottom -= 4;
|
||||
rect.right -= 4;
|
||||
m_tab1_dlg.MoveWindow(&rect);
|
||||
m_tab2_dlg.MoveWindow(&rect);
|
||||
//设置默认选中的标签
|
||||
switch (m_tab_selected)
|
||||
{
|
||||
case 0:
|
||||
m_tab1_dlg.ShowWindow(SW_SHOW);
|
||||
SetTimer(TIMER_ID1, 50, NULL);
|
||||
break;
|
||||
case 1:
|
||||
m_tab2_dlg.ShowWindow(SW_SHOW);
|
||||
SetTimer(TIMER_ID2, 50, NULL);
|
||||
break;
|
||||
}
|
||||
m_tab.SetCurFocus(m_tab_selected);
|
||||
//m_tab.SetCurSel(m_tab_selected);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
||||
|
||||
|
||||
void COptionsDlg::OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
m_tab_selected = m_tab.GetCurSel();
|
||||
switch (m_tab_selected)
|
||||
{
|
||||
case 0:
|
||||
m_tab1_dlg.ShowWindow(SW_SHOW);
|
||||
m_tab2_dlg.ShowWindow(SW_HIDE);
|
||||
m_tab1_dlg.SetFocus();
|
||||
SetTimer(TIMER_ID1, 50, NULL); //点击了第1个选项卡后延迟30毫秒绘制颜色控件
|
||||
break;
|
||||
case 1:
|
||||
m_tab2_dlg.ShowWindow(SW_SHOW);
|
||||
m_tab1_dlg.ShowWindow(SW_HIDE);
|
||||
m_tab2_dlg.SetFocus();
|
||||
SetTimer(TIMER_ID2, 50, NULL); //点击了第2个选项卡后延迟30毫秒绘制颜色控件
|
||||
break;
|
||||
}
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
|
||||
void COptionsDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (nIDEvent == TIMER_ID1)
|
||||
{
|
||||
m_tab1_dlg.DrawStaticColor();
|
||||
KillTimer(TIMER_ID1);
|
||||
}
|
||||
|
||||
if (nIDEvent == TIMER_ID2)
|
||||
{
|
||||
m_tab2_dlg.DrawStaticColor();
|
||||
KillTimer(TIMER_ID2);
|
||||
}
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "MainWndSettingsDlg.h"
|
||||
#include "TaskBarSettingsDlg.h"
|
||||
#include "afxcmn.h"
|
||||
|
||||
// COptionsDlg 对话框
|
||||
|
||||
#define TIMER_ID1 1120
|
||||
#define TIMER_ID2 1121
|
||||
|
||||
class COptionsDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(COptionsDlg)
|
||||
|
||||
public:
|
||||
COptionsDlg(int tab = 0, CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~COptionsDlg();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_OPTIONS_DIALOG };
|
||||
#endif
|
||||
|
||||
CMainWndSettingsDlg m_tab1_dlg;
|
||||
CTaskBarSettingsDlg m_tab2_dlg;
|
||||
|
||||
protected:
|
||||
CTabCtrl m_tab;
|
||||
int m_tab_selected;
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
};
|
@ -0,0 +1,119 @@
|
||||
// SkinDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TrafficMonitor.h"
|
||||
#include "SkinDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CSkinDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CSkinDlg, CDialogEx)
|
||||
|
||||
CSkinDlg::CSkinDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_SKIN_DIALOG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSkinDlg::~CSkinDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CSkinDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_COMBO1, m_select_box);
|
||||
DDX_Control(pDX, IDC_STATIC_SKIN_S, m_skin_preview_s);
|
||||
DDX_Control(pDX, IDC_STATIC_SKIN_L, m_skin_preview_l);
|
||||
// DDX_Control(pDX, IDC_STATIC_TEXT1, m_preview_text_s);
|
||||
// DDX_Control(pDX, IDC_STATIC_TEXT2, m_preview_text_l);
|
||||
}
|
||||
|
||||
|
||||
void CSkinDlg::ShowPreview()
|
||||
{
|
||||
//显示小尺寸的预览图
|
||||
m_skin_preview_s.SetWindowPos(&CWnd::wndTop, 0, 0, m_skin_width, m_skin_height_s, SWP_NOMOVE); //更改控件的宽和高
|
||||
m_image = (HBITMAP)LoadImage(NULL, (theApp.m_skin_path + m_skins[m_skin_selected]+ L"\\background.bmp").c_str(), IMAGE_BITMAP, m_skin_width, m_skin_height_s, LR_LOADFROMFILE);
|
||||
m_skin_preview_s.SetBitmap(m_image); //为CStatic控件设置图片
|
||||
//显示大尺寸的预览图
|
||||
m_skin_preview_l.SetWindowPos(&CWnd::wndTop, 0, 0, m_skin_width, m_skin_height_l, SWP_NOMOVE);
|
||||
m_image = (HBITMAP)LoadImage(NULL, (theApp.m_skin_path + m_skins[m_skin_selected] + L"\\background_l.bmp").c_str(), IMAGE_BITMAP, m_skin_width, m_skin_height_l, LR_LOADFROMFILE);
|
||||
m_skin_preview_l.SetBitmap(m_image);
|
||||
//获取当前皮肤的文字颜色
|
||||
m_text_color = GetPrivateProfileInt(_T("skin"), _T("text_color"), 0, (theApp.m_skin_path + m_skins[m_skin_selected] + L"\\skin.ini").c_str());
|
||||
//获取皮肤作者
|
||||
wchar_t buff[64];
|
||||
GetPrivateProfileString(_T("skin"), _T("skin_author"), _T("unknow"), buff, 64, (theApp.m_skin_path + m_skins[m_skin_selected] + L"\\skin.ini").c_str());
|
||||
SetDlgItemText(IDC_SKIN_INFO, (wstring(L"皮肤作者:") + buff).c_str());
|
||||
}
|
||||
|
||||
void CSkinDlg::SetPreviewText(CStatic& static_preview)
|
||||
{
|
||||
CDC* pDC = static_preview.GetDC();
|
||||
pDC->SetTextColor(m_text_color);
|
||||
pDC->SetBkMode(TRANSPARENT);
|
||||
pDC->SelectObject(this->GetFont());
|
||||
CRect rect;
|
||||
static_preview.GetClientRect(&rect);
|
||||
rect.left += 10;
|
||||
DrawThemeParentBackground(m_hWnd, pDC->GetSafeHdc(), &rect); //重绘控件区域以解决文字重叠的问题
|
||||
pDC->DrawText(_T("示例文本1234ABCD"), rect, DT_VCENTER | DT_SINGLELINE);
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSkinDlg, CDialogEx)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO1, &CSkinDlg::OnCbnSelchangeCombo1)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CSkinDlg 消息处理程序
|
||||
|
||||
BOOL CSkinDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
//初始化选择框
|
||||
for (const auto& skin_path : m_skins)
|
||||
{
|
||||
wstring skin_name;
|
||||
size_t index = skin_path.find_last_of(L'\\');
|
||||
skin_name = skin_path.substr(index + 1);
|
||||
m_select_box.AddString(skin_name.c_str());
|
||||
}
|
||||
m_select_box.SetCurSel(m_skin_selected);
|
||||
//显示预览图片
|
||||
ShowPreview();
|
||||
|
||||
SetTimer(2345, 100, NULL);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
||||
|
||||
|
||||
void CSkinDlg::OnCbnSelchangeCombo1()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
m_skin_selected = m_select_box.GetCurSel();
|
||||
ShowPreview();
|
||||
//显示示例文本
|
||||
SetPreviewText(m_skin_preview_s);
|
||||
SetPreviewText(m_skin_preview_l);
|
||||
}
|
||||
|
||||
|
||||
void CSkinDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
SetPreviewText(m_skin_preview_s);
|
||||
SetPreviewText(m_skin_preview_l);
|
||||
KillTimer(2345); //定时器响应一次后就将其销毁
|
||||
|
||||
CDialogEx::OnTimer(nIDEvent);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#include "afxwin.h"
|
||||
#include"StaticEx.h"
|
||||
|
||||
// CSkinDlg 对话框
|
||||
|
||||
class CSkinDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CSkinDlg)
|
||||
|
||||
public:
|
||||
CSkinDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CSkinDlg();
|
||||
|
||||
vector<wstring> m_skins; //皮肤文件的路径
|
||||
int m_skin_selected; //选择的皮肤
|
||||
int m_skin_width; //预览图宽度
|
||||
int m_skin_height_s; //预览图高度(小)
|
||||
int m_skin_height_l; //预览图高度(大)
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_SKIN_DIALOG };
|
||||
#endif
|
||||
|
||||
COLORREF GetTextColor() const
|
||||
{
|
||||
return m_text_color;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
COLORREF m_text_color; //当前皮肤的文本颜色
|
||||
CComboBox m_select_box; //选择框
|
||||
CStatic m_skin_preview_s; //显示大预览图的控件
|
||||
CStatic m_skin_preview_l; //显示小预览图的控件
|
||||
HBITMAP m_image; //图片句柄
|
||||
//wstring m_skin_author; //皮肤作者
|
||||
|
||||
void ShowPreview(); //显示皮肤预览
|
||||
void SetPreviewText(CStatic& static_preview); //设置预览文字
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnCbnSelchangeCombo1();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
};
|
@ -0,0 +1,210 @@
|
||||
#include "stdafx.h"
|
||||
#include "StaticEx.h"
|
||||
|
||||
|
||||
CStaticEx::CStaticEx()
|
||||
{
|
||||
}
|
||||
|
||||
CStaticEx::CStaticEx(bool is_hyperlink)
|
||||
{
|
||||
m_isHyperLink = is_hyperlink;
|
||||
}
|
||||
|
||||
|
||||
CStaticEx::~CStaticEx()
|
||||
{
|
||||
}
|
||||
|
||||
void CStaticEx::SetWindowTextEx(LPCTSTR lpszString)
|
||||
{
|
||||
CDC* pDC = GetDC();
|
||||
pDC->SetTextColor(m_TextColor);
|
||||
pDC->SetBkMode(TRANSPARENT);
|
||||
pDC->SelectObject(this->GetFont());
|
||||
//int nTextLeft = 0, nTextTop = 0; //文字输出的位置
|
||||
CRect rect;
|
||||
this->GetClientRect(&rect);
|
||||
DrawThemeParentBackground(m_hWnd, pDC->GetSafeHdc(), &rect); //重绘控件区域以解决文字重叠的问题
|
||||
pDC->DrawText(lpszString, rect, DT_VCENTER | DT_SINGLELINE);
|
||||
ReleaseDC(pDC);
|
||||
m_text = lpszString;
|
||||
}
|
||||
|
||||
void CStaticEx::SetTextColor(COLORREF textColor)
|
||||
{
|
||||
m_TextColor = textColor;
|
||||
SetWindowTextEx(m_text);
|
||||
}
|
||||
|
||||
CString CStaticEx::GetString() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
void CStaticEx::SetURL(CString strURL)
|
||||
{
|
||||
m_strURL = strURL;
|
||||
}
|
||||
|
||||
CString CStaticEx::GetURL() const
|
||||
{
|
||||
return m_strURL;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CStaticEx::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// TODO: 在此添加专用代码和/或调用基类
|
||||
if (message == WM_SETTEXT)
|
||||
{
|
||||
CRect rect;
|
||||
CDC* pDC = GetDC();
|
||||
GetClientRect(rect);
|
||||
DrawThemeParentBackground(m_hWnd, pDC->GetSafeHdc(), &rect);
|
||||
ReleaseDC(pDC);
|
||||
}
|
||||
return CStatic::DefWindowProc(message, wParam, lParam);
|
||||
}
|
||||
BEGIN_MESSAGE_MAP(CStaticEx, CStatic)
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_MOUSEHOVER()
|
||||
ON_WM_MOUSELEAVE()
|
||||
ON_WM_SETCURSOR()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
void CStaticEx::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (m_isHyperLink)
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.hwndTrack = m_hWnd;
|
||||
tme.dwFlags = TME_LEAVE | TME_HOVER;
|
||||
tme.dwHoverTime = 1;
|
||||
_TrackMouseEvent(&tme);
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatic::OnMouseMove(nFlags, point);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CStaticEx::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (m_isHyperLink)
|
||||
{
|
||||
if (m_strURL.IsEmpty())
|
||||
{
|
||||
m_strURL = m_text;
|
||||
}
|
||||
ShellExecute(NULL, _T("open"), m_strURL, NULL, NULL, SW_SHOW); //打开超链接
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatic::OnLButtonUp(nFlags, point);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CStaticEx::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
// TODO: 在此处添加消息处理程序代码
|
||||
// 不为绘图消息调用 CStatic::OnPaint()
|
||||
if (m_isHyperLink)
|
||||
{
|
||||
CFont* pFont = GetFont();
|
||||
CFont m_Font;
|
||||
if (pFont != NULL)
|
||||
{
|
||||
LOGFONT lf;
|
||||
pFont->GetLogFont(&lf);
|
||||
lf.lfUnderline = m_bHot;
|
||||
if (m_Font.CreateFontIndirect(&lf))
|
||||
dc.SelectObject(m_Font);
|
||||
}
|
||||
dc.SetTextColor(RGB(0, 0, 255));
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
///准备工作
|
||||
CRect rect;
|
||||
CBrush BGBrush, *pOldBrush;
|
||||
this->GetClientRect(&rect);
|
||||
//画背景
|
||||
COLORREF backColor = GetSysColor(COLOR_BTNFACE);
|
||||
BGBrush.CreateSolidBrush(backColor);
|
||||
pOldBrush = dc.SelectObject(&BGBrush);
|
||||
dc.FillRect(&rect, &BGBrush);
|
||||
dc.SelectObject(pOldBrush);
|
||||
BGBrush.DeleteObject();
|
||||
///输出文字
|
||||
if (m_text.GetLength()>0)
|
||||
{
|
||||
dc.DrawText(m_text, rect, DT_VCENTER | DT_SINGLELINE);
|
||||
}
|
||||
m_Font.DeleteObject();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CStaticEx::OnMouseHover(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (m_isHyperLink && !m_bHot)
|
||||
{
|
||||
m_bHot = true;
|
||||
Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatic::OnMouseHover(nFlags, point);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CStaticEx::OnMouseLeave()
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (m_isHyperLink)
|
||||
{
|
||||
m_bHot = false;
|
||||
Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatic::OnMouseLeave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL CStaticEx::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||
{
|
||||
// TODO: 在此添加消息处理程序代码和/或调用默认值
|
||||
if (m_isHyperLink && m_bHot)
|
||||
{
|
||||
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(32649)));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CStatic::OnSetCursor(pWnd, nHitTest, message);
|
||||
}
|
||||
|
||||
|
||||
void CStaticEx::PreSubclassWindow()
|
||||
{
|
||||
// TODO: 在此添加专用代码和/或调用基类
|
||||
if (m_isHyperLink)
|
||||
{
|
||||
DWORD dwStyle = GetStyle();
|
||||
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
|
||||
}
|
||||
GetWindowText(m_text);
|
||||
|
||||
CStatic::PreSubclassWindow();
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CTaskBarSettingsDlg 对话框
|
||||
|
||||
class CTaskBarSettingsDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CTaskBarSettingsDlg)
|
||||
|
||||
public:
|
||||
CTaskBarSettingsDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CTaskBarSettingsDlg();
|
||||
|
||||
//选项设置数据
|
||||
CString m_font_name;
|
||||
int m_font_size;
|
||||
COLORREF m_text_color;
|
||||
COLORREF m_back_color;
|
||||
wstring m_up_string; //默认为“上传: ”
|
||||
wstring m_down_string; //默认为“下载: ”
|
||||
wstring m_cpu_string; //默认为“CPU: ”
|
||||
wstring m_memory_string; //默认为“内存: ”
|
||||
bool m_swap_up_down; //是否交换上传和下载的位置
|
||||
|
||||
void DrawStaticColor();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_TASKBAR_SETTINGS_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CStatic m_text_color_static;
|
||||
CStatic m_back_color_static;
|
||||
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBnClickedSetFontButton1();
|
||||
afx_msg void OnBnClickedSetColorButton2();
|
||||
afx_msg void OnBnClickedSetColorButton3();
|
||||
afx_msg void OnEnChangeUploadEdit1();
|
||||
afx_msg void OnEnChangeDownloadEdit1();
|
||||
afx_msg void OnEnChangeCpuEdit1();
|
||||
afx_msg void OnEnChangeMemoryEdit1();
|
||||
afx_msg void OnBnClickedSetDefaultButton1();
|
||||
afx_msg void OnBnClickedSwitchUpDownCheck1();
|
||||
};
|
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件\对话框类">
|
||||
<UniqueIdentifier>{ab02c896-0397-42e2-b413-ccc7e470ec13}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\对话框类">
|
||||
<UniqueIdentifier>{296f91e9-59c8-4e1c-9281-b3a5aad240d8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="TrafficMonitor.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TrafficMonitorDlg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StaticEx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TaskBarDlg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DonateDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HistoryTrafficDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="NetworkInfoDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SkinDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MainWndSettingsDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TaskBarSettingsDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OptionsDlg.h">
|
||||
<Filter>头文件\对话框类</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="TrafficMonitor.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrafficMonitorDlg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StaticEx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TaskBarDlg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DonateDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HistoryTrafficDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="NetworkInfoDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SkinDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OptionsDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainWndSettingsDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TaskBarSettingsDlg.cpp">
|
||||
<Filter>源文件\对话框类</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TrafficMonitor.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\TrafficMonitor.rc2">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\TrafficMonitor.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\about_background.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\donate.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\notifyicon.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
@ -0,0 +1,25 @@
|
||||
[config]
|
||||
transparency=80
|
||||
always_on_top=0
|
||||
lock_window_pos=0
|
||||
show_notify_icon=1
|
||||
show_cpu_memory=1
|
||||
mouse_penetrate=0
|
||||
show_task_bar_wnd=1
|
||||
position_x=1830
|
||||
position_y=1316
|
||||
text_color=16384
|
||||
hide_main_window=0
|
||||
skin_selected=.\skins\0ĬÈÏƤ·ô
|
||||
swap_up_down=0
|
||||
font_name=΢ÈíÑźÚ
|
||||
font_size=10
|
||||
[connection]
|
||||
auto_select=1
|
||||
connection_name=Marvell AVASTAR Wireless-AC Network Controller-WFP Native MAC Layer LightWeight Filter-0000
|
||||
[task_bar]
|
||||
task_bar_back_color=0
|
||||
task_bar_text_color=16777215
|
||||
tack_bar_show_cpu_memory=1
|
||||
tack_bar_font_name=΢ÈíÑźÚ
|
||||
tack_bar_font_size=9
|
@ -0,0 +1,24 @@
|
||||
2017/05/29 24958
|
||||
2017/05/29 2000
|
||||
2017/05/25 16310
|
||||
2017/05/25 33
|
||||
2017/05/21 148
|
||||
2017/05/20 1182
|
||||
2017/05/19 777
|
||||
2017/05/19 11
|
||||
2017/05/18 6196
|
||||
2017/05/17 8691
|
||||
2017/05/16 4263
|
||||
2017/05/15 4097
|
||||
2017/05/14 8
|
||||
2017/05/14 43
|
||||
2017/05/13 107
|
||||
2017/05/13 56221
|
||||
2017/05/11 15722
|
||||
2017/05/10 6596
|
||||
2017/05/04 456
|
||||
2017/05/02 123
|
||||
2017/05/02 11
|
||||
2017/04/21 66
|
||||
2017/03/14 32
|
||||
2017/03/14 22
|
@ -0,0 +1,20 @@
|
||||
2017/06/25 0
|
||||
2017/06/04 10
|
||||
2017/05/30 263
|
||||
2017/05/29 58447
|
||||
2017/05/25 16343
|
||||
2017/05/21 148
|
||||
2017/05/20 1182
|
||||
2017/05/19 788
|
||||
2017/05/18 6196
|
||||
2017/05/17 8691
|
||||
2017/05/16 4263
|
||||
2017/05/15 4097
|
||||
2017/05/14 51
|
||||
2017/05/13 56328
|
||||
2017/05/11 15722
|
||||
2017/05/10 6596
|
||||
2017/05/04 456
|
||||
2017/05/02 134
|
||||
2017/04/21 66
|
||||
2017/03/14 54
|
After Width: | Height: | Size: 422 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 204 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,8 @@
|
||||
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// TrafficMonitor.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
@ -0,0 +1,72 @@
|
||||
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||||
|
||||
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC 核心组件和标准组件
|
||||
#include <afxext.h> // MFC 扩展
|
||||
|
||||
|
||||
#include <afxdisp.h> // MFC 自动化类
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
|
||||
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
#include <vector>
|
||||
using std::vector;
|
||||
#include <deque>
|
||||
using std::deque;
|
||||
#include<iostream>
|
||||
#include<fstream>
|
||||
using std::ifstream;
|
||||
using std::ofstream;
|
||||
#include<io.h>
|
||||
#include<algorithm>
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define MY_WM_NOTIFYICON (WM_USER+1001)
|
||||
|
||||
//#define CONFIG_PATH _T(".\\config.ini")
|
||||
//#define CONFIG_PATHA ".\\config.ini"
|
||||
//#define LOG_PATH _T(".\\error.log")
|
||||
//#define HISTORY_TRAFFIC_PATH _T(".\\history_traffic.dat")
|
||||
#define MAX_RESTART_CNT 10 //最大重新初始化次数
|
||||
|
||||
#define MAIN_TIMER 1234 //主定时器的ID
|
||||
#define DELAY_TIMER 1235 //延时定时器ID
|
Before Width: | Height: | Size: 48 KiB |