|
Distribute your VB6 applications with InnoSetup
|
|
|
|
|
Wednesday, 14 May 2008
|
I. Introduction Create an installation program is the final step in developing an application. Given my specialty, this tutorial is necessarily very oriented Visual Basic, and mainly Section II. But InnoSetup installatteur is a universal, and may well be used for the distribution of applications developed with other programming languages (Delphi, for example, to mention only the latter). Of course, for Visual Basic, there is the assistant installation deployment is supplied with basic with VB6-professional publishing or + But little change is so tedious, it quickly becomes a deterrent! InnoSetup is a good alternative to this problem, offering multiple opportunities for customization, a very simple way, without taking the lead in changing the Setup.bas of VB6! IsTools is the indispensable complement of InnoSetup. Necessary to easily import installation files Setup.lst generated by the assistant VB, and available in French, it allows you to customize your basic setup without writing a single line of code or script! You will find useful links in the Links section II. My first "setup" The main difficulty, to get a complete setup and operational, is to find all the dependencies of your project VB6. If you're not an expert in this field, I advise you to use, in a first phase, the assistant deployment VB6 to get a file Setup.lst, which contains the dependencies. If you do not have the assistant VB6 (distributed only from the professional version of VB6), there are other solutions, but we will talk later! II-1. Generate file Setup.lst I will not comment here on the deployment wizard VB6. We will use it as a mere gateway to obtain the list of files dependencies of our project. If you have questions regarding the use of this software, I invite you to our Forum installation and deployment VB6 Lancer assistant Installers and deployment of VB6: Select your VB6 project file by clicking on "Browse ..." (file type. vbp or. vbg) Choose the option "Packaging" and continue until the end, without too much to ask you questions, this is not the most important. At this stage, (if you kept the basic options of assistant), you generated in the directory. \ MyProject \ Package \ Setup.lst file. Find this file, it will be the basis of our installation with InnoSetup. Some components ocx freeware may have hidden dependencies, not identified not the assistant VB. I do not have a miracle solution and can only advise you to test your setup well before broadcast (I have had bitter experience) II-2. Import file Setup.lst in InnoSetup / IsTools You've spotted your Setup.LST, then make a right click above, in Windows Explorer: Then "Open with IsTool" or "Open With">> IsTools Application " -- If the application is not on the list, select "Choose the program ..." and seek IsTools.exe Here's what we need: Script import IsTools ; 'C: \ Applications VB6 \ Test ADO \ Package \ SETUP.LST' imported by ISTool version 5.2.1 [Setup] AppName = MyProgram AppVerName = MyProgram DefaultDirName pf = () \ MyProgram DefaultGroupName = MyProgram [Files] [Bootstrap Files] @ COMCAT.DLL, $ (WinSysPathSysFile), $ (DLLSelfRegister), 6/1/98 1:00:00 AM, 22288,4.71.1460.1 Source: COMCAT.DLL; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver @ VB6FR.DLL, $ (WinSysPath ),,$( Shared), 10/2/00 1:00:00 AM, 119568,6.0.89.88 Source: VB6FR.DLL; DestDir: (sys); Flags: promptifolder sharedfile @ STDOLE2.TLB, $ (WinSysPathSysFile), $ (TLBRegister), 6/3/99 1:00:00 AM, 17920,2.40.4275.1 Source: STDOLE2.TLB; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regtypelib @ ASYCFILT.DLL, $ (WinSysPathSysFile),,, 3/8/99 1:00:00 AM, 147728,2.40.4275.1 Source: ASYCFILT.DLL; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile @ OLEPRO32.DLL, $ (WinSysPathSysFile), $ (DLLSelfRegister), 3/8/99 1:00:00 AM, 164112,5.0.4275.1 Source: OLEPRO32.DLL; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver @ OLEAUT32.DLL, $ (WinSysPathSysFile), $ (DLLSelfRegister), 4/12/00 1:00:00 AM, 598288,2.40.4275.1 Source: OLEAUT32.DLL; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver @ Msvbvm60.dll, $ (WinSysPathSysFile), $ (DLLSelfRegister), 2/23/04 9:42:40 PM, 1386496,6.0.97.82 Source: msvbvm60.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver [Setup1 Files] @ DBRPRFR.DLL, $ (WinSysPath ),,$( Shared), 7/13/98 1:00:00 AM, 33280,6.0.81.63 Source: DBRPRFR.DLL; DestDir: (sys); Flags: promptifolder sharedfile @ Stdftfr.dll, $ (WinSysPath ),,$( Shared), 11/21/00 4:46:34 AM, 6656,6.0.81.63 Source: stdftfr.dll; DestDir: (sys); Flags: promptifolder sharedfile @ MSSTDFMT.DLL, $ (WinSysPath), $ (DLLSelfRegister), $ (Shared), 2/23/04 1:00:00 AM, 119808,6.1.97.82 Source: MSSTDFMT.DLL; DestDir: (sys); Flags: promptifolder regserver sharedfile ; >> I've just removed the middle! ; @ Msadox.dll, $ (WinSysPath), $ (DLLSelfRegister), $ (Shared), 8/5/04 1:00:00 PM, 200704,2.81.1117.0 Source: msadox.dll; DestDir: (sys); Flags: promptifolder regserver sharedfile @ Test_ADO.exe, $ (AppPath),,, 10/12/07 9:51:35 PM, 53248,1.0.0.0 Source: MyProgram.exe; DestDir:) (app; Flags: promptifolder [Icons] Name: group) (\ MyProgram; Filename: app) (\ MyProgram.exe; WorkingDir:) (app The you show lines imported file Setup.LST (in the form of comments), and these lines can be deleted. At this level, lies the main problem IsTools, and you will probably quickly noticed: it is not able to include the path source for files listed! The sub-section [Bootstrap Files] list files VB6 runtime. You can put these files in a directory, so you can be reused in each installation: For example, here in c: \ Redist \ VB_Runtime \ [Files] [VB Runtime files] Source: c: \ Redist \ VB_Runtime \ stdole2.tlb; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regtypelib Source: c: \ Redist \ VB_Runtime \ msvbvm60.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver Source: c: \ Redist \ VB_Runtime \ oleaut32.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver Source: c: \ Redist \ VB_Runtime \ olepro32.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver Source: c: \ Redist \ VB_Runtime \ asycfilt.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile Source: c: \ Redist \ VB_Runtime \ comcat.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver Source: c: \ Redist \ VB_Runtime \ Vb6fr.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall promptifolder sharedfile For other files, you'll have to define the source directory. III. Customize a little our Setup It would be impossible to describe here, all possibilities of InnoSetup We shall therefore content ourselves of the most common.
III-1. The section [Setup] There is much to say about this section, both its possibilities and options are numerous. A brief overview with what we achieved during the conversion of Setup.lst file, with explanatory comments: [Setup] ; The name "commercial" your application to be used in the titles of windows and dialogues main AppName = MyProgram ; The name and version of your program (visible on the home page) AppVerName = MyProgram v1.0 ; The default DefaultDirName pf = () \ MyProgram ; Group The installation program by default, in the "Start" menu DefaultGroupName = MyProgram Many other options are available in this section: An overview of configurable options in the section [Setup] ... To define the name of the installation program OutputBaseFilename = MyProgram_Setup To define the directory registration program compiled installaton OutputDir =.. \ Package ; Impose an administrator for the installation (needed for registering dll and ocx) PrivilegesRequired = admin ; Setting the minimum versions of Windows required for installation MinVersion = 0,5.0.2195 To define a default source directory which will search for the files section [Files] If the source directory is not specified SourceDir = C: \ MyProgram ; Show text information before installation InfoBeforeFile =. \ InfosBefore.txt ; Show text information after installation InfoAfterFile =. \ InfosAfter.txt ; Show a page containing the text of licence LicenseFile =. \ Licence.txt To define a Copyright AppCopyright = Copyright © 2008 thierryaim ; Customize images windows installer WizardImageFile = C: \ Program Files \ Inno Setup 5 \ WizModernImage-IS.bmp WizardSmallImageFile = C: \ Program Files \ Inno Setup 5 \ WizModernSmallImage-IS.bmp All options section [Setup] are easily configured in the menu "Project">> "Options installer" IsTools. If you have any questions, please visit the forum installation VB III-2. The section [Files] It was created automatically when you import the file. Lst, in the previous step. In this section, you can add all the folders or files to be attached to the application: Key parameters: Source (required): name (and folder) source file DestDir (required): destination directory DestName (optional): filename destination, if different from the original name [Files] [Redist Files] Source: c: \ Redist \ DCom \ dcom98.EXE; DestDir:) (app; Flags: promptifolder deleteafterinstall nocompression; Tasks: DCOM98 [Application Files] Source: MyProgram.exe; DestDir:) (app; Flags: promptifolder Source: MyProgram.ini; DestDir:) (app; Flags: promptifolder Source: readme.txt; DestDir:) (app; Flags: promptifolder isreadme ; Add to package a folder and all its contents Source: images \ *.*; DestDir: app) (\ images The main Flags of this section: promptifolder: Displays a warning if the file to install is older than the same file already present on the target system isreadme: indicates that the file type readme. A dialog box will be automatically offered at the end of the installation sharedfile: declares a file to install as can be shared by several applications restartreplace: cause a system restart if the file should be replaced regserver: After installation, indicates that the file (type ocx or dll) must be registered with regsvr32 (requires PrivilegesRequired = admin) regtypelib: After installation, indicates that the file (of type. tlb) must be registered as a new library type (requires PrivilegesRequired = admin) uninsneveruninstall: specifies that the file should never be uninstalled deleteafterinstall: file to be removed after installation allowunsafefiles: necessary, if you include in your package, files in the folder system See the list of files unsafe not to redistribute (depending on different platforms), on-line help InnoStup For other Flags, I invite you to read the online help-Inno Setup. III-3. The section [Dirs] permits, during installation, creating sub-folders directory application The example below creates files and data bin as subfolders directory application) (app: [Dirs] Name: app) (\ data Name: app) (\ bin III-4. The section [Tasks] As its name indicates, this section will enable us to define the tasks to be performed or not, depending on the choice of the user. If this section is present in the script, the installer automatically generate a selection of tasks, depending on the specified parameters: [Tasks] Name: InstalRTVB6; Description: Install VB6 Runtime Name: DCOM98; Description: COM & D 1.3 (Windows 98); GroupDescription: Complements:; Flags: checkedonce; MinVersion: 4.1,0; OnlyBelowVersion: 4.9,0 Name: DesktopIcon; Description: Create an icon on the &bureau; GroupDescription: Icons; Flags: checkedonce Name: QuickLaunchIcon; Description: Create an icon & Quick Start; GroupDescription: Icons; Flags: unchecked The execution of the code will be conditioned by the preselection of the task [Tasks]: Take the example of installation files VB6 runtime: [Files] [VB Runtime files] Source: c: \ Redist \ VB_Runtime \ stdole2.tlb; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regtypelib; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ msvbvm60.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ oleaut32.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ olepro32.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ asycfilt.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ comcat.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall sharedfile regserver; Tasks: InstalRTVB6 Source: c: \ Redist \ VB_Runtime \ Vb6fr.dll; DestDir: (sys); Flags: restartreplace uninsneveruninstall promptifolder sharedfile; Tasks: InstalRTVB6 The installation will be done if and only if the task InstalRTVB6 was selected previously. III-5. The section [Icons] This section allows you to set icons to install. The example below proposes the creation of icons: Senior Programme uninstallation program for the file "Readme" on the desktop, conditioned by the task DesktopIcon, previously defined in section [Tasks] launch rapid, conditioned by the task QuickLaunchIcon, previously defined in section [Tasks] [Icons] Name: group) (\ MyProgram; Filename: app) (\ MyProgram.exe; WorkingDir:) (app Name: group) (\ Uninstall MyProgram; Filename:) (uninstallexe Name: group) (\ Readme; Filename: app) (\ Lisezmoi.txt; WorkingDir:) (app Name: userdesktop) (\ MyProgram; Filename: app) (\ MyProgram.exe; WorkingDir:) (app; Tasks: DesktopIcon Name: userappdata () \ Microsoft \ Internet Explorer \ Quick Launch \ MyProgram; Filename: app) (\ MyProgram.exe; WorkingDir:) (app; Tasks: QuickLaunchIcon III-6. The section [INI] permits, during installation, write to a file. ini associated with the application: Parameters: Filename: filename. Ini Section: name of the section of the file. Ini Key: key name of the file. Ini String: Value of key [INI] Filename: app) (\ MyProgram.ini Section: Setup; Key: Language; String: French; Languages: fr; Flags: createkeyifdoesntexist Filename: app) (\ MyProgram.ini Section: Setup; Key: Language; String: English; Languages:; Flags: createkeyifdoesntexist III-7. The section [Registry] allows you to enter in the register of information to the installation: [Registry] Create the primary key Root: HKCU; Subkey: Software \ VB and VBA Program Settings \ MyProgram; Flags: uninsdeletekey ; Registration of values subkeys Root: HKCU; Subkey: Software \ VB and VBA Program Settings \ MyProgram \ Setup; ValueType: string; ValueName: LicenseName; ValueData:) (sysuserinfoorg Root: HKCU; Subkey: Software \ VB and VBA Program Settings \ MyProgram \ Setup; ValueType: string; ValueName: Language; ValueData: French.lng; Languages: fr Root: HKCU; Subkey: Software \ VB and VBA Program Settings \ MyProgram \ Setup; ValueType: string; ValueName: Language; ValueData: English.lng; Languages: III-8. The section [Run] can define the tasks to be performed when the installation is complete [Run] ; START DCOM Filename: app) (\ dcom98.exe; Parameters: / r: n / q: u; WorkingDir:) (tmp; Flags: skipifdoesntexist; Tasks: DCOM98; MinVersion: 4.1,0 IV. Installation multilingual Among its many possibilities, Inno-Setup allows, basic installations multilingual. For this, you should write: The section [Languages]: Allows define languages installation available for your setup. The section [CustomMessages]: contain all the texts and messages used in the setup, in different languages declared IV-1. The section [Languages] The list of languages pre-formatted is contained in the installation folder-Inno Setup; normally your directory "C: \ Program Files \ Inno Setup 5 \ Languages" The default language, you will have noticed, is English, coupled with the language file default.isl For an installation in french only, you only have to set the language, replacing the default language (English): For an installer who speaks french: [Languages] Name: fr; MessagesFile: compile: Languages \ French.isl For a multilingual, you must define a name (abbreviation short, preferably) for each language declared. We will, in the examples below, two languages: french and English: Example section [Languages] [Languages] Name:; MessagesFile: compile: Default.isl Name: fr; MessagesFile: compile: Languages \ French.isl ; Add below all languages that you want to make available. Examples: Name: gr; MessagesFile: compile: Languages \ German.isl Name: it; MessagesFile: compile: Languages \ Italian.isl Name: sp; MessagesFile: compile: Languages \ Spanish.isl If this section is present in your Setup program, and has more than one language declared the dialog language selection installation will, by default, automatically displayed at the launch of the programme: Dialog: Selection of the installation language IV-2. The section [CustomMessages] Defining here all the texts to appear in different pages of your Setup. Each message must be prefixed by the name (Name) defined in section [Languages] Example section [CustomMessages] [CustomMessages] ; French fr.TaskIconGroup = Icons: fr.TaskDesktopIcon = Create an icon on the desktop & fr.TaskQuickLaunchIcon = Create an icon & Quick Start ; English en.TaskIconGroup = Icons: en.TaskDesktopIcon = Create a desktop icon en.TaskQuickLaunchIcon = Create a quicklaunch icon Then, in the script, replace the text messages on their equivalent with the syntax: (cm: monmessage] The text will be displayed depending on the language chosen to start the installation. Example of section [Tasks] [Tasks] Name: DesktopIcon; Description: (cm: TaskDesktopIcon); GroupDescription: (cm: TaskIconGroup); Flags: checkedonce Name: QuickLaunchIcon; Description: (cm: TaskQuickLaunchIcon); GroupDescription: (cm: TaskIconGroup); Flags: unchecked Section [Files], conditioned by the language of intallation: [Files] Source: C: \ licence.txt; DestName: licence.txt; DestDir:) (app; Languages: fr Source: C: \ license.txt; DestName: license.txt; DestDir:) (app; Languages: Source: readme.txt; DestDir:) (app; Flags: promptifolder isreadme; Languages: fr Source: readme.txt; DestDir:) (app; Flags: promptifolder isreadme; Languages: If you are prompted to create customized pages for the use of (cm: ..) in section [Code], I urge you to read Section [Code] InnoSetup V. Conclusions To each his preferences, but I am very fond of this software, simple, easy to grip, little bigger resources, and opportunities and options immense. For followers of the language of Shakespeare, I urge you to read using InnoSetup for all information, mainly on Flags, it would be difficult to describe here, as there are many possibilities. V-1. Links Download the latest version of Inno-Setup Get the latest IsTools (the site is in English, but the software offers a package in French language) In the same series, see also: Section [Code] InnoSetup V-2. Acknowledgments A big THANK YOU to those who took a few minutes of their precious time to read me and advise me, and particularly bbil and sjrd.
|
|
|