From 6f600e4485db109a2fd2b5919dfd232da8664986 Mon Sep 17 00:00:00 2001 From: joostverburg Date: Sat, 14 Dec 2002 00:10:29 +0000 Subject: [PATCH] Install Options DLL 2.0 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1948 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/InstallOptions/Install Options.html | 41 ++++++++++------ Contrib/InstallOptions/InstallerOptions.cpp | 51 +++++++++++++------- Contrib/InstallOptions/test.ini | 26 +++++----- Plugins/InstallOptions.dll | Bin 11264 -> 12288 bytes 4 files changed, 74 insertions(+), 44 deletions(-) diff --git a/Contrib/InstallOptions/Install Options.html b/Contrib/InstallOptions/Install Options.html index 5944e2a3..84b717ec 100644 --- a/Contrib/InstallOptions/Install Options.html +++ b/Contrib/InstallOptions/Install Options.html @@ -22,24 +22,27 @@ href="http://www.nullsoft.com/free/nsis/">NSIS installer. Installer Options dialog box which will be displayed inside of the NSIS window. The dialog box is defined by an INI file, which allows you to define the layout of controls by changing the INI file. -

To use the DLL, you should include it as part of your installation. -Extract it to known location (probably $TEMP), and then load it using CallInstDLL, passing one parameter on the stack. -The one parameter is a name of an .ini file that defines the window. +

Using the new NSIS 2 plugin system, you don't have to worry about extracting and removing +the DLL anymore. You can also use the Plugins directory to store the INI files. The contents +of the directory will be removed when the installer is being closed. + Example:

-	GetTempFileName $R0
-	File /oname=$R0 inst.ini
-	InstallOptions::dialog $R0
+	;Extract INI File to Plugins directory
+	InitPluginsDir
+	File /oname=$PLUGINSDIR\test.ini test.ini
+	
+	InstallOptions::dialog $PLUGINSDIR\test.ini
 	Pop $0
-	; ($0 would be "success" "cancel" "back" or some other value on error.
+	; ($0 would be "success" "cancel" "back" or some other value on error)
 
-	ReadINIStr $1 $R0 "Field 1" State ; $1 = field #1's state
-
-	Delete $R0
+	ReadINIStr $1 $R0 "Field 1" State ; $1 = Field #1's state
 
It is often very useful to call InstallOptions from a NSIS custom page callback function.
INI File Settings: -

The INI file has one required section. This section includes the number of controls to be created as well as general window attributes. The INI file also includes a variable number of Field sections which are used to create the controls to be displayed. +

The INI file has one required section. This section includes the number of controls to +be created as well as general window attributes. The INI file also includes a variable number +of Field sections which are used to create the controls to be displayed.

The required section is named "Settings". It will contain the following values:


Fonts and colors: -

InstallOptions supports the new UI enhancements in the new NSIS 2. To support them, InstallOptions now has two new functions, initDialog, and show. The first creates the dialog but doesn't show it. It pushes the HWND of the custom dialog to the stack. To get the HWND of any of the controls use:

+

InstallOptions supports the new UI enhancements in the new NSIS 2. To support them, +InstallOptions now has two new functions, initDialog, and show. +The first creates the dialog but doesn't show it. It pushes the HWND of the custom dialog to the stack. +To get the HWND of any of the controls use:

	GetDlgItem (output var) (hwnd of the custom dialog) (1200 + field number - 1)
To finally show the tweaked dialog use the show function. @@ -286,6 +294,11 @@ Here is a little example:
History: