文章搜索: 分类 关键字
内容1载入中...内容2载入中...内容3载入中...
您的位置:首页编程开发安装制作 → INNO & NSIS 双剑合璧, 调用 NSIS 插件的通用插件
INNO & NSIS 双剑合璧, 调用 NSIS 插件的通用插件
日期:2007-2-8 22:17:25 人气:     [ ]
推荐本页:
    从此为 NSIS 开发的插件也通用于 INNO 了。

    callnsis.dll 就是新作出来的调用 NSIS 插件地通用调用插件,适用于任何程序的正常调用,当然就会包括 INNO 了。

    这个 callnsis.dll 的调用函数是 callplug 。Delphi 中声明如下。
    procedure callplug(parentwnd: Integer; pluginname, funcname, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10: PChar); stdcall;
    external callnsis.dll name callplug;

    预留 10 个参数,参数根据 NSIS 例子中来填入。10 个一般够用了,如果没用的就填空字符串。

    看看以下的 INNO 例子。跟 NSIS 一样的效果。 

    渐显渐隐的闪屏效果,还附带背景声音。

    以下是引用片段:
    ; -- Example1.iss --

    ; 演示如何调用 NSIS 插件的 INNO 安装程序。

    [Setup]
    AppName=我的程序
    AppVerName=我的程序 版本 1.5
    DefaultDirName={pf}\我的程序
    DefaultGroupName=我的程序
    UninstallDisplayIcon={app}\MyProg.exe

    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"
    Source: "MyProg.hlp"; DestDir: "{app}"
    Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
    Source: "callnsis.dll"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "AdvSplash.dll"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "logo.bmp"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "logo.wav"; DestDir: "{tmp}"; Flags: dontcopy


    [Icons]
    Name: "{group}\我的程序"; Filename: "{app}\MyProg.exe"

    [code]
    procedure callplug(parentwnd: Integer; pluginname,funcname,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10: PChar);
    external ’callplug@files:callnsis.dll stdcall’;

    procedure InitializeWizard();
    begin
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\AdvSplash.dll’)));
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\logo.bmp’)));
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\logo.wav’)));
      callplug(0,ExpandConstant(’{tmp}\AdvSplash.dll’),’show’,’2800’,’1400’,’1200’,’-1’,ExpandConstant(’{tmp}\logo’),’’,’’,’’,’’,’’);
    end;


    以下附件包括所有插件(包括通用调用插件 callnsis.dll 和 NSIS 专用插件 AdvSplash.dll)。
    testapp.rar


     

    delphi 调用例子。 biggrin.gif

    以下是引用片段:
    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;

    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    procedure callplug(parentwnd: Integer; pluginname,funcname,
        param1,param2,param3,param4,param5,param6,param7,param8,param9,param10: PChar); stdcall;
    external ’callnsis.dll’ name ’callplug’;

    implementation

    {$R *.DFM}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      callplug(0,’AdvSplash.dll’,’show’,’2800’,’1400’,’1200’,’-1’,’logo’,’’,’’,’’,’’,’’);
    end;

    end.


    附带例子程序。

    delphiapp.rar


     

    稍稍修改了一下插件,加多了返回值,因为有时候需要返回结果。

    以下是引用片段:
    ; -- Example1.iss --

    ; 演示如何调用 NSIS 插件的 INNO 安装程序。
    ; 带有返回值的调用插件

    [Setup]
    AppName=我的程序
    AppVerName=我的程序 版本 1.5
    DefaultDirName={pf}\我的程序
    DefaultGroupName=我的程序
    UninstallDisplayIcon={app}\MyProg.exe

    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"
    Source: "MyProg.hlp"; DestDir: "{app}"
    Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
    Source: "callnsis.dll"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "AdvSplash.dll"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "logo.bmp"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "logo.wav"; DestDir: "{tmp}"; Flags: dontcopy


    [Icons]
    Name: "{group}\我的程序"; Filename: "{app}\MyProg.exe"

    [code]
    function callplug(parentwnd: Integer; pluginname,funcname,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10: PChar): Integer;
    external ’callplug@files:callnsis.dll stdcall’;

    procedure InitializeWizard();
    var
      val: Integer;
    begin
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\AdvSplash.dll’)));
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\logo.bmp’)));
      ExtractTemporaryFile(ExtractFileName(ExpandConstant(’{tmp}\logo.wav’)));
      val:=callplug(0,ExpandConstant(’{tmp}\AdvSplash.dll’),’show’,’2800’,’1400’,’1200’,’-1’,ExpandConstant(’{tmp}\logo’),’’,’’,’’,’’,’’);
      
      // 在 NSIS 的例子中调用是如下的:
      
      // SetOutPath $TEMP                              # 设置输出位置为临时目录
      // File /oname=logo.bmp "my_logo.bmp"            # 释放文件
      // File /oname=logo.wav "my_logo.wav"            # 释放文件
      // advsplash::show 2800 1400 1200 -1 $TEMP\logo  # 调用插件
      // Pop $0                                        # 取返回值: 返回 ’1’ 表示用户提前关闭闪屏, 返回 ’0’ 表示闪屏正常结束, 返回 ’-1’ 表示闪屏显示出错
      
      // 基本上,调用的方法都是一样的,所以只要稍稍看看 NSIS 的插件例子,你就可以在 INNO 中利用以上方法进行调用

      if val = 1 then
        MsgBox(’你点击了闪屏窗口,导致闪屏提前关闭!’, mbConfirmation, MB_OK);
    end;


    INNO 脚本附件:
    testapp2.rar



    出处:其他网站 作者:佚名 本文章由 金电网 搜集整理发布
    评论人 评论内容摘要(共 0 条,查看完整内容) 得分 0 发表时间
    ·正确安装CPU风扇及风扇加油全程图解
    ·主板全程图解
    ·卡丽来教程(一)
    ·破解星空极速
    ·关于GHOST的时说找不到一个叫GHOSTER..
    ·RM RMVB转VCD DVD方法及软件下载全面..
    ·Hacktool.rootkit病毒如何清除
    ·DVD转RMVB效果最好的工具AutoRV9中文..
    ·高频时代电脑分身术——BeTwin使用详..
    ·Ulead GIF Animator 5全新接触
    ·nlite额外保留与额外删除参考
    ·Windows.2003.Datacenter.Edition.SP..
    ·图解Windows XP远程桌面连接
    ·图解-EasyRecovery 604硬盘数据恢复软..
    ·图解双网卡共享ADSL宽带
    ·Microsoft SQL 2000 错误代码
    ·自己制作ghost版xp系统
    ·主板cpu知识大全图文版
    ·六招教你学会破解
    ·手把手教你架设电影服务器(图)
    ·正确安装CPU风扇及风扇加油全程图解
    ·主板全程图解
    ·卡丽来教程(一)
    ·关于GHOST的时说找不到一个叫GHOSTER..
    ·RM RMVB转VCD DVD方法及软件下载全面..
    ·Hacktool.rootkit病毒如何清除
    ·DVD转RMVB效果最好的工具AutoRV9中文..
    ·高频时代电脑分身术——BeTwin使用详..
    ·Ulead GIF Animator 5全新接触
    ·Windows.2003.Datacenter.Edition.SP..
    ·图解Windows XP远程桌面连接
    ·图解-EasyRecovery 604硬盘数据恢复软..
    ·图解双网卡共享ADSL宽带
    ·Microsoft SQL 2000 错误代码
    ·主板cpu知识大全图文版
    ·六招教你学会破解
    ·手把手教你架设电影服务器(图)
    ·卡巴key被封的解决办法
    ·Win2003架设DNS服务器
    ·TMPGEnc 小日本的使用详释
    金电下载站 版权所有 Copyright© 2001-2005 www.jdxz.net, All Rights Reserved.
    湘ICP备05012976