📄 portmonview.h
字号:
// PortMonView.h : CPortMonView 类的接口
//
#pragma once
#include "psapi.h"
#include "iphlpapi.h"
#include "ipstructs.h"
#include "callbackhandler.h"
#include "applicationscope.h"
#include "ProcList.h"
#include "viewext.h"
#define ID_TIMER_REFRESH 0x1
enum _NETPROTO
{
enTCP = 1,
enUDP,
};
enum _NETPROCITEM
{
COL_NETPID = 0,
COL_PROTOCOL,
COL_LOCALIP,
COL_LOCALPORT,
COL_REMOTEIP,
COL_REMOTEPORT,
COL_STATE,
COL_NETPATH,
COL_NETMAX
};
enum _PROCITEM
{
COL_PID = 0,
COL_PRIORITY,
COL_THREADS,
COL_MEMUSAGE,
COL_PATH,
COL_SYSMAX
};
class CPortMonView : public CViewExt
{
protected: // 仅从序列化创建
CPortMonView();
DECLARE_DYNCREATE(CPortMonView)
// 属性
public:
CPortMonDoc* GetDocument() const;
// 操作
public:
void AddAllNetProc(void);
void AddAllProc(void);
void AddProcessCreated(DWORD dwProcID);
void RemoveProcByID(DWORD dwProcID);
void FillProcKey(PROCKEY_S *pstProcKey, int nItem);
BOOL ProcExists(PROCKEY_S *pstProcKey);
void AddNetProcCreated(NETPROC_S *pstNetProc);
void UpdateListView(void);
void UpdateNetProc(void);
CString GetNetProcInfo(NETPROC_S* pNetProc, int nColumn);
CString GetSysProcInfo(SYSPROC_S* pSysProc, int nColumn);
void SaveList(CArchive &ar);
CString GetTargetAddress(void);
void UpdateIpAddrCombo(int nItem);
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual int CompareItems(LPARAM lParam1, LPARAM lParam2, int nColumn);
virtual CString GetListInfo(LPARAM lParam, int nColumn);
virtual void DoDefault(void);
virtual void OnItemChanged(int nItem);
protected:
virtual void OnInitialUpdate(); // 构造后第一次调用
// 实现
public:
virtual ~CPortMonView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
PROCALLOCATEANDGETTCPEXTABLEFROMSTACK m_pfnAllocateAndGetTcpExTable;
PROCALLOCATEANDGETUDPEXTABLEFROMSTACK m_pfnAllocateAndGetUdpExTable;
HMODULE m_hLibModule;
CMutex m_mutexList;
CMyCallbackHandler m_obCallbackHdler;
CCallbackParam m_obViewParam;
CApplicationScope &m_obAppScope;
CProcList m_lstNetProc;
protected:
BOOL LoadExIpHelperProcedures(void);
// 生成的消息映射函数
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnOperCloseProc();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnUpdateOperCloseProc(CCmdUI *pCmdUI);
afx_msg void OnOperPrev();
afx_msg void OnOperNext();
afx_msg void OnUpdateOperPrev(CCmdUI *pCmdUI);
afx_msg void OnUpdateOperNext(CCmdUI *pCmdUI);
afx_msg void OnToolPing();
afx_msg void OnUpdateToolPing(CCmdUI *pCmdUI);
afx_msg void OnToolTracert();
afx_msg void OnUpdateToolTracert(CCmdUI *pCmdUI);
afx_msg void OnComboIpAddrEnter();
afx_msg void OnUpdateComboIpAddrEnter(CCmdUI *pCmdUI);
afx_msg void OnOperOpenPath();
afx_msg void OnUpdateOperOpenPath(CCmdUI *pCmdUI);
afx_msg void OnDestroy();
afx_msg void OnToolWhois();
afx_msg void OnUpdateToolWhois(CCmdUI *pCmdUI);
afx_msg LRESULT OnProcNotify( WPARAM wParam, LPARAM lParam );
private:
int CompNetProcItem(NETPROC_S *pProc1, NETPROC_S *pProc2, int nColumn);
int CompSysProcItem(SYSPROC_S *pProc1, SYSPROC_S *pProc2, int nColumn);
BOOL DoNetOpera(int nNetOper);
int BigNumCompare(DWORD dwNum1, DWORD dwNum2)
{
return ( ( dwNum1 < dwNum2 ) ? -1 : ( ( dwNum1 > dwNum2 ) ? 1 : 0 ) );
}
};
#ifndef _DEBUG // PortMonView.cpp 的调试版本
inline CPortMonDoc* CPortMonView::GetDocument() const
{ return reinterpret_cast<CPortMonDoc*>(m_pDocument); }
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -