#ifdef UNICODE
#define S "U"
#else
#define S "A"
#endif
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Files]
Source: Files\botva2.dll; DestDir: {app}; Flags: ignoreversion; Attribs: hidden system;
Source: Files\Skin.cjstyles; DestDir: {app}\Uninstall; Flags: ignoreversion; Attribs: hidden system;
Source: Files\ISSkin{#S}.dll; DestDir: {app}\Uninstall; Flags: ignoreversion; Attribs: hidden system;
Source: Icon.png; DestDir: {app}; Attribs: hidden system;
[Code_]
function ImgLoad(Wnd: HWND; FileName: PAnsiChar; Left, Top, Width, Height:integer; Stretch, IsBkg: boolean): Longint; external'ImgLoad@{tmp}\botva2.dll stdcall delayload';
procedure ImgApplyChanges(h: HWND); external'ImgApplyChanges@{tmp}\botva2.dll stdcall delayload';
procedure gdipShutdown; external'gdipShutdown@{tmp}\botva2.dll stdcall delayload';
procedure LoadSkin(lpszPath: String; lpszIniFileName: String); external'LoadSkin@{tmp}\isskin{#S}.dll stdcall delayload';
procedure UnloadSkin; external 'UnloadSkin@{tmp}\isskin{#S}.dll stdcall delayload';
function ShowWindow(hWnd: Integer; uType: Integer): Integer; external'ShowWindow@user32.dll stdcall';
var
AutoRun : TSetupForm;
OkButton, CancelButton: TButton;
LangEdit : TComboBox;
MsgStr: TLabel;
AppDir: string;
eng,cl,nocl: boolean;
m,n: integer;
procedure LangChange(Sender : TObject);
begin
if GetUILanguage = $0419 then
begin
m:=0;
n:=1;
end else begin
m:=1;
n:=0;
end;
case LangEdit.ItemIndex of
m: begin
with AutoRun do begin
MsgStr.Caption:= 'Select language, which will use at installing'#13'process:';
CancelButton.Caption := 'Cancel';
OkButton.Caption:= 'OK';
Caption := 'Select setup language';
Application.Title := 'Setup';
end;
SelectLanguageForm.LangCombo.ItemIndex := 0;
eng :=true;
end;
n: begin
with AutoRun do begin
MsgStr.Caption:= 'Выберите язык,который будет использован'#13'в процессе установки:';
CancelButton.Caption := 'Отмена';
OkButton.Caption:= 'ОК';
Caption := 'Выберите язык установки';
Application.Title := 'Установка';
end;
SelectLanguageForm.LangCombo.ItemIndex := 1;
eng :=true;
end;
end;
end;
procedure OkClick(Sender: TObject);
begin
if not eng then
begin
if GetUILanguage = $0419 then
begin
SelectLanguageForm.LangCombo.ItemIndex := 1;
end else begin
SelectLanguageForm.LangCombo.ItemIndex := 0;
end;
end;
NoCl:=true;
AutoRun.Close;
end;
procedure FormOnClose(Sender: TObject; var Action: TCloseAction);
begin
if not NoCl then
begin
Cl:=true;
end;
end;
procedure CancelClick(Sender: TObject);
begin
AutoRun.Close;
end;
procedure Lang;
begin
AutoRun := CreateCustomForm;
with AutoRun do
begin
Width := ScaleX(375);
Height := ScaleY(155);
BorderIcons := [biSystemMenu];
Position := poScreenCenter;
OnClose := @FormOnClose;
if GetUILanguage = $0419 then
Caption := 'Выберите язык установки'
else
Caption := 'Select setup language';
end;
MsgStr:= TLabel.Create(AutoRun);
with MsgStr do
begin
SetBounds(ScaleX(130), ScaleY(10), ScaleX(230), ScaleY(42));
Transparent:= True;
Parent:= AutoRun;
if GetUILanguage = $0419 then
Caption:= 'Выберите язык,который будет использован'#13'в процессе установки:'
else
Caption:= 'Select language, which will use at installing'#13'process:';
end;
LangEdit := TComboBox.Create(AutoRun)
with LangEdit do
begin
SetBounds(ScaleX(130), ScaleY(55), ScaleX(230), ScaleY(21));
Parent := AutoRun;
Style := csDropDownList;
OnChange := @LangChange;
if GetUILanguage = $0419 then
begin
Items.add('English')
Items.add('Русский')
end else begin
Items.add('Русский')
Items.add('English')
end;
ItemIndex := 0
ItemIndex := 1
end;
OkButton:= TButton.Create(AutoRun);
with OkButton do
begin
Parent:= AutoRun;
SetBounds(ScaleX(210), ScaleY(90), ScaleX(75), ScaleY(23));
OnClick:= @OkClick;
if GetUILanguage = $0419 then
Caption:= 'ОК'
else
Caption:= 'OK';
end;
CancelButton:= TButton.Create(AutoRun);
with CancelButton do
begin
Parent:= AutoRun;
SetBounds(ScaleX(290), ScaleY(90), ScaleX(75), ScaleY(23));
OnClick:= @CancelClick;
if GetUILanguage = $0419 then
Caption:= 'Отмена'
else
Caption := 'Cancel';
end;
if GetUILanguage = $0419 then
begin
Application.Title := 'Установка';
end else begin
Application.Title := 'Setup';
end;
ExtractTemporaryFile('Icon.png');
ImgLoad(AutoRun.Handle, ExpandConstant('{tmp}\Icon.png'), 0, 0, 125,125, True, True);
ImgApplyChanges(AutoRun.Handle);
AutoRun.ShowModal;
AutoRun.Free;
end;
function InitializeSetup(): Boolean;
begin
if Cl then
begin
Result:= False;
end else begin
Result:= True;
end;
end;
procedure DeinitializeSetup();
begin
gdipShutdown;
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
Sleep(150);
UnloadSkin();
end;
function InitializeLanguageDialog(): Boolean;
begin
ExtractTemporaryFile('ISSkin{#S}.dll');
ExtractTemporaryFile('Skin.cjstyles');
LoadSkin(ExpandConstant('{tmp}\Skin.cjstyles'), '');
if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
Lang;
Result := false;
end;