Archive: Problem with LogicLib Cmd/IfCmd and MessageBox


Problem with LogicLib Cmd/IfCmd and MessageBox
Hi,

I'm using Logiclib in my NSIS installers wherever I can. It greatly helps to improve readability.
Now I got a problem where I think that there might be a bug in LogicLib or at least some some documentation missing.

I stumbled upon this while trying to use


${Switch}
${Case} '0'
${IfCmd} MessageBox MB_ICONQUESTION|MB_YESNO "$2" /SD IDYES ${||} ${Break} ${|}
; some other code
${Break}

; :
${EndSwitch}
or

${If} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO "$2" /SD IDYES `


First I thought it was the | between the MB_xxx mode options, but then I tried the LogicLib.nsi example.

The example for IfCmd and Cmd in Examples\LogicLib.nsi works fine, even when adding MB_ICONQUESTION|
But when one adds the /SD parameter to the MessageBox it won't compile anymore.

Is there a way to pass the /SD through the macros, or is this a "bug"?

I need the /SD to prevent any Mesagebox to pop up during silent installation.

Not sure why /SD is not supported, but you can check for a silent installer before calling the messagebox using ${If} ${Silent}


Hi jpderuiter,

good idea! Replacing /SD with ${If} ${Silent}

Let's me use LogicLib without caring about /SD.
Using inverted logic the code looks like this:


${Switch} $1
${Case} '0'
${IfNot} ${Silent}
StrCpy $2 "This version of ${MYNAME} is already installed. $\n"
StrCpy $2 "$2Do you want to reinstall?"
${IfNot} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO "$2" IDYES `
Call closelog
Abort
${Break}
${EndIf}
${EndIf}
StrCpy $2 ""
${Break}




Thanks!