创建安装文件: 为IC类库程序创建一个安装文件

本例将介绍如何使用免费软件"Innosetup"创建一个IC Imaging Control程序的安装文件。
语言:Visual C++
版本:3.0.3
发布于:2007年2月12日
作者:IC Imaging Control 技术支持部
系统要求:IC Imaging Control >3.0.3

"Innosetup"是一款免费软件,您可以使用它生成一个 IC Imaging Control 程序的安装文件。 其下载地址 http://www.jrsoftware.org/. 只需一个简单的脚本文件,Innosetup就可生成安装文件所需的所有文档。

本例以 "Demoapp" 程序为例,创建一个安装文件、并将其保存在samples\vc71\demoapp目录中。 脚本文件simplesetup.iss也将被保存在该文件夹中。 编译后的程序 demoapp.exe 将被写入 IC Imaging Control 安装路径中的 classlib\release目录。

IC Imaging Control 的 runtime 文件都在classlib\release目录中。 此外,我们还需要在 IC Imaging Control 目录中创建一个叫system的目录,用于存放 MFC runtime DLLs 和 Directshow Filters。

在建立 system 目录后,从Windows\System32 文件夹中拷贝下列文件至system

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

下面是安装文件的脚本,其中包括一些关于这个程序的大致信息。 您可以自己编辑这个文件,也可以通过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
    

这个程序应该被安装在操作系统的程序目录中(e.g. C:\Program Files)。 在脚本文件中,{pf}即代表程序目录。 安装文件还应该在程序目录中新建一个子文件夹Demoapp,用于安装示例程序。

下面是 [Files] 部分。 所有需要拷贝的文件都列于此处, 当系统把这些文件拷贝至目标文件夹时,将按照它们在下面被列出的顺序进行。 {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
    

在您为自己的程序制作安装文件时,只需把文件名 DemoApp_vc7.exe 更改为您编写的程序的名称即可。

MFC runtime DLLs 和 IC Imaging Control DirectShow filters 都将被复制到 客户计算机的 Windows\System32 目录中,{sys}即表示该目录。 此外,所有 filters 都必须注册。 而这项工作由 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
    

脚本文件的其余部分用于控制该程序在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
    

在脚本中,只需将 \DemoApp_vc7.exe 更换为您编写的程序名称即可。

责任声明
IC Imaging Control 源代码库中的所有代码均只用于教学目的,The Imaging Source Europe GmbH 作为IC Imaging Control的开发制造商,不对任何由于使用本文或其中源代码所产生的后果承担责任。

该网站为The Imaging Source网络的一部分。其它的站点包括 公司, Imaging, 天文相机, Astronomy Cameras Blog, Blog caméras d'astronomie, 天文相机有奖竞答, TX Text Control, LiveDocx, phpLiveDocxForum.