Lyman Zerga
Lyman Zerga

Reputation: 1515

NSIS Invalid command: IDOK/IDCANCEL

I am able to use MessageBox MB_OK and MB_OKCANCEL, but compiler throws an error when I try to use IDOK and IDCANCEL.

My NSIS version is 2.46.

Upvotes: 1

Views: 915

Answers (2)

Slappy
Slappy

Reputation: 5472

(Sorry for this little self promo)

You can use my tool called Visual & Installer (http://www.unsigned-softworks.sk/visual-installer/) to check correct syntax and usage in NSIS script in Visual Studio to avoid such situations:

Visual & Installer

As you can see it has a really nice syntax highlighting, when you move over some command a tooltip is shown and (if you look at Error List) you can see the PROGRAM_NAME was recognized as unused because it was not defined in the script snippet.

Upvotes: 0

Seki
Seki

Reputation: 11465

The basic syntax for calling MessageBox with OK and Cancel buttons is:

MessageBox MB_OKCANCEL "my message" IDOK label_for_ok IDCANCEL label_for_cancel
label_for_ok:
;do some stuff
goto end_label ;for not executing the "cancel" branch

label_for_cancel:
;do some other stuff
end_label:

In this case, as the ok case is just after the Messagebox, you can remove the IDOK label_for_ok and the label at the following line.

Upvotes: 1

Related Questions