InnoSetup打包exe安裝應用程式,並添加卸載表徵圖 轉

來源:互聯網
上載者:User

標籤:

 

http://blog.csdn.net/guoquanyou/article/details/7445773

InnoSetup真是一個非常棒的工具.給我的印象就是非常的精幹.所以,該工具已經一步步的把我的InstallerVise代替了.InnoSetup最棒的在於他的指令碼語言,完全的pascal文法,你可以在學習他的時候省去很多麻煩.
用InnoSetup的wizard已經可以完成很多的工作了,但是並不是十全十美.許多地方要你自己訂定,這就用到指令碼了.

預設的打包好的程式在程式菜單中沒有卸載表徵圖,這一點很不爽.你要卸載程式要通過添加/刪除程式來完成,這太麻煩了.其實只需要幾步就可以完成這一工作.

; 指令碼由 Inno Setup 指令碼嚮導 產生!
; 有關建立 Inno Setup 指令檔的詳細資料請查閱協助文檔!


#define MyAppName "青島招聘網"
#define MyAppVersion "1.5"
#define MyAppPublisher "青島招聘網"
#define MyAppURL "http://www.qk12333.com/"
#define MyAppExeName "Client.exe"

[Setup]
; 注: AppId的值為單獨標識該應用程式。
; 不要為其他安裝程式使用相同的AppId值。
; (產生新的GUID,點擊 工具|在IDE中產生GUID。)
AppId={{E8EA32EC-AE79-4184-A374-4356A6BDBC16}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
Uninstallable=yes
UninstallDisplayName=卸載{#MyAppName}


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

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Client.root\Client\bin\Debug\Client.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Client.root\Client\bin\Debug\AxInterop.WMPLib.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Client.root\Client\bin\Debug\Client.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Client.root\Client\bin\Debug\Client.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Client.root\Client\bin\Debug\Interop.WMPLib.dll"; DestDir: "{app}"; Flags: ignoreversion
; 注意: 不要在任何共用系統檔案上使用“Flags: ignoreversion”
[code]
  function InitializeSetup: Boolean;
  var Isbl: boolean;         //聲明變數
    var Isstr: string;
    //全域變數
    var MyProgChecked: Boolean;
  var Path:string ;
         ResultCode: Integer;
  begin
    if RegKeyExists(HKLM, ‘SOFTWARE\Microsoft\.NETFramework\policy\v2.0‘) then
      begin
         Result := true;
     end
    else
      begin
        if MsgBox(‘系統檢測到您沒有安裝.Net Framework2.0,是否立刻下載並安裝?‘, mbConfirmation, MB_YESNO) = idYes then
          begin
               Path := ExpandConstant(‘{pf}\Internet Explorer\iexplore.exe‘);
               Exec(Path, ‘http://data.zhiluo.net/soft/Microsoft_DotNet2.0.rar‘, ‘‘ , SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
               MsgBox(‘請安裝好.Net Framework2.0環境後,再運行本安裝包程式!‘,mbInformation,MB_OK);
               Result := false;
           end
        else
           begin
               MsgBox(‘沒有安裝.Net Framework2.0環境,無法運行程式,本安裝程式即將退出!‘,mbInformation,MB_OK);
               Result := false;
           end;
      end;

      begin       //開始
        Isbl := true;             //變數賦值  注意下方的“SOFTWARE\IT_soft”要與安裝時建立的註冊表資訊一致
        Isstr := ‘歡迎‘;
        if RegValueExists(HKEY_LOCAL_MACHINE, ‘SOFTWARE\IT_soft‘, ‘config‘) then
          begin
            MsgBox(‘軟體已安裝過,如果需要重新安裝,請先卸載再安裝!‘,mbConfirmation, MB_OK);
            isbl := false;
          end
        else
          begin
          //MsgBox(‘無值‘,mbConfirmation, MB_OK);
          isbl := true;
          end;
          Result := Isbl;
      end;       //結束
  end;

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\卸載 {#MyAppName}"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, ‘&‘, ‘&&‘)}}"; Flags: nowait postinstall skipifsilent

InnoSetup打包exe安裝應用程式,並添加卸載表徵圖 轉

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.