/*! *FileName: SystemTool.h *Author: Pan Yingdong *Email: bob.pan@hzleaper.com *Created:2020/6/15 15:14 *Note: */ #ifndef _H_SYSTEMTOOL_H_ #define _H_SYSTEMTOOL_H_ #include #include #include #include #include #include #define PSAPI_VERSION 1 #include #pragma comment(lib,"psapi.lib") #include #include namespace SystemTool {/*bReset == true ÖØÆô; false ¹Ø»ú*/ bool SystemShutDown(bool bReset); inline char* UnicodeToAnsi(const wchar_t* szStr) { int nLen = WideCharToMultiByte(CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL); if (nLen == 0) { return NULL; } char* pResult = new char[nLen]; WideCharToMultiByte(CP_ACP, 0, szStr, -1, pResult, nLen, NULL, NULL); return pResult; } std::string TCHAR2STRING(TCHAR *STR); bool isProcessRunning(const char* processName); void GetProcessPath(DWORD dwProcessID, TCHAR* buffer); std::vector getPIDByName(const char* processName); void killZombieProcess(const char *curAppName); QString SecondTimeString(quint64 value); void ReflashBarIcon(); } #endif