Archive: Trouble with MB_YESNOCANCEL for MessageBox


Trouble with MB_YESNOCANCEL for MessageBox
I'm trying to use MessageBox MB_YESNOCANCEL to avoid overwriting a user's data. I have the following statement, which the compiler rejects. Seems like it ought to work. I assume I'm doing something wrong. Any suggestions? How do you make MB_YESNOCANCEL work with only 2-4 parameters?

MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "InvStats.xml exists: Yes=Overwrite No=Keep Cancel=Abort Installation" IDYES StatsOverwrite IDNO StatsNoOverwrite IDCANCEL StatsAbort

MessageBox expects 2-4 parameters, got 8.
Usage: MessageBox mode messagebox_text [return_check label_to_goto_if_equal [return_check2 label2]]
mode=modeflag[|modeflag[|modeflag[...]]]
modeflag=(MB_ABORTRETRYIGNORE|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_YESNO|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND|MB_RIGHT


Oddly, the compiler accepts the line below, and it works ok; it seems to have 6 parameters, which disagrees with the message from the MB_YESNOCANCEL problem in the previous post ???

MessageBox MB_YESNO|MB_ICONQUESTION "InvStats.xml exists: Yes=Overwrite (Progress and How Often to Recite lost) No=Keep Current File" IDYES StatsOverwrite IDNO StatsNoOverwrite


Paraclete,

take a look at the documentation. You can at most specify 2 labels to jump to. The other option (might be cancel) is the one where no jump will occur and the script will continue.

Eg. use:
MessageBox MB_YESNOCANCEL "Question?" IdYes YESS IdNo NOO
;cancel has been clicked...
Quit
IdYes:
hsdkjgh
IdNo:
ednjhkjdf

Good luck,
Hendri.


Thanks Hendri for the answer ... and the gentle nudge to read the documentation. I should have figured that one out.

It does seem like the compiler error message could be improved, as it indicated MessageBox expected 2 to 4 paramters, when 6 is allowed for certain MB_ options. I'll put in a developer request note. Just a nit for an outstanding piece of software ...

I combined your suggestion with several others I've received this morning (you guys have INCREDIBLE response) as follows:

MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "InvStats.xml exists: \
$\r$\nYes=Overwrite (Progress and How Often to Recite lost) \
$\r$\nNo=Keep Current File \
$\r$\nCancel=Abort Installation" IDYES StatsOverwrite IDNO StatsNoOverwrite
;StatsAbortPseudoLabel:
Abort "Cancelling installation"
StatsOverwrite:
File InstallData\InvStats.xml
StatsNoOverwrite: ; continue on to other files
File InstallData\InvInfo.xml

Thanks for the "rapid response" You guys are GOOD!
Prov 15:23 (NIV) A man finds joy in giving an apt reply-- and how good is a timely word!

Thx for the help. Nsis is one of the nicer utilities to work with because of the outstanding support and user/developer participation. :up: