inno 打包安装 安装好.Net Framework4.0 后
function InitializeSetup(): 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://www.xxx.com/down/dotnetfx2.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
MsgBox('请安装好.Net Framework2.0环境后 ,再运行本安装包程序!',mbInformation,MB_OK);
Result := false;
end
else
begin
MsgBox('没有安装.Net Framework2.0环境, 无法运行XXX程序,本安装程序即将退出!',mbInformation,MB_OK);
Result := false;
end;
end;
end;
[Setup]
AppName=MoneyManage
AppVerName=MoneyManage_zh 1.1.3
DefaultDirName={pf}\MoneyManage\Standalone
DefaultGroupName=MoneyManage Standalone
UninstallDisplayIcon={app}\MoneyManage.exe
Compression=lzma
SolidCompression=yes
[Files]
Source: "F:\MoneyManage\MoneyManage\bin\Debug\MoneyManage.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "F:\MoneyManage\MoneyManage\bin\Debug\AccessData\Money.mdb"; DestDir: "{app}\AccessData"; Flags: onlyifdoesntexist
[Icons]
Name: "{group}\MoneyManage"; Filename: "{app}\MoneyManage.exe"
Name: "{group}\卸载 MoneyManage"; Filename: "{uninstallexe}"
Name: "{userdesktop}\MoneyManage"; Filename: "{app}\MoneyManage.exe"; WorkingDir: "{app}";Tasks: "desktopicon";
[Tasks]
Name: "desktopicon"; Description: "在桌面创建程序图标(&D)"; GroupDescription: "附加图标";
[Languages]
Name: "zh"; MessagesFile: "compiler:Default.isl"
[Code]
function CheckDotNet2_0():boolean;
begin
Result:=not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v5.0');
end;
function InitializeSetup(): Boolean;
var Path:string;
ResultCode: Integer;
begin
if CheckDotNet2_0() then
begin
if MsgBox('系统检测到您没有安装.Net Framework2.0,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then
begin
ExtractTemporaryFile('dotNetFx40_Full_setup.exe');
Exec(ExpandConstant('{tmp}\dotNetFx40_Full_setup.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
PreviewMouseDoubleClick="DgMoneyPay_SelectionChanged"
1 、如何让协议许可页面默认选中我同意按钮
[code]
procedure InitializeWizard();
begin
WizardForm.LICENSEACCEPTEDRADIO.Checked := true;
end;
2、自定义安装程序右上角图片大小
[code]
procedure InitializeWizard();
begin
WizardForm.WizardSmallBitmapImage.width:=150; //设置页眉图片的大小
WizardForm.WizardSmallBitmapImage.left:=WizardForm.width-150; //设置左边页眉留出的空隙
WizardForm.PAGENAMELABEL.width:=0; //设置标题文字显示的大小
WizardForm.PAGEDESCRIPTIONLABEL.width:=0; //设置标题文字显示的大小
end;
或者
//自定义安装向导小图片
[code]
procedure InitializeWizard();
begin
Wizardform.WizardSmallBitmapImage.left:= WizardForm.width-164; //自定义安装向导小图片显示位置
WizardForm.WizardSmallBitmapImage.width:=164; //自定义安装向导小图片宽度
Wizardform.PageNameLabel.width:= 495 - 164 -36; //这儿必须定义,数值根据图片宽度更改,显示软件名称的位置
Wizardform.PageDescriptionLabel.width:= 495 - 164 -42; //显示页面信息的位置
end;
3、自定义BeveledLabel示代码
[code]
procedure InitializeWizard();
begin
WizardForm.BeveledLabel.Enabled:=true; //充许显示
WizardForm.BeveledLabel.Font.Color:=$00058451;; //显示颜色
WizardForm.BeveledLabel.Font.Style := WizardForm.BeveledLabel.Font.Style + [fsBold]; //显示字体
WizardForm.BeveledLabel.Left:=5; //显示位置
end;
4、自定义安装向导图片
[code]
procedure InitializeWizard();
begin
Wizardform.WELCOMELABEL1.left:= 18; //自定义欢迎页面标题1显示位置
Wizardform.WELCOMELABEL2.left:= 18; //自定义欢迎页面标题2显示位置
Wizardform.WizardBitmapImage.left:= WizardForm.width-164 //自定义安装向导图片显示位置(显示大小,此处为居右显示)
end;