Install Options (/DLL)
Copyright © 2001 Michael Bishop (original version) and Nullsoft, Inc. (DLL conversion and integration)

Introduction:
Installer Options was a quick application Michael Bishop threw together so he could prompt the user for some information during the install process. This version is a highly modified version of it that is designed as a NSIS extension DLL for the
NSIS installer. Installer Options will create a 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. Example:

	GetTempFileName $R0
	File /oname=$R0 inst.ini
	InstallOptions::dialog $R0
	Pop $0
	; ($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
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 required section is named "Settings". It will contain the following values:

Each field section has the heading "Field #" where # must be sequential numbers from 1 to NumFields. Each Field section contains 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:

	GetDlgItem (output var) (hwnd of the custom dialog) (1200 + field number - 1)
To finally show the tweaked dialog use the show function. Here is a little example:
	# we don't want the DLL to unload so it will remember
	# our ini file when we are trying to show it
	InstallOptions::initDialog /NOUNLOAD file.ini
	Pop $0
	IntCmp $0 0 error
		; $0 is now the IO dialog HWND
		; use getdlgitem with it and sendmessage
		GetDlgItem $1 $0 1200 ; 1200 + field number - 1
		; $1 is now the HWND of the first field
		CreateFont $2 "Tahoma" 10 700 
		SendMessage $1 ${WM_SETFONT} $2 0
		InstallOptions::show
		Pop $0
		StrCmp $0 "success" done
		StrCmp $0 "back" done
		StrCmp $0 "cancel" done
	error:
		MessageBox MB_OK|MB_ICONSTOP "IO error: $0"
		Quit
	done:

History:


  Copyright © 2001 Michael Bishop
  Portions Copyright © 2001 Nullsoft, Inc.

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.