首页 > 其他分享 >inno setup基础的脚本代码

inno setup基础的脚本代码

时间:2024-08-27 14:38:47浏览次数:5  
标签:WizardForm setup MainLabel Flags MyButton inno app 代码 define

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

#define MyAppName "Leawo Blu-ray Player"
#define MyAppVersion "1.0.0.0"
#define MyAppPublisher "moyea"
#define MyAppURL "https://www.example.com/"
#define MyAppExeName "leawo_player.exe"
;版本类型: 0--正式版, 1--CNET版本  2--德文版本    3--日语版
#define Brand "Leawo"
#define PrjType "bdplayer"
#define Language "ml"
;定义安装界面侧图
#define Background "BDPlayer.bmp"

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
AppId={{08C4E9F8-34EB-4B81-BC68-352EACDBF79B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;程序默认的安装路径
DefaultDirName=E:\Leawo\{#MyAppName} 
DisableProgramGroupPage=yes

; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
;PrivilegesRequired=lowest
OutputDir=C:\Users\moyea\Desktop\myapp
OutputBaseFilename=myapp_setup
SetupIconFile=C:\Users\moyea\Desktop\myapp\icon\BDPlayer.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"; LicenseFile:C:\Users\moyea\Desktop\myapp\license\en\license.txt 
Name: "zh"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"; LicenseFile:C:\Users\moyea\Desktop\myapp\license\zh\license.txt 

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

[Files]
//exe的路径
Source: "C:\Users\moyea\Desktop\myapp\app\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion

Source: release\core\*.*; DestDir: {app};  Flags: ignoreversion recursesubdirs createallsubdirs
Source: release\qt\*.*; DestDir: {app};  Flags: ignoreversion recursesubdirs createallsubdirs
Source: release\other\*.*; Excludes: language; DestDir: {app};  Flags: ignoreversion recursesubdirs createallsubdirs
Source: release\other\language\*.*; DestDir: {app}\language;  Flags: ignoreversion recursesubdirs createallsubdirs

;vs2013
Source: release\other\msvcr120.dll; DestDir: {sys}; Flags: onlyifdoesntexist ;
Source: release\other\msvcp120.dll; DestDir: {sys}; Flags: onlyifdoesntexist ;
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

Source: image\{#Brand}\{#Language}\{#Background}; Flags: dontcopy


[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

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


[Code]
var
myPage: TwizardPage;
myBtn: TButton;
myLbl: TLabel;
MyButton: TNewButton;



function  ReleaseCapture(): Longint; external '[email protected] stdcall';


procedure ClickmyBtn(Sender: TObject);
begin
myLbl.Caption:='你点击了按钮~';
myLbl.Color:=clRed;
end;

procedure ButtonClick(Sender: TObject);
begin
  MsgBox('按钮被点击了!', mbInformation, MB_OK);
end;

//窗口移动
procedure WizardFormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture
  SendMessage(WizardForm.Handle, $0112, $F012, 0);
end;

//在启动时使用该事件函数来改变向导或向导页面
procedure InitializeWizard();
var 
      MainLabel: TLabel;
      szRegRoot,sTempFileName,strName: string;
begin
  #if 0
   //创建一个自定义页面
myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面');

myBtn:=TButton.Create(myPage);
myBtn.Parent:=myPage.Surface;
myBtn.Caption:='点我~';
myBtn.OnClick:=@ClickmyBtn;

myLbl:=TLabel.Create(myPage);
myLbl.Parent:=myPage.Surface;
myLbl.Top:=myBtn.Top+50;
myLbl.Caption:='我是标签~';

    MyButton := TNewButton.Create(myPage);
    MyButton.Parent := myPage.Surface;
    MyButton.Caption := '我是按钮';
    MyButton.OnClick := @ButtonClick;
    MyButton.Width := ScaleX(75);
    MyButton.Height := ScaleY(23);
    MyButton.Top := ScaleY(20);
    MyButton.Left := ScaleX(10);


     // 设置欢迎向导页的尺寸大小
    WizardForm.OuterNotebook.hide; //隐藏默认的导向内容
    WizardForm.Bevel.Hide;                 // 隐藏分隔线
    WizardForm.BorderStyle:=bsnone; //去边框
    WizardForm.Position:=poScreenCenter;// 位置屏幕居中
    //WizardForm.NextButton.Width:=0;    // 隐藏下一步按钮
    //WizardForm.BackButton.Width:=0;    // 隐藏跳过按钮
    //WizardForm.CancelButton.Width:=0; // 隐藏取消按钮
    // WizardForm.Center;
    WizardForm.Width:=650;
    WizardForm.Height:=450;
    // WizardForm.Color:=clWhite;
    // WizardForm.InnerNotebook.Hide;
    // wizardform.Color:=TransparentColor;

    // 添加可以拖动窗口的Label
    MainLabel := TLabel.Create(WizardForm);
    MainLabel.Parent := WizardForm;
    MainLabel.AutoSize := False;
    MainLabel.Left := 0;
    MainLabel.Top := 0;
    MainLabel.Width := WizardForm.Width;
    MainLabel.Height := WizardForm.Height;
    MainLabel.Caption := '你好';
    MainLabel.Color := clRed;
    //MainLabel.Transparent := True; //设置成透明
    MainLabel.OnMouseDown := @WizardFormMouseDown;
  #endif
   // 获取安装包名字
  strName := ParamStr(0);//ParamStr返回传递给安装程序或卸载程序的命令行参数的索引,不包括安装程序和卸载程序使用的未记录的内部参数。参数编号为 0,是启动安装或卸载时的完整文件名。如果索引无效,ParamStr 将返回空字符串。
  sTempFileName := ExtractFileName(strName); //ExtractFileName返回给定文件名的名称部分。如果 PathName 末尾带有反斜杠,则结果是一个空字串。
   // 显示安装包名字
  MsgBox('安装包名字是: ' + sTempFileName, mbInformation, MB_OK);


  szRegRoot := ExpandConstant('Software\Leawo Software\SoftwarePassport\' + 'Leawo Blu-ray Player' + '\0');
  RegWriteStringValue(HKEY_CURRENT_USER, szRegRoot, 'Version-Type', '666');

end;

 

标签:WizardForm,setup,MainLabel,Flags,MyButton,inno,app,代码,define
From: https://www.cnblogs.com/zhuchunlin/p/18382630

相关文章