Files
cxxLibrary/include/zoost/zt.os_win.h

44 lines
1.1 KiB
C
Raw Normal View History

2026-03-29 19:02:44 +08:00
#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