|
|
@@ -1,5 +1,7 @@
|
|
|
#pragma once
|
|
|
|
|
|
+#include "../pch/pch.h"
|
|
|
+
|
|
|
class CSystem
|
|
|
{
|
|
|
public:
|
|
|
@@ -36,21 +38,13 @@ public:
|
|
|
TCHAR strExeFullDir[MAX_PATH];
|
|
|
GetModuleFileName(NULL, strExeFullDir, MAX_PATH);
|
|
|
|
|
|
- //3、判断注册表项是否已经存在
|
|
|
- TCHAR strDir[MAX_PATH] = {};
|
|
|
- DWORD nLength = MAX_PATH;
|
|
|
- long result = RegGetValue(hKey, nullptr, L"智铺子收银软件", RRF_RT_REG_SZ, 0, strDir, &nLength);
|
|
|
-
|
|
|
- //4、已经存在
|
|
|
- if(result != ERROR_SUCCESS || _tcscmp(strExeFullDir, strDir) != 0)
|
|
|
- {
|
|
|
- //5、添加一个子Key,并设置值,"GISRestart"是应用程序名字(不加后缀.exe)
|
|
|
- RegSetValueEx(hKey, L"智铺子收银软件", 0, REG_SZ, (LPBYTE)strExeFullDir, (lstrlen(strExeFullDir) + 1) * sizeof(TCHAR));
|
|
|
+ //3、添加一个子Key,并设置值,"GISRestart"是应用程序名字(不加后缀.exe)
|
|
|
+ RegSetValueEx(hKey, L"智铺子收银软件", 0, REG_SZ, (LPBYTE)strExeFullDir, (lstrlen(strExeFullDir) + 1) * sizeof(TCHAR));
|
|
|
|
|
|
- //6、关闭注册表
|
|
|
- RegCloseKey(hKey);
|
|
|
- }
|
|
|
+ //4、关闭注册表
|
|
|
+ RegCloseKey(hKey);
|
|
|
}
|
|
|
+
|
|
|
else
|
|
|
{
|
|
|
cout << "系统参数错误, 不能随系统启动";
|