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

#define MyAppName "小小鸟软件"
#define MyAppVersion "2012.2.29"
#define MyAppPublisher "小小鸟科技"
#define MyAppURL "http://www.cnblogs.com/IT-SmallBird/"
#define MyAppExeName "IT.exe"
#define MyWebName "访问小小鸟博客"

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{F5F13326-A1B3-4AB9-9254-325D1B88913E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=D:\Program Files\小小鸟软件
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\Documents and Settings\Administrator\桌面
OutputBaseFilename=zlMember
SetupIconFile=F:\IT\logo.ico
Compression=lzma
SolidCompression=yes

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

;资源文件 包括安装包必需的文件,如.dll、配置文件等
[Files]
Source: "F:\IT\IT.exe"; DestDir: "{app}"; Flags: ignoreversion

[Messages]
BeveledLabel=-----------------------------------------------------------------小小鸟制作
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

;这里为检测.net2.0框架的代码,//判断程序是否存在//初始华程序事件

[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]
;Commonprograms 程序菜单
;Userdesktop 桌面
;Group程序菜单的文件夹里

Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyWebName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{userdesktop}\小小鸟软件"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico";

;用于在用户系统中创建,修改或删除注册表健值
[Registry]
Root: HKLM ;SubKey:"Software\IT_soft";ValueType:dword;ValueName:config;ValueData:10 ;Flags:uninsdeletevalue

;安装结束后要运行的选项,可选
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent