问题
Newbee in NSIS, I was trying to implement the nsProcess plugin to check whether the current application is working or not ! I was successful in implementing the same in an example code, but when i tried implementing the same in my project i am getting an un expected output as shown in the Image message box below !! why am i getting this ?? please can anyone guide me. Thanks for the help in advance :)
Project Snipet!
!include "MUI2.nsh"
;!include "MUI.nsh"
!include LogicLib.nsh
!include "StrFunc.nsh"
!include "FileFunc.nsh"
!include WinMessages.nsh
!include "nsProcess.nsh"
;!include "FindProcess.nsh"
#Dummy Section
...
#EndSecton
!macro CheckAppRunning_ _FILE _ERR
App_Running_Check:
${nsProcess::FindProcess} "MyApp.exe" $R0
MessageBox MB_OK "$R0"
${If} $R0 == 0
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Please stop App.exe before continuing" /SD IDCANCEL IDRETRY App_Running_Check
Quit
${EndIf}
notRunning:
!macroend
Function .onInit
!insertmacro CheckAppRunning_ `MyApp.exe` $R0
FunctionEnd
$R0 returns this value!!! why ???
回答1:
This is most likely a ANSI vs Unicode compiler/plug-in mismatch.
If you are using NSIS v2 then you need to extract the correct plug-in version from the .zip (ANSI unless you are using a 3rd-party NSIS fork) into the plugin folder. If you are using NSIS v3 then there is a plug-in subfolder for each type, make sure you put the correct plug-in in each subfolder. The Unicode plug-in .dll is often in a Unicode subfolder or has a 'W' suffix in the filename in the .zip archive.
来源:https://stackoverflow.com/questions/43516081/nsis-nsprocess-unexpected-output