Archive: Activation page component


Activation page component
Hi all,

my boss want to add a registration step (like in a good commercial software he said :))during installation, so I think I add to create some kind of activation page between MUI_PAGE_LICENSE and MUI_PAGE_DIRECTORY:

----------------------------------
|Registration X|
----------------------------------
| |
| Name: |
| Company: |
| Serial Number: |
| |
| OK Cancel |
----------------------------------

What am I wondering is
- someone has already done that ?
- and more generally if there is a location (other than the examples directory of course) to find scripts that provide a new functionnality in open source?

I am using the MUI.

thanks a lot guys


The Contrib folder contains examples for the plug-ins. Among those plug-ins is InstallOptions which is exactly what you need. Examples\Modern UI\InstallOptions.nsi is also an InstallOptions example.


thanks, I missed this tuto (the name is not very correlated...)

My second question is still interrogating me :)
It would be very nice if such a location exists


Well, that's the Contrib folder. There is also The Archive.


ah ok :)

I have another -silly- question, this time on the custom page I create: how do I do multilingual pages?

I mean how do I, for example, decide the caption of a label in function of the user selected language?

thanks for your ultra fast answers


Write a LangString to the INI using WriteINIStr or the MUI macro (MUI_INSTALLOPTIONS_WRITE, I think).


could you be more specific please?

for example, taking ioB.ini, how do I put a multilingual text for the label?

//////ioB.ini//////////
[Settings]
NumFields=1

[Field 1]
Type=label
Text=Install Options Page B
Left=0
Right=-1
Top=0
Bottom=10
////////////////////////

I tried Text=LangString ${LANG_ENGLISH} "Install Page B"
but this doesnot work.

I believe I misunderstand your answer :(


oh my god I did a mistake in typing the msg:
I tried
Text=LangString ${LANG_ENGLISH} "Install Page B"
Text=LangString ${LANG_FRENCH} "Page d'installation B"


You need to write it using WriteINIStr or the MUI macro on runtime. That is, before you show the page, before you call InstallOptions to parse the INI, write the LangString into the text/state field.

WriteINIStr $PLUGINSDIR\mypage.ini "Field 4" "Text" "$(MyLangString)"


I have managed to add in the serial code checking. But I have 2 questions:
(1) The serial code page can still be skipped when the installer is executed in DOS using the /S switch. How do I overcome that?
(2) I authenticate the serial code using the StrCmp instruction. But StrCmp is non-case sensitive. How do I make a case sensitive comparison?

Please advice.


To use a case sensitive comparison you will have to use the system plugin with the appropriate API call or alternatively write a plugin for NSIS.

Vytautas


As to silent (/S switch) run, you can place code in .onInit to check for (= require) the serial code on the command line or otherwise emit a warning and exit.


Originally posted by jamesgoh
I have managed to add in the serial code checking.
Can I ask you how you did?

My problem is that I do not know how to catch the NextButton click (i.e I do not know where to put my code for the checking).

Check the documentation about the leave function you can define for any page in NSIS. You should place your check in that function and if the serial is incorrect use the abort command to prevent the installer from advancing to the next page.

Vytautas ;)


You can disable the Next button if the serial is invalid using EnableWindow, but that alone is not very secure. Therefore you should also check the serial again in the leave funtion and Abort if the serial is invalid.


thanks guys for your quick answers, it helped me a lot (I just missed the leave_function parameter of the Page function). :)

Now, I have another problem which is the dynamic update of my page (i.e write the registration code after the user click on Generate)

I join my scripts to this post with a #FIXME in activ.nsi at the place where I want to add this stuff.

I think that I should use SendMessage but my tries in this area stay unsuccessful.:(

Thanks again for the previous help.


You need to use SendMessage <hwnd> ${WM_SETTEXT} 0 "STR:$1". To get the hwnd use GetDlgItem along with the hwnd of the InstallOptions dialog. To get the hwnd of the InstallOptions dialog see the example to set InstallOptions font in the MUI readme.


thank you very much, this is perfectly working now :)