zoukankan      html  css  js  c++  java
  • Inno Setup安装时不能关闭指定进程

     脚本由 Inno Setup 脚本向导 生成!
    ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!


    #define MyAppName "XX管理系统"
    #define MyAppVersion "1.0"
    #define MyAppPublisher "彭小波"
    #define MyAppURL "http://www.xxxxx.com/"
    #define MyAppExeName "fdsfds.exe"
    #define IncludeFramework true
    #define IsExternal ""


    [Setup]
    ; 注: AppId的值为单独标识该应用程序。
    ; 不要为其他安装程序使用相同的AppId值。
    ; (生成新的GUID,点击 工具|在IDE中生成GUID。)
    AppId={{FDAF6466-E5F5-443E-A3-03C5DF70CC71}
    AppName={#MyAppName}
    AppVersion={#MyAppVersion}
    ;AppVerName={#MyAppName} {#MyAppVersion}
    AppPublisher={#MyAppPublisher}
    AppPublisherURL={#MyAppURL}
    AppSupportURL={#MyAppURL}
    AppUpdatesURL={#MyAppURL}
    DefaultDirName={pf}{#MyAppName}
    ;LicenseFile=E:Release软件使用许可协议.rtf
    DisableProgramGroupPage=yes
    OutputBaseFilename=FullSetUp
    SetupIconFile=E:SetUpLogo.ico
    InfoAfterFile=E:Debug升级日志.txt
    OutputDir=E:CardRelease
    Compression=lzma
    SolidCompression=yes


    [Languages]
    Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"


    [Setup]
     CloseApplications=yes
    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; 
    Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; 


    [Files]
    Source: "C:Grid++Report 6gregn6.dll"; DestDir: "{app}"; Flags: restartreplace sharedfile regserver
    Source: "C:Grid++Report 6grdes6.dll"; DestDir: "{app}"; Flags: restartreplace sharedfile regserver
    Source: "E: et_codeCertificatesIdentifyCardWpfinDebugCardWpf.exe"; DestDir: "{app}"; Flags: ignoreversion
    Source: "E: et_codeCertificatesIdentifyCardWpfinDebug*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
    Source: psvince.dll; Flags: dontcopy
    Source: ISTask.dll; Flags: dontcopy
    #if IncludeFramework
    Source: "E:安装程序工作环境dotNetFx40_Full_x86_x64.exe"; DestDir: "{tmp}"; Flags: ignoreversion {#IsExternal}; Check: NeedsFramework
    #endif
    ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”


    [Icons]
    Name: "{commonprograms}{#MyAppName}"; Filename: "{app}{#MyAppExeName}"
    Name: "{commondesktop}{#MyAppName}"; Filename: "{app}{#MyAppExeName}"; Tasks: desktopicon
    Name: "{userappdata}MicrosoftInternet ExplorerQuick Launch{#MyAppName}"; Filename: "{app}{#MyAppExeName}"; Tasks: quicklaunchicon


    [Run]
    #if IncludeFramework
    Filename: {tmp}dotNetFx40_Full_x86_x64.exe; Parameters: "/q:a /c:""install /l /q"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: "Installing .NET Framework if needed"
    #endif
    Filename: {win}Microsoft.NETFrameworkv4.0.30319CasPol.exe; Parameters: "-q -machine -remgroup ""{#MyAppName}"""; WorkingDir: {tmp}; Flags: skipifdoesntexist runhidden; StatusMsg: "Setting Program Access Permissions..."
    Filename: {win}Microsoft.NETFrameworkv4.0.30319CasPol.exe; Parameters: "-q -machine -addgroup 1.2 -url ""file://{app}/*"" FullTrust -name ""{#MyAppName}"""; WorkingDir: {tmp}; Flags: skipifdoesntexist runhidden; StatusMsg: "Setting Program Access Permissions..."
    ;不询问直接运行
    ;Filename: "{app}{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}";  Flags: nowait skipifdoesntexist ;   
    ;询问是否运行
    ;Filename: "{app}{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}";  Flags: nowait postinstall skipifsilent;
    [code]
    //安装前判断是否有进程正在运行
    function IsModuleLoaded(modulename: AnsiString ):  Boolean;


    external 'IsModuleLoaded@files:psvince.dll stdcall';




    function RunTask(FileName: string; bFullpath: Boolean): Boolean;
    external 'RunTask@files:ISTask.dll stdcall delayload';
    function KillTask(ExeFileName: string): Integer;
    external 'KillTask@files:ISTask.dll stdcall delayload';  


    function InitializeSetup(): Boolean;
    begin
      if(IsModuleLoaded('fdsfds.exe')) then
        begin
           KillTask('fdsfds.exe');
          Result :=true ;
        end
      else
       begin
          Result := true;
       end
    end;


    // Indicates whether .NET Framework 2.0 is installed.
    function IsDotNET40Detected(): boolean;
    var
        success: boolean;
        install: cardinal;
    begin
        success := RegQueryDWordValue(HKLM, 'SOFTWAREMicrosoftNET Framework SetupNDPv4Full', 'Install', install);
        Result :=  success and (install = 1);
    end;


    function NeedsFramework(): Boolean;
    begin
      Result := (IsDotNET40Detected = false);
    end;






    function GetCustomSetupExitCode(): Integer;
    begin
      if (IsDotNET40Detected = false) then
        begin
          MsgBox('.NET Framework 未能正确安装!',mbError, MB_OK);
          result := -1
        end
    end;








    procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
    var
      ErrorCode: Integer;
    begin
      case CurUninstallStep of
        usUninstall:
          begin
          end;
        usPostUninstall:
          begin
            ShellExec('open', 'http://www.xxxxxx.com', '', '', SW_SHOW, ewNoWait, ErrorCode)
          end;
      end;

    end;

    之前在XP上死活杀不了进程,原因使用的老版INNOSETUP 5.5版本,改成

    http://www.cr173.com/soft/17879.html

    版本问题解决。

    Inno Setup V5.5.8汉化增强版(风铃夜思雨

  • 相关阅读:
    spring -项目功能介绍
    【HQL】分页查询 、对象导航查询、外置命名查询、连接查询、查询过滤器、统计查询
    【HQL】属性查询、条件查询
    【HQL】hibernate查询语言hql
    Hibernate- 表联系
    struts 配置过程 -一个计算器程序
    【DRP】-JSTL核心库 c:out标签
    .NET 使用sock5做代理(不是搭建服务端)
    重磅新闻!昨日阿里云发布首款云电脑“无影”,到底如何呢?
    C#如何实现获取电脑硬件相关的配置信息呢?
  • 原文地址:https://www.cnblogs.com/micro-chen/p/6155532.html
Copyright © 2011-2022 走看看