📄 procguard.h
字号:
#ifndef ProcGuard_H_
#define ProcGuard_H_
//---------------------------------------------------------------------------
#define CFGFILE "../etc/procGuard.ini"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include "../class/iniFile.h"
#ifdef _WIN32
#include <windows.h>
#include <process.h>
#include <tlhelp32.h>
#else
#include <unistd.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
using namespace std;
typedef struct
{
string strNam;
string strPath;
bool bRuning;
}tagProcInfo;
typedef struct
{
int iProcessId;
char acProcessName[128];
float fCpu;
float fMem;
}ProcessHealthStatus;
class CProcGuard
{
public:
CProcGuard();
~CProcGuard();
private:
string m_strTmpfName;
list<tagProcInfo *> m_lstProc;
vector<tagProcInfo *> m_arrProc;
int m_nProcess; // 进程数目
int m_nDelaytm; // 等待延时(s)
private:
bool AddProc(string str);
bool StartupProc(tagProcInfo *pProc);
bool loadConfig();
public:
bool IsProcRuning(tagProcInfo *pProc);
void Run();
int ProcessWatch();
int ProcessHealthWatch(ProcessHealthStatus *pstProcessHealth,int *iCount);
int KillProcess(int iProcessId);
int IsNetActive();
int LinkTest(char *szLinkString,int iCount);
int DialWatch();
int m_nLinkType;
char m_strLinkType[256]; //CDMA,GRPS,ADSL,ETHERNET
char m_strLinkTest1[256];
char m_strLinkTest2[256];
};
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -