
| 語言: | 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的開發製造商,不對任何由於使用本文或其中源代碼所產生的後果承擔責任。