Archive: Mb_yesno


Mb_yesno
I'm having a small problem with a YESNO box. Sometimes it doesn't pop-up and goes directly to the IDNO value.

FoundProgramEXE: ;Check and see if client is running
StrCpy $PROCEDURE "FoundProgramEXE"
Call DebugHeader
FindProcDLL::FindProc $PROGRAMEXECUTABLE
StrCmp $R0 "1" "" ProfileWork
;=== client is already running, check if it is using
; the portable profile
MessageBox MB_YESNO|MB_ICONQUESTION|MB_TOPMOST `${APP} is \
already running. Close ${APP} and continue starting \
${FULLNAME}?` IDNO UnloadTorpark IDYES KeepLoadingTorpark

Are you sure it doesn't just skip the message box because $R0 isn't 1? If so, attach a complete minimal example reproducing the problem.


This is the most minimal example. The problem is that the issue isn't consistent.

And yes, I'm sure it isn't because $R0 isn't 1. I have a DebugHeader at the beginning of every procedure and my log is this:

...
FoundProgramEXE
UnloadTorpark


It's minimal, but it's not complete. I can not compile it.

DebugHeader is called before FindProcDLL::FindProc which can change $R0.


Function DebugHeader
StrCmp $DEBUGON 1 "" +2
MessageBox MB_OK|MB_ICONINFORMATION `Running $PROCEDURE`
StrCmp $DEBUGON 2 "" +4
${time::GetLocalTime} $R7
FileWrite $6 "$R7 $PROCEDURE$\n"
ClearErrors
FunctionEnd

Here is the full code.


That's definitely not minimal. I can not compile it and it's pretty large. The idea behind "complete minimal example reproducing the problem" is that you give whoever is trying to help you a small script which he can compile. That script should show only the problem and contain nothing else. It saves both of us time. You might find out the answer on your own while searching for the cause and I, or whoever is helping you, will have less to work on so you can get a faster answer. In this case, a complete minimal example would have been:

Name test
OutFile test.exe
Section
MessageBox MB_TOPMOST test # this won't show
SectionEnd
Back to the problem itself, it looks to me like you've run into an old bug which has been fixed for version 2.15. Which version are you using?

Sorry for the confusion. I am running NSIS 2.21.


So back to square one. I need an example. Does adding `SilentInstall silent` to the example I posted above reproduce the problem?


Like I said, the problem cannot be reproduced reliably, as sometimes the compiled executable behaves and sometimes it misbehaves. But the program by default includes SilentInstall silent. When I add "silentinstall silent" to the program, that does not reproduce the error.


In that case, I'm fresh out of ideas.


Is there a cleaner syntax I could be using than:


MessageBox MB_YESNO|MB_ICONQUESTION|MB_TOPMOST `${APP} is
already running. Close ${APP} and continue starting
${FULLNAME}?` IDNO UnloadTorpark IDYES KeepLoadingTorpark

You can first copy the message to a variable, or use a constant for it to get a shorter and cleaner line.