Thanks to some of the predecessors of the sharing, and then according to the resources on the Internet, read and test their own test project.
In order to facilitate their next search and use, but also to facilitate the reference of others to write this article.
//=========================================================================== //
File Name:Setup.rul
//
Description:blank Setup Main script file
//
Comments:blank Setup is an empty setup project. If you want to
Create a new project via. step-by step instructions Use the
Project Assistant.
//
//===========================================================================
#define EXAMPLE_DIR "D:\\ptc\\ceannotation"//is not used, you want to use a macro definition
Included Header Files----------------------------------------------------
#include "ifx.h"
Note:in order to your InstallScript function executed as a custom
Action by the Windows Installer, it must is prototyped as an
Entry-point function.
The keyword export identifies MyFunction () as an entry-point function.
The argument it accepts must is a handle to the Installer database.
/* Export prototype MyFunction (HWND); */
Setup interface for the installer
function Onbegin ()
Begin
Clear ALLUSERS if specified in the command line.
if (cmdline% "Allusers=false") Then
ALLUSERS = FALSE;
endif
End
Each dialog box that is installed handles
function Onfirstuibefore ()
Number Nresult, Nlevel, NSize, Nsetuptype, Nuser;
String SzTitle, szmsg, SZOPT1, SzOpt2, Szlicensefile;
String SzName, Szcompany, Sztargetpath, Szdir, szfeatures;
BOOL blicenseaccepted;
Begin
The user clicks Cancel, does not do any processing
if (removeonly) then
Disable (Dialogcache);
szmsg = sdloadstring (ids_ifx_error_product_not_installed_uninst);
Sdsubstituteproductinfo (szmsg);
MessageBox (szmsg, SEVERE);
Abort
endif
Nsetuptype = complete;
Szdir = TARGETDIR;
SzName = "";
Szcompany = "";
blicenseaccepted = FALSE;
Beginning of UI Sequence
Dlg_start:
Nresult = 0;
Welcome screen of the installation Wizard
Dlg_sdwelcome:
SzTitle = "";
szmsg = "";
{{Is_script_tag (dlg_sdwelcome)
Nresult = SdWelcome (SzTitle, szmsg);
}}is_script_tag (Dlg_sdwelcome)
if (nresult = back) goto Dlg_start;
Licensing interface
DLG_SDLICENSE2:
SzTitle = "";
SZOPT1 = "";
SzOpt2 = "";
{{Is_script_tag (License_file_path)
License file, a licence.rtf inserted in behavior and logic/support files/billboards/simplified
The file can be written on its own, the corresponding installation of the interface to display the corresponding content
Szlicensefile = supportdir ^ "License.rtf";
}}is_script_tag (License_file_path)
{{Is_script_tag (DLG_SDLICENSE2)
Nresult = Sdlicense2rtf (SzTitle, SZOPT1, SzOpt2, Szlicensefile, blicenseaccepted);
}}is_script_tag (DLG_SDLICENSE2)
if (nresult = back) Then
Goto Dlg_sdwelcome; Go directly to
Else
blicenseaccepted = TRUE;
endif
/*
Dlg_sdaskdestpath2:
Nsetuptype = CUSTOM;
if (Nresult = back) && (nsetuptype! = CUSTOM)) goto Dlg_sdlicense2;
SzTitle = "";
szmsg = "";
if (Nsetuptype = CUSTOM) Then
{{Is_script_tag (dlg_sdaskdestpath2)
Nresult = SdAskDestPath2 (SzTitle, szmsg, szdir);
}}is_script_tag (DLG_SDASKDESTPATH2)
TARGETDIR = Szdir;
endif
if (nresult = back) goto dlg_setuptype2;
*/
Set up the installation interface to help users specify the installation directory
Dlg_sdaskdestpath2:
Sztitle= "System installation directory";
Szmsg= "Select the D:\\PTC directory to start the program!";
Szdir= "D:\\PTC";
Setting the installation path
Nresult = SdAskDestPath2 (SzTitle, szmsg, szdir);
TARGETDIR = Szdir;
if ((Nresult = back)) goto Dlg_sdlicense2;
Copy all Files
Dlg_sdstartcopy2:
SzTitle = "";
szmsg = "";
{{Is_script_tag (dlg_sdstartcopy2)
Nresult = SdStartCopy2 (SzTitle, szmsg);
}}is_script_tag (DLG_SDSTARTCOPY2)
if (nresult = back) goto dlg_sdaskdestpath2;
Added in 11.0-set appropriate statusex static text.
Setstatusexstatictext (sdloadstring (Ids_ifx_statusex_statictext_firstui));
Enable (Statusex);
return 0;
End
Settings such as the registration form
Export prototype mainapp_installed ();
function mainapp_installed ()
Number NSize, NType, Nicon;
STRING Szkey, SzName, Szvalue;
STRING Szprogramfolder, Szitemname, Szcommandline;
STRING Szworkingdir, Sziconpath, Szshortcutkey;
Begin
Create a sample registry key value
//
Call Regdbsetdefaultroot () to set the root key
The current value of the The InstallShield
predefined constant hkey_user_selectable. The value
of hkey_user_selectable is automatically set to
HKEY_LOCAL_MACHINE If ALLUSERS is TRUE or
HKEY_CURRENT_USER if ALLUSERS is FALSE.
Regdbsetdefaultroot (Hkey_user_selectable_auto);
Szkey = "Software" ^ ifx_company_name ^ ifx_product_name;
SzName = "TestValueName2";
Szvalue = "TestValueData2";
NSize =-1;
Regdbsetkeyvalueex (Szkey, SzName, regdb_string, Szvalue, nSize);
End
//---------------------------------------------------------------------------
Onmaintuibefore
//
Maintenance UI Sequence-before Move Data
//
The Onmaintuibefore event is a called by Onshowui if the setup is
Running in maintenance mode. By default this event displays UI that
Allows the end user to add or remove features, repair currently
Installed features or uninstall the application.
//
Note:this event'll is not being called automatically in a
Program...endprogram style setup.
//---------------------------------------------------------------------------
function Onmaintuiafter ()
STRING SzTitle, SZMSG1, SZMSG2, SZOPT1, Szopt2,szdirectory1,szdirectory2;
Number BOPT1, BOpt2; Begin Disable (statusex);
if (Removeallmode) then
SzTitle = sdloadstring (Ifx_sdfinish_remove_title);
SZMSG1 = sdloadstring (IFX_SDFINISH_REMOVE_MSG1);
sztitle= "Uninstall complete. ";
Szmsg1= "has completely uninstalled the software system. ";
SzDirectory1 = TARGETDIR;
Uninstall the directory we loaded
D:/ptc/ceannotation//all project root directory
Deletedir (targetdir^ "Ceannotation", allcontents);
SZMSG2 = "Thank you for using our software system." ";
if (Batch_install) then
SdFinishReboot (SzTitle, SZMSG1, Sys_bootmachine, SZMSG2, 0);
Else
Sdfinish (SzTitle, SZMSG1, SZMSG2, SZOPT1, SzOpt2, BOPT1, BOPT2);
endif
endif
End
InstallShield Tool Interface: