Creating Setups: Creating a Setup Program for an IC ActiveX Application

This example illustrates how to use the freeware tool "Innosetup" to create setup programs for IC Imaging Control ActiveX applications.
Language:Visual Basic 6
Version:3.0.3
Released on:February 12, 2007
Author:IC Imaging Control Support Department
Requirements:IC Imaging Control 3.0 or higher

The freeware "Innosetup" is a very good way of creating setup programs for IC Imaging Control applications. It can be downloaded from http://www.jrsoftware.org/. Innosetup uses a simple script file to create the files needed for the setup program.

In this sample application, a setup program will be created for "FirstApp" and will be saved in the samples\vb6\Building an Application directory. The script file simplesetup.iss will also be saved in this directory.

The IC Imaging Control runtime files are taken from the bin directory of the IC Imaging Control installation directory. The bin directory is referenced relativly from the samples\vb6\Building an Application, thus only ..\..\..\bin must be written in the setup scrip. IC Imaging Control ActiveX (icimagincontrol.ocx) is copied from the Common Files/IC Imaging Control 3 directory. A directory, called system, needs to be created for the MFC runtime DLLs and Directshow filters in the IC Imaging Control directory. Theses files can not be copied from the Windows\System32, as Innosetup would warn about version conflicts using files directly from Windows\System32.

Once the system directory has been created, the following files from Windows\System32 are copied into it.

  • Mfc71.dll
  • Msvcp71.dll (If Visual Studio 6 is used, please use the file Msvcp60.dll)
  • Msvcr71.dll
  • IAT_YUV.ax
  • DeBayerTransform.dll
  • MSCOMCTL.OCX
  • comdlg32.ocx

Below is the section of the setup script that contains some general information about the application. It can be edited by hand or created by the Innosetup wizard.

      ; The common files path "c:\Programme\Gemeinsame Dateien\IC Imaging Control 3\" is localized. This means,
      ; is is named in different languages on Windows system. On english Windows it is named
      ; "c:\Program Files\Common Files\IC Imaging Control 3\". Thus this path must be exchanged in the script
      ; with the correct name on the computer where the setup is built.

      [Setup]
      AppName=FirstApp
      AppVerName=FirstApp 1.0
      AppPublisher=The Imaging Source Europe GmbH
      AppPublisherURL=http://www.imagingcontrol.com
      AppSupportURL=http://www.imagingcontrol.com
      AppUpdatesURL=http://www.imagingcontrol.com
      DefaultDirName={pf}\FirstApp
      DefaultGroupName=FirstApp
      OutputBaseFilename=setup
      Compression=lzma
      SolidCompression=yes

      [Tasks]
      Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

    

The application should be installed into the programs directory of the computer (e.g. C:\Program Files). The programs directory is encoded with {pf} in the script. Additionally, the sub-directory FirstApp is created for the application in the programs directory. The application will be installed into this directory.

The IC Imaging Control runtime files, i.e. icimgingcontrol.ocx and its related files should be copied into the Common Files/IC Imaging Control 3 directory. This directory is used, because IC Imaging Control can be shared with other applications. The target directory of IC Imaging Control runtime files is represented by {cf}. The directory name "IC Imaging Control 3" is added, thus the resulting target directory name is written as {cf}\IC Imaging Control 3".

The application "FirstApp.exe" will be installed into an own directory the program files directory. This directory is represented by {app}. It is determined in the [Setup] section at DefaultDirName={pf}\FirstApp.

The following [Files] section is the most interesting part. The files that are to be copied are listed below. They are copied to their destination directories in the order in which they are listed. It is very important, that the files, that are to be registered, are copied as last files, because they may need the previously installed files. For example icimagingcontrol.ocx needs the TIS*.DLL files before it can be registered. The registration of icimagingcontrol.ocx is done with the flag regserver automatically by the setup program.

      [Files]
      Source: "FirstApp.exe"; DestDir: "{app}"; Flags: ignoreversion
      ; The Dialogs.dll is only needed for the FirstApp.
      Source: "..\..\..\bin\TIS_UDSHL07_vc71.dll"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      Source: "..\..\..\bin\TIS_DShowLib07_vc71.dll"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      Source: "..\..\..\bin\ICFilterContainer.dll"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      ; Use all video capture device adapers
      Source: "..\..\..\bin\*.vda"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      ; Use all codec adapters
      Source: "..\..\..\bin\*.tca"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      ; If frame filters are needed, uncommend the following line
      ;Source: "c:\Programme\Gemeinsame Dateien\IC Imaging Control 3\*.ftf"; DestDir: "{cf}\IC Imaging Control 3"; Flags: ignoreversion
      ; If the needed filters are in the application's directory, then following line is  needed:
      ;Source: "*.ftf"; DestDir: "{app}"; Flags: ignoreversion

      ; System files as DirectShow Filters and MFC Runtime files.
      Source: "..\..\..\system\MFC71.dll"; DestDir: "{sys}"; Flags: sharedfile
      Source: "..\..\..\system\Msvcp71.dll"; DestDir: "{sys}"; Flags: sharedfile
      Source: "..\..\..\system\Msvcr71.dll"; DestDir: "{sys}"; Flags: sharedfile
      ; The following files are used by Visual Basic. They must be registered.
      Source: "..\..\..\system\MSCOMCTL.OCX"; DestDir: "{sys}"; Flags: regserver sharedfile
      Source: "..\..\..\system\comdlg32.ocx"; DestDir: "{sys}"; Flags: regserver sharedfile

      ; The DirectShow filters are to be registered. These files are copied a last files.
      Source: "..\..\..\system\iat_yuv.ax"; DestDir: "{sys}"; Flags: regserver sharedfile replacesameversion
      Source: "..\..\..\system\debayertransform.dll"; DestDir: "{sys}"; Flags: regserver sharedfile replacesameversion

      ; IC Imaging Control ActiveX is to be installed as last file, because for registration it needs the previous installed files.
      Source: "c:\Programme\Gemeinsame Dateien\IC Imaging Control 3\icimagingcontrol.ocx"; DestDir: "{cf}\IC Imaging Control 3"; Flags: regserver sharedfile
    

For your own applications, simply substitute the string FirstApp.exe with the name of your program.

Some files like the MFC run time DLLs and the IC Imaging Control DirectShow filters are copied into the Windows\System32 directory, which is represented by {sys}. Additionally, the filters and the files MSCOMCTL.OCX and comdlg32.ocx must be registered. This is done with the flag regserver.

The rest of the setup script determines how the application is presented in Windows:

      [Icons]
      Name: "{group}\FirstApp"; Filename: "{app}\FirstApp.exe"
      Name: "{userdesktop}\FirstApp"; Filename: "{app}\FirstApp.exe"; Tasks: desktopicon

      [Run]
      Filename: "{app}\FirstApp.exe"; Description: "{cm:LaunchProgram,FirstApp}"; Flags: nowait postinstall skipifsilent
    

In this script, \FirstApp.exe is simply exchanged with the file name of the application.

The following images show the screens of the runnging setup.

Starting the setup:

Starting setup

Select the application's target directory:

Select the applications target directory

Select the start menu folder:

Select the start menu folder

Ask for creating a desktop icon:

Ask for creating a desktop icon

Ready to install, confirm the settings of the setup:

Ready to install, confirm the settings of the setup

Installing:

Installing

Finished setup, ask for starting the application:

Finished setup, ask for starting the application

Disclaimer
The source code that appears in the IC Imaging Control Source Code Library is indented for educational purposes only. The Imaging Source Europe GmbH, the manufacturer of IC Imaging Control, does not assume any kind of warranty expressed or implied, resulting from the use of the content of this page.

This site is part of The Imaging Source Network. Other sites include Company Portal, Image Processing, Astronomy Cameras, Astronomy Cameras Blog, Blog caméras d'astronomie, Astronomy Cameras Competition, TX Text Control, LiveDocx, phpLiveDocx and Forums.