44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#ifndef ZOOST_OS_WIN_H
|
|
#define ZOOST_OS_WIN_H
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
class zoostWinService
|
|
{
|
|
public:
|
|
static std::string GetLastErrorMsg();
|
|
static bool WinInstallService();
|
|
static bool WinUninstallService();
|
|
static bool WinStartService();
|
|
static bool WinStopService();
|
|
static void WinServiceRun();
|
|
static void ExportEventMsg(const std::string& msg);
|
|
|
|
public:
|
|
// 服务名称。
|
|
static std::string serviceName_;
|
|
// 服务描述
|
|
static std::string dispName_;
|
|
// 程序路径
|
|
static std::string exePath_;
|
|
// 默认 5000 毫秒执行一次 exeFunc_。
|
|
static unsigned int timeoutVal;
|
|
// exeFunc_ 是周期执行的函数,必须设定,不能为空指针。
|
|
static std::function<void()> exeFunc_;
|
|
// stopFunc_ 必须设定,不能为空指针。
|
|
static std::function<void()> stopFunc_;
|
|
};
|
|
|
|
class zoostWinUtil
|
|
{
|
|
public:
|
|
zoostWinUtil() = default;
|
|
~zoostWinUtil() = default;
|
|
|
|
public:
|
|
static std::string U82Ansi(const std::string& str);
|
|
static std::string Ansi2U8(const std::string& str);
|
|
};
|
|
|
|
#endif // ZOOST_OS_WIN_H
|