Browse Source

安装脚本加入进程判断

zhangyang 6 years ago
parent
commit
7c5a6fd04f

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


BIN
bin/Win32/Release/setup/zhipuzi_pos_windows_setup_1.0.0.1.exe


+ 28 - 3
bin/Win32/Release/setup/智铺子收银软件安装脚本.nsi

@@ -2,7 +2,7 @@
 
 ; HM NIS Edit Wizard helper defines
 !define PRODUCT_NAME "智铺子收银软件"
-!define PRODUCT_VERSION "1.1.0.0"
+!define PRODUCT_VERSION "1.0.0.1"
 !define PRODUCT_PUBLISHER "深圳市迅享智慧云科技有限公司"
 !define PRODUCT_WEB_SITE "https://www.zhipuzi.com"
 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}.exe"
@@ -87,15 +87,40 @@ Section -Post
   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
 SectionEnd
 
-
 Function un.onUninstSuccess
   HideWindow
   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
 FunctionEnd
 
+Function .onInit
+  ;关闭进程
+  Push $R0
+  CheckProc:
+    Push "zhipuzi_pos_windows.exe"
+    ProcessWork::existsprocess
+    Pop $R0
+    IntCmp $R0 0 Done
+    MessageBox MB_OKCANCEL|MB_ICONSTOP "安装程序检测到 ${PRODUCT_NAME} 正在运行。$\r$\n$\r$\n点击 “确定” 强制关闭${PRODUCT_NAME},继续安装。$\r$\n点击 “取消” 退出安装程序。" IDCANCEL Exit
+    Push "zhipuzi_pos_windows.exe"
+    Processwork::KillProcess
+    Sleep 1000
+    Goto CheckProc
+    Exit:
+    Abort
+    Done:
+    Pop $R0
+FunctionEnd
+
 Function un.onInit
-  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "您确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2
   Abort
+  ;检测程序是否运行
+  FindProcDLL::FindProc "zhipuzi_pos_windows.exe"
+   Pop $R0
+   IntCmp $R0 1 0 no_run
+   MessageBox MB_ICONSTOP "卸载程序检测到 ${PRODUCT_NAME} 正在运行,请关闭之后再卸载!"
+   Quit
+   no_run:
 FunctionEnd
 
 Section Uninstall  

BIN
bin/Win32/Release/zhipuzi_pos_windows/db/pos.db


+ 3 - 0
bin/Win32/Release/zhipuzi_pos_windows/log/pos.log

@@ -4,3 +4,6 @@
 2019-05-23 14:35:34[INFO] - create table success [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:256]
 2019-05-23 14:35:34[INFO] - Opened database successfully [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:29]
 2019-05-23 14:35:34[INFO] - save params success [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:325]
+2019-05-25 20:34:54[INFO] - Opened database successfully [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:29]
+2019-05-25 20:34:54[INFO] - Opened database successfully [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:29]
+2019-05-25 20:34:54[INFO] - save params success [e:\work\code\zhipuzi_pos_windows\zhipuzi_pos_windows\tool\csqlite3.cpp:325]