
| 语言: | Visual Basic 6 |
| 版本: | 3.0.3 |
| 发布于: | 2007年2月12日 |
| 作者: | IC Imaging Control 技术支持部 |
| 系统要求: | IC Imaging Control 3.0 或更新版本 |
| |
免费软件 "Innosetup" 是一款用于为 IC Imaging Control 应用程序创建安装程序的非常好的工具。 下载地址:http://www.jrsoftware.org/. Innosetup 使用一个简单的脚本文件创建安装程序所需的文件。
本例将为程序 "FirstApp" 创建一个安装文件,并将其保存在 samples\vb6\Building an Application 目录中。 脚本文件 simplesetup.iss 也将被保存在此目录中。
IC Imaging Control 的 runtime 文件存放在 IC Imaging Control 安装目录的 bin 文件夹中。 文件夹 bin 被从 samples\vb6\Building an Application 中相应地引用过,因此在脚本文件中只需写 ..\..\..\bin 即可。 IC Imaging Control ActiveX (icimagincontrol.ocx) 将从文件夹 Common Files/IC Imaging Control 3 中拷贝。 在 IC Imaging Control 目录中还需为MFC runtime DLLs 和 Directshow 滤镜创建一个名为 system 的文件夹。 注意,不可以从 Windows\System32 中拷贝这些文件,因为如果直接使用 Windows\System32 中的文件,Innosetup 将会报出版本冲突警告。
在创建目录 system 之后,从 Windows\System32 中拷贝下列文件至 system。
下面列出的是安装脚本中关于程序概况的一部分内容。 您可以手工编辑这部分内容、或使用 Innosetup 向导自动生成。
; 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
程序应被安装在计算机程序目录中(例如 C:\Program Files)。 脚本中的 {pf} 指的就是程序目录。 此外,在程序目录中还需创建子目录 FirstApp, 应用程序将被安装在这个文件夹中。
IC Imaging Control 的 runtime 文件 icimgingcontrol.ocx 及其相关文件应被拷贝至 Common Files/IC Imaging Control 3 目录中。 使用该目录的原因是,这样一来 IC Imaging Control 还可用于其他程序。 IC Imaging Control runtime 文件的目标路径写法为{cf}。 加入目录名 "IC Imaging Control 3",这样一来生成的目标目录名就被写作 {cf}\IC Imaging Control 3"。
程序 "FirstApp.exe" 将被安装在它自己的文件夹中。 这个文件夹的写法是 {app}。 它由 [Setup] 中的 DefaultDirName={pf}\FirstApp 语句实现。
下面的 [Files] 一节是最有意思的一部分。 需要拷贝的文件都列在下面了。 它们将以被列出的顺序依次被拷贝至目标文件夹中。 需要注意的是,被注册的文件将被最后被拷贝,因为它们或许还需要之前安装好的文件。 例如 icimagingcontrol.ocx 在被注册之前就需要 TIS*.DLL。 安装程序将使用 flag regserver 自动完成 icimagingcontrol.ocx 的注册。
[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
对于您自己编写的程序,实施上述步骤时只需将 FirstApp.exe 替换为您自己的程序名即可。
例如 MFC run time DLLs 及 IC Imaging Control DirectShow 滤镜之类的文件将被拷贝至 Windows\System32 目录,脚本中的写法是 {sys}。 此外,文件 MSCOMCTL.OCX 及 comdlg32.ocx 必须经过注册, 该过程由 flag regserver 完成。
脚本文件中的其它部分定义的是这个程序在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
在脚本中, \FirstApp.exe 被您自己程序的名称替换即可。
下面是运行安装文件时的一些图例。
开始安装:

选择程序的目标路径:

选择开始菜单文件夹:

询问创建桌面快捷方式:

准备就绪,确认各设置:

安装:

安装结束,询问是否开启程序:

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