|
|
@@ -13,16 +13,16 @@ public:
|
|
|
//程序休眠X秒
|
|
|
static void my_sleep(int second);
|
|
|
|
|
|
- static std::wstring getExePath()
|
|
|
- {
|
|
|
- wchar_t exeFullPath[MAX_PATH]; // Full path
|
|
|
- std::wstring strPath = L"";
|
|
|
+ static std::wstring getExePath()
|
|
|
+ {
|
|
|
+ wchar_t exeFullPath[MAX_PATH]; // Full path
|
|
|
+ std::wstring strPath = L"";
|
|
|
|
|
|
- GetModuleFileName(NULL, exeFullPath, MAX_PATH);
|
|
|
- strPath = (wstring)exeFullPath; // Get full path of the file
|
|
|
+ GetModuleFileName(NULL, exeFullPath, MAX_PATH);
|
|
|
+ strPath = (wstring)exeFullPath; // Get full path of the file
|
|
|
|
|
|
- return strPath;
|
|
|
- }
|
|
|
+ return strPath;
|
|
|
+ }
|
|
|
|
|
|
static std::wstring GetProgramDir()
|
|
|
{
|
|
|
@@ -79,6 +79,32 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ static bool IsAutoStart()
|
|
|
+ {
|
|
|
+ HKEY hKey;
|
|
|
+ wstring strRegPath = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
|
+
|
|
|
+ //1、找到系统的启动项
|
|
|
+ if(RegOpenKeyEx(HKEY_CURRENT_USER, strRegPath.c_str(), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
|
|
|
+ {
|
|
|
+ char dwValue[256];
|
|
|
+ DWORD dwSzType = REG_SZ;
|
|
|
+ DWORD dwSize = sizeof(dwValue);
|
|
|
+
|
|
|
+ if(::RegQueryValueEx(hKey, _T("乐外卖接单软件"), 0, &dwSzType, (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //关闭注册表
|
|
|
+ RegCloseKey(hKey);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
// 判断文件是否存在
|
|
|
static BOOL IsFileExist(const wstring& csFile)
|
|
|
{
|