Creating Setups: Creating a Setup Program for an IC Class Library Application

This example illustrates how to use the freeware tool "Innosetup" to create setup programs for IC Imaging Control applications.
Language:Visual C++
Version:3.0.3
Released on:February 12, 2007
Author:IC Imaging Control Support Department
Requirements:IC Imaging Control >3.0.3

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 "Demoapp" and will be saved in the samples\vc71\demoapp directory. The script file simplesetup.iss will also be saved here. The compiled application demoapp.exe will be written to the classlib\release directory of the IC Imaging Control installation path.

The IC Imaging Control runtime files are taken from the classlib\release 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 they are needed by Innosetup.

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

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.

      [Setup]
      AppName=DemoApp
      AppVerName=DemoApp 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}\DemoApp
      DefaultGroupName=DemoApp
      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 Demoapp is created for the application in the programs directory. The application will be installed in to this directory.

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 directory in the order in which they are listed. The application's directory is represented by {app}.

      [Files]
      Source: "..\..\..\classlib\release\DemoApp_vc7.exe"; DestDir: "{app}"; Flags: ignoreversion
      ; The Dialogs.dll is only needed for the demoapp.
      Source: "..\..\..\classlib\release\Dialogs.dll"; DestDir: "{app}"; Flags: ignoreversion
      Source: "..\..\..\classlib\release\TIS_UDSHL07_vc71.dll"; DestDir: "{app}"; Flags: ignoreversion
      Source: "..\..\..\classlib\release\TIS_DShowLib07_vc71.dll"; DestDir: "{app}"; Flags: ignoreversion
      Source: "..\..\..\classlib\release\ICFilterContainer.dll"; DestDir: "{app}"; Flags: ignoreversion
      ; Use all video capture device adapers
      Source: "..\..\..\classlib\release\*.vda"; DestDir: "{app}"; Flags: ignoreversion
      ; Use all codec adapters
      Source: "..\..\..\classlib\release\*.tca"; DestDir: "{app}"; Flags: ignoreversion
      ; If frame filters are needed, uncommend the following line
      ;Source: "..\..\..\classlib\release\*.ftf"; DestDir: "{app}"; Flags: ignoreversion
    

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

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

      ; 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 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
    

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

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

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

In this script, \DemoApp_vc7.exe is simply exchanged with the file name of 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.