const
FR_PRIVATE = $10;
var
BevelF1,BevelF2: TBevel;
WelcomeLabel,StatLabel,SelectLabel: TLabel;
FreeSpaceLabel,NeedSpacelabel,InstallSpaceLabel: TLabel;
FreeMB,TotalMB: Cardinal;
// FONT---------------------------------------------------------------------------
function AddFontResource(lpszFilename: String; fl, pdv: DWORD): Integer;
external 'AddFontResourceExA@gdi32.dll stdcall';
function RemoveFontResource(lpFileName: String; fl, pdv: DWORD): BOOL;
external 'RemoveFontResourceExA@gdi32.dll stdcall';
//----------------------------------------------------------------------------------
// VISUAL STYLE---------------------------------------------------------------------------
procedure SetThemeAppProperties(dwFlags: DWORD);
external 'SetThemeAppProperties@uxtheme.dll stdcall';
//----------------------------------------------------------------------------------
// SKIN---------------------------------------------------------------------------
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall delayload setuponly';
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall delayload setuponly';
procedure LoadSkinU(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@{tmp}\isskin.dll stdcall delayload uninstallonly';
procedure UnloadSkinU();
external 'UnloadSkin@{tmp}\isskin.dll stdcall delayload uninstallonly';
//----------------------------------------------------------------------------------
// SPLASH---------------------------------------------------------------------------
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer);
external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
//----------------------------------------------------------------------------------
// SYSTEM CHECK---------------------------------------------------------------------------
function GetVideoCardName(): PChar;
external 'hwc_GetVideoCardName@files:get_hw_caps.dll stdcall';
function GetSoundCardName(): PChar;
external 'hwc_GetSoundCardName@files:get_hw_caps.dll stdcall';
function DetectHardware(): Integer;
external 'hwc_DetectHardware@files:get_hw_caps.dll stdcall';
function GetHardDriveFreeSpace(hdd: integer): Integer;
external 'hwc_GetHardDriveFreeSpace@files:get_hw_caps.dll stdcall';
function GetHardDriveName(hdd: integer): PChar;
external 'hwc_GetHardDriveName@files:get_hw_caps.dll stdcall';
function GetHardDriveTotalSpace(hdd: integer): Integer;
external 'hwc_GetHardDriveTotalSpace@files:get_hw_caps.dll stdcall';
function GetHardDrivesCount(): Integer;
external 'hwc_GetHardDrivesCount@files:get_hw_caps.dll stdcall';
function GetSoundCards(): Integer;
external 'hwc_GetSoundCards@files:get_hw_caps.dll stdcall';
function GetSystemPage(): Integer;
external 'hwc_GetSystemPage@files:get_hw_caps.dll stdcall';
function GetSystemPhys(): Integer;
external 'hwc_GetSystemPhys@files:get_hw_caps.dll stdcall';
function GetVidMemLocal(): Integer;
external 'hwc_GetVidMemLocal@files:get_hw_caps.dll stdcall';
function GetVidMemNonLocal(): Integer;
external 'hwc_GetVidMemNonLocal@files:get_hw_caps.dll stdcall';
function GetVideoCardDev(): Integer;
external 'hwc_GetVideoCardDev@files:get_hw_caps.dll stdcall';
function GetVideoCardVen(): Integer;
external 'hwc_GetVideoCardVen@files:get_hw_caps.dll stdcall';
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------\\
const // æèðíîñòü øðèôòà
FW_DONTCARE = 0;
FW_THIN = 100;
FW_ULTRALIGHT = 200;
FW_LIGHT = 300;
FW_NORMAL = 400;
FW_MEDIUM = 500;
FW_DEMIBOLD = 600;
FW_BOLD = 700;
FW_ULTRABOLD = 800;
FW_BLACK = 900;
procedure IsPicInit(Handle : HWND);
external 'IsPicInit@files:IsPicture2.dll stdcall delayload';
// íà÷àëî ðàáîòû
procedure IsPicAddImg(fName : AnsiString);
external 'IsPicAddImg@files:IsPicture2.dll stdcall delayload';
// èçîáðàæåíèå íà çàäíåì ôîíå
procedure IsPicAddVideo(fName : AnsiString; l, t, w, h : Integer; test : Boolean);
external 'IsPicAddVideo@files:IsPicture2.dll stdcall delayload';
// âèäåî íà çàäíåì ôîíå
// fName - èìÿ ôàéëà
// l, t, w, h - ïîëîæåíèå è ðàçìåð âèäåî
// test ïîêàç ñîîáùåíèé îá îøèáêàõ: True - ñ ñîîáùåíèÿìè, false - áåç ñîîáùåíèé
function IsPicReFont(OldFont: HWND; Size, Weight : Integer; Italic : Boolean; Name : AnsiString) : HWND;
external 'IsPicReFont@files:IsPicture2.dll stdcall delayload';
// ïîäìåíà øðèôòà äëÿ áîðüáû ñ àðòåôàêòàìè ñãëàæèâàíèÿ
// Size - ðàçìåð øðèôòà
// Weight - æèðíîñòü
// Italic - íàêëîííîñòü
// Name -èìÿ øðèôòà
procedure IsPicStopVideo;
external 'IsPicStopVideo@files:IsPicture2.dll stdcall delayload';
// îñòàíîâêà âîñïðîèçâåäåíèÿ âèäåî - ïîñëå ýòîé êîìàíäû
// âèäåî áóäåò ïîëíîñòüþ âûãðóæåíî
function IsPicChecVideo : Boolean;
external 'IsPicChecVideo@files:IsPicture2.dll stdcall delayload';
// ïðîâåðêà óñïåøíîñòè çàãðóçêè âèäåî
function IsPicChecSound : Boolean;
external 'IsPicChecSound@files:IsPicture2.dll stdcall delayload';
// ïðîâåðêà óñïåøíîñòè çàãðóçêè çâóêà
procedure IsPicPauseVideo(play : Boolean);
external 'IsPicPauseVideo@files:IsPicture2.dll stdcall delayload';
// ïàóçà âèäåî
// play -
// åñëè çíà÷åíèå True, òî ïðîäîëæàåì âîñïðîèçâîäèòü
// åñëè çíà÷åíèå False, òî ñòàâèì íà ïàóçó
procedure IsPicSetVolume(volume : Integer);
external 'IsPicSetVolume@files:IsPicture2.dll stdcall delayload';
// ãðîìêîñòü âèäåî îò -10000 äî 0.
// -10000 - ìèíèìàëüíîå çíà÷åíèå
// 0 - ìàêñèìàëüíîå çíà÷åíèå
procedure IsPicDeInit;
external 'IsPicDeInit@files:IsPicture2.dll stdcall delayload';
// íå çàáûâàåì âûçâàòü â DeinitializeSetup
//----------------------------------------------------------------------------------\\
// НАЧАЛО МЕСТО ДЛЯ УСТАНОВКИ
function NumToStr(Float: Extended): String;
begin
Result:= format('%.2n', [Float]); StringChange(Result, ',', '.');
while (Result[Length(Result)] = '0')or((Result[Length(Result)] = '.')and(Pos('.', Result) > 0)) do
SetLength(Result, Length(Result)-1);
end;
function MbOrTb(Float: Extended): String;
begin
if Float < 1024 then Result:= NumToStr(Float)+' Мб' else
if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+' Гб' else
Result:= NumToStr(Float/(1024*1024))+' Тб';
end;
procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
FreeSpaceLabel.Caption:= ExpandConstant('{cm:FreeSpace} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'% )';
InstallSpacelabel.Caption:= ExpandConstant('{cm:InstallSpace} ')+MbOrTb({#NeedInstallSize});
NeedSpaceLabel.Caption:= ExpandConstant('{cm:NeedSpace} ')+MbOrTb({#NeedSize});
WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})and(FreeMB>{#NeedSize}) ;
if WizardForm.NextButton.Enabled then FreeSpaceLabel.Font.Color:=$FFFFFF else FreeSpaceLabel.Font.Color:=$0000FF;
end;
// КОНЕЦ МЕСТО ДЛЯ УСТАНОВКИ
function InitializeSetup(): Boolean;
begin
SetThemeAppProperties(0); // ВЫРУБАЕМ ВИЗУАЛЬНЫЙ СТИЛЬ
// ЗАГРУЖАЕМ СКИН
ExtractTemporaryFile('Skin.cjstyles');
LoadSkin(ExpandConstant('{tmp}\Skin.cjstyles'), '');
// ЗАГРУЖАЕМ ШРИФТ
if not FontExists('{#FontName}') then begin
ExtractTemporaryFile('{#Font}');
AddFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
end;
Result:= True;
end;
// ЗАПУСК ПОКАЗА SPLASH
(*procedure RunSplash;
begin
ExtractTemporaryFile('Splash.png');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\Splash.png',1000,3000,1000,0,255,False,$FFFFFF,10);
end;*)
procedure RedesignWizardForm;
var
fName : AnsiString; // переменная для своего шрифта
begin
// РАСПАКОВКА КАРТИНОК
ExtractTemporaryFile('fon.bmp');
ExtractTemporaryFile('CBImg.bmp');
with WizardForm do begin
ClientWidth:=ScaleX(600); // ШИРИНА
ClientHeight:=ScaleY(400); // ВЫСОТА
Center;
InnerNotebook.Hide;
OuterNotebook.Hide;
Bevel.Hide;
// БЭВЕЛЫ
BevelF1 := TBevel.Create(WizardForm);
with BevelF1 do
begin
Parent := WizardForm;
Left := ScaleX(0);
Top := ScaleY(50);
Width := ScaleX(600);
Height := ScaleY(1);
end;
BevelF2 := TBevel.Create(WizardForm);
with BevelF2 do
begin
Parent:=WizardForm;
Left := ScaleX(0);
Top := ScaleY(350);
Width := ScaleX(600);
Height := ScaleY(1);
end;
// БЭВЕЛЫ
// НАЧАЛО КНОПКИ
with WizardForm.NextButton do begin
Left := ScaleX(393);
Top := ScaleY(364);
Width := ScaleX(95);
Height := ScaleY(25);
Font.Name := '{#FontName}';
Font.Size:= 10;
end;
with WizardForm.CancelButton do begin
Left := ScaleX(493);
Top := ScaleY(364);
Width := ScaleX(95);
Height := ScaleY(25);
Font.Name := '{#FontName}';
Font.Size:= 10;
end;
with WizardForm.BackButton do begin
Left := ScaleX(293);
Top := ScaleY(364);
Width := ScaleX(95);
Height := ScaleY(25);
Font.Name := '{#FontName}';
Font.Size:= 10;
end;
with WizardForm.DirBrowseButton do begin
Left := ScaleX(493);
Top := ScaleY(190);
Width := ScaleX(90);
Height := ScaleY(23);
Font.Name := '{#FontName}';
Font.Size:= 10;
Parent:=WizardForm;
end;
with WizardForm.GroupBrowseButton do begin
Left := ScaleX(493);
Top := ScaleY(240);
Width := ScaleX(90);
Height := ScaleY(23);
Font.Name := '{#FontName}';
Font.Size:= 10;
Parent:=WizardForm;
end;
// КОНЕЦ КНОПКИ
// ЕДИТ
with WizardForm.DirEdit do
begin
Left := ScaleX(25);
Top := ScaleY(190);
Width := ScaleX(460);
Font.Name := '{#FontName}';
Font.Size:= 10;
Font.Color:=$FFFFFF;
Parent:=WizardForm;
end;
with WizardForm.GroupEdit do
begin
Left := ScaleX(25);
Top := ScaleY(240);
Width := ScaleX(460);
Font.Name := '{#FontName}';
Font.Size:= 10;
Font.Color:=$FFFFFF;
Parent:=WizardForm;
end;
// ЕДИТ
// НАЧАЛО ЛЕЙБЛЫ
WelcomeLabel:= TLabel.Create(WizardForm);
with WelcomeLabel do begin
AutoSize:=False;
SetBounds(ScaleX(25), ScaleY(220), ScaleX(550), ScaleY(60));
WordWrap:=True;
Transparent:=True;
//Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Caption:= ExpandConstant('{cm:WelcomeLabel}');
Parent:=WizardForm;
end;
FreeSpaceLabel:= TLabel.Create(WizardForm);
with FreeSpaceLabel do begin
Parent:= WizardForm;
Left:= ScaleX(25);
Top:= ScaleY(280);
Width:= ScaleX(300);
Height:= ScaleY(20);
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Transparent:= True;
end;
InstallSpacelabel:= TLabel.Create(WizardForm);
with InstallSpacelabel do begin
Parent:= WizardForm;
Left:= ScaleX(25);
Top:= ScaleY(300);
Width:= ScaleX(300);
Height:= ScaleY(20);
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Transparent:= True;
end;
NeedSpaceLabel:= TLabel.Create(WizardForm);
with NeedSpaceLabel do begin
Parent:= WizardForm;
Left:= ScaleX(25);
Top:= ScaleY(320);
Width:= ScaleX(300);
Height:= ScaleY(20);
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Transparent:= True;
end;
WizardForm.DirEdit.OnChange:=@DirEditOnChange;
StatLabel:= TLabel.Create(WizardForm);
with StatLabel do begin
AutoSize:=False;
SetBounds(ScaleX(20), ScaleY(15), ScaleX(450), ScaleY(50));
WordWrap:=True;
Transparent:=True;
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Parent:=WizardForm;
end;
SelectLabel:= TLabel.Create(WizardForm);
with SelectLabel do begin
AutoSize:=False;
SetBounds(ScaleX(25), ScaleY(140), ScaleX(550), ScaleY(60));
WordWrap:=True;
Transparent:=True;
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Caption:= ExpandConstant('{cm:Select}');
Parent:=WizardForm;
end;
FinisLabel:= TLabel.Create(WizardForm);
with FinisLabel do begin
AutoSize:=False;
SetBounds(ScaleX(25), ScaleY(220), ScaleX(550), ScaleY(60));
WordWrap:=True;
Transparent:=True;
Font.Name := '{#FontName}';
Font.Size:= 12;
Font.Color:=$FFFFFF;
Caption:= ExpandConstant('{cm:Finished}');
Parent:=WizardForm;
end;
with WizardForm.ComponentsList do
begin
//BorderStyle := bsNone;
TreeViewStyle := True;
Parent := WizardForm;
Width := ScaleX(500);
Left := ScaleX(50);
Top := ScaleY(150);
Height := ScaleY(185);
//Font.Name := '{#FontName}';
//Font.Size:= 9;
Font.Color:=$FFFFFF;
LoadBtnBmpFromFile(ExpandConstant('{tmp}\CBImg.bmp'));
end;
// ПОДМЕНЯЕМ ШРИФТЫ---------------------------------------------------------------------------
fName := 'Trebuchet MS'; // задаем желаемый шрифт
//Font.Handle := IsPicReFont(Font.Handle, Font.Size, FW_DEMIBOLD, False, fName);
WelcomeLabel.Font.Handle := IsPicReFont(WelcomeLabel.Font.Handle, WelcomeLabel.Font.Size, 500, False, fName);
(*NextButton.Font.Handle := IsPicReFont(NextButton.Font.Handle, NextButton.Font.Height, 100, False);
CancelButton.Font.Handle := IsPicReFont(CancelButton.Font.Handle, CancelButton.Font.Height, 100, False);
BackButton.Font.Handle := IsPicReFont(BackButton.Font.Handle, BackButton.Font.Height, 100, False);
DirBrowseButton.Font.Handle := IsPicReFont(DirBrowseButton.Font.Handle, DirBrowseButton.Font.Height, 100, False);
GroupBrowseButton.Font.Handle := IsPicReFont(GroupBrowseButton.Font.Handle, GroupBrowseButton.Font.Height, 100, False);
DirEdit.Font.Handle := IsPicReFont(DirEdit.Font.Handle, DirEdit.Font.Height, 100, False);
GroupEdit.Font.Handle := IsPicReFont(GroupEdit.Font.Handle, GroupEdit.Font.Height, 100, False);
WelcomeLabel.Font.Handle := IsPicReFont(WelcomeLabel.Font.Handle, WelcomeLabel.Font.Height, 100, False);
FreeSpaceLabel.Font.Handle := IsPicReFont(FreeSpaceLabel.Font.Handle, FreeSpaceLabel.Font.Height, 100, False);
InstallSpacelabel.Font.Handle := IsPicReFont(InstallSpacelabel.Font.Handle, InstallSpacelabel.Font.Height, 100, False);
NeedSpaceLabel.Font.Handle := IsPicReFont(NeedSpaceLabel.Font.Handle, NeedSpaceLabel.Font.Height, 100, False);
StatLabel.Font.Handle := IsPicReFont(StatLabel.Font.Handle, StatLabel.Font.Height, 100, False);
SelectLabel.Font.Handle := IsPicReFont(SelectLabel.Font.Handle, SelectLabel.Font.Height, 100, False);
ComponentsList.Font.Handle := IsPicReFont(ComponentsList.Font.Handle, ComponentsList.Font.Height, 0, False);
FinisLabel.Font.Handle := IsPicReFont(FinisLabel.Font.Handle, FinisLabel.Font.Height, 100, False);*)
//----------------------------------------------------------------------------------
// ЦВЕТ ПРОЗРАЧНОСТИ - $000008.
// УКАЗЫВАЕМ ЕГО ДЛЯ ЭЛЕМЕНТОВ,КОТОРЫЕ ДОЛЖНЫ БЫТЬ ПРОЗРАЧНЫМИ
Color := $000008;
DirEdit.Color := $000008;
GroupEdit.Color := $000008;
ComponentsList.Color := $000008;
// ЗАПУСКАЕМ
IsPicInit(Handle);
end;
// ДОБАВЛЯЕМ ИЗОБРАЖЕНИЕ НА ЗАДНИЙ ФОН
IsPicAddImg(ExpandConstant('{tmp}\fon.bmp'));
//end;
// Начало WelcomePage
//procedure CreatePageComponents;
//begin
//ExtractTemporaryFile('CBImg.bmp');
(*WelcomeLabel:= TLabel.Create(WizardForm);
with WelcomeLabel do begin
AutoSize:=False;
SetBounds(ScaleX(5), ScaleY(188), ScaleX(350), ScaleY(35));
WordWrap:=True;
Transparent:=True;
Font.Name:='Arial';
Font.Size:= 8;
Font.Color:=$000000;
Font.Style:=[fsBold];
Caption:= ExpandConstant('{cm:WelcomeLabel}');
Parent:=WizardForm;
end;*)
// Конец WelcomePage
// Начало SelectDirPage
// Конец SelectDirPage
// Начало SelectProgramGroupPage
(*with WizardForm.ComponentsList do
begin
//BorderStyle := bsNone;
//Color := clMenu;
TreeViewStyle := True;
//WantTabs := True;
Parent := WizardForm;
Width := ScaleX(400);
Left := ScaleX(50);
Top := ScaleY(45);
Height := ScaleY(120);
LoadBtnBmpFromFile(ExpandConstant('{tmp}\CBImg.bmp'));
//Cursor:= crHand;
end;*)
// Конец SelectProgramGroupPage
// Начало InstallingPage
// Конец InstallingPage
// Начало FinishedPage
end;
// Конец FinishedPage
procedure HideComponents;
begin
(*ImgSetVisibility(WizardImg1, False);
ImgSetVisibility(WizardImg2, False);
ImgSetVisibility(DirFolder, False);
ImgSetVisibility(GroupFolder, False);
ImgSetVisibility(HDD, False);*)
BevelF1.Hide;
WelcomeLabel.Hide;
StatLabel.Hide;
WizardForm.DirEdit.Hide;
WizardForm.DirBrowseButton.Hide;
WizardForm.GroupEdit.Hide;
WizardForm.GroupBrowseButton.Hide;
WizardForm.ComponentsList.Hide;
SelectLabel.Hide;
FreeSpaceLabel.Hide;
InstallSpacelabel.Hide;
NeedSpaceLabel.Hide;
FinisLabel.Hide;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID =wpSelectProgramGroup)or(PageID =wpReady)then
Result:= True;
end;
procedure ShowComponents(CurPageID: Integer);
begin
if CurPageID = wpWelcome then
begin
//ImgSetVisibility(WizardImg1, True);
WelcomeLabel.Show;
end;
if CurPageID = wpSelectDir then
begin
StatLabel.Show;
StatLabel.Caption:= 'Выбор папки установки и папки в меню «Пуск»'
DirEditOnChange(nil)
BevelF1.Show;
WizardForm.DirEdit.Show;
WizardForm.DirBrowseButton.Show;
WizardForm.GroupEdit.Show;
WizardForm.GroupBrowseButton.Show;
SelectLabel.Show;
FreeSpaceLabel.Show;
InstallSpacelabel.Show;
NeedSpaceLabel.Show;
//ImgSetVisibility(DirFolder, True);
//ImgSetVisibility(GroupFolder, True);
//ImgSetVisibility(HDD, True);
end;
if CurPageID = wpSelectComponents then
begin
BevelF1.Show;
StatLabel.Show;
StatLabel.Caption:= 'Выбор компонентов'
WizardForm.NextButton.Caption:= 'Установить';
WizardForm.ComponentsList.Show;
end;
if CurPageId = wpInstalling then
begin
StatLabel.Show;
StatLabel.Caption:= 'Установка...'
BevelF1.Show;
end;
if CurPageID = wpFinished then
begin
FinisLabel.Show;
WizardForm.NextButton.Left := WizardForm.CancelButton.Left;
end;
end;
procedure InitializeWizard;
begin
//RunSplash;
RedesignWizardForm;
//System_Check;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
UnpackingISDone(CurStep);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
WizardForm.Caption:= ExpandConstant('{cm:SetupWindowTitle}');
WizardForm.CancelButton.Caption:= 'Выход';
HideComponents;
ShowComponents(CurPageID);
UnpackingISDoneFinished(CurPageID);
//ImgApplyChanges(WizardForm.Handle);
end;
procedure DeinitializeSetup();
begin
RemoveFontResource(ExpandConstant('{tmp}\{#Font}'), FR_PRIVATE, 0);
UnloadSkin();
IsPicDeInit;
end;
////////////////////////////////////////////////////////
function InitializeUninstall(): Boolean;
begin
FileCopy(ExpandConstant('{app}\isskin.dll'),
ExpandConstant('{tmp}\isskin.dll'), False);
FileCopy(ExpandConstant('{app}\Skin.cjstyles'),
ExpandConstant('{tmp}\Skin.cjstyles'), False); LoadSkinU(ExpandConstant('{tmp}\Skin.cjstyles'), '');
Result:=True;
end;
procedure DeinitializeUninstall();
begin
UnloadSkinU();
end;