- NSIS Discussion
- Mb_yesno
Archive: Mb_yesno
torpark
4th November 2006 13:50 UTC
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
kichik
4th November 2006 13:55 UTC
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.
torpark
4th November 2006 14:19 UTC
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
kichik
4th November 2006 14:24 UTC
It's minimal, but it's not complete. I can not compile it.
DebugHeader is called before FindProcDLL::FindProc which can change $R0.
torpark
4th November 2006 15:28 UTC
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
torpark
4th November 2006 15:30 UTC
Here is the full code.
kichik
4th November 2006 15:59 UTC
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?
torpark
4th November 2006 16:31 UTC
Sorry for the confusion. I am running NSIS 2.21.
kichik
4th November 2006 16:53 UTC
So back to square one. I need an example. Does adding `SilentInstall silent` to the example I posted above reproduce the problem?
torpark
4th November 2006 17:12 UTC
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.
kichik
4th November 2006 17:18 UTC
In that case, I'm fresh out of ideas.
torpark
4th November 2006 17:25 UTC
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
kichik
4th November 2006 17:27 UTC
You can first copy the message to a variable, or use a constant for it to get a shorter and cleaner line.