您的位置:首页 > 其它

程序发布系列 inno setup制作安装程序

2008-01-02 13:04 387 查看
与install shiled相比,inno setup是一个简单而且实用的制作安装程序的工具,工具中提供了脚本编程,能方便而且快捷的制作出安装程序,在一次制作安装程序的过程中,遇到了一些问题,做了下整理

1,inno setup的一些资料
inno setup的官方网址 http://www.jrsoftware.org/
inno setup的语言包 http://www.jrsoftware.org/files/istrans/
inno setup的新闻组(在这里你能找到一些问题的答案) http://www.jrsoftware.org/newsgroups.php

2,inno setup 中调用dll容易出现的问题
inno setup中调用dll的方法,可以从inno setup的帮助文档中查到,在inno setup的安装目录/examples下有如何调用dll的例子。在使用的过程需要注意以下几点:
a,在调用的过程中需要注意调用约定
注意的地方包括2方面,一是在inno setup脚本中需要指定调用约定,二是在dll导出时也要显示的指定调用约定
b,在调用过程中注意dll的依赖性。
inno setup调用的dll时,如果这个dll所依赖的dll没有load到地址空间时,会出现cannot import dll的错误。对于这种情况可以分以下两种情况来考虑:
一,如果所依赖的程序本身打包在安装包内
对于这种情况,首先将dll加上delayload的选项,然后在function InitializeSetup(): Boolean; 中调用ExtractTemporaryFile将所依赖的dll释放出来(这个dll在[files]中要加上dontcopy),最后调用LoadDLL来加载所依赖的dll(注意,这里是加载所依赖的dll,而不是加载本身,本身的加载是由inno setup需要调用dll中的函数的时候进行加载的)
二,如果所依赖的程序不在安装包内,而在某个目录中
对于这种情况,主要是由于所依赖的程序不在dll搜寻的目录中,可以考虑以下两种方法,一,调用SetCurrentDir将那个目录设置为当前目录,二,用程序方式改变path变量

3,几个有用的事件
function InitializeSetup(): Boolean;
Called during Setup's initialization. Return False to abort Setup, True otherwise.

procedure CurStepChanged(CurStep: TSetupStep);
You can use this event function to perform your own pre-install and post-install tasks.
Called with CurStep=ssInstall just before the actual installation starts, with CurStep=ssPostInstall just after the actual installation finishes, and with CurStep=ssDone just before Setup terminates after a successful install.

function InitializeUninstall(): Boolean;
Return False to abort Uninstall, True otherwise.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: