PDA

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 7]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 [79] 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

Nightwishh
15-09-2014, 19:58
Можно так, например: »Спасибо, неплохой вариант.

Nightwishh
16-09-2014, 00:07
saurn Ой, появилась одна проблема[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Files]
Source: {fonts}\*; DestDir: {app}; Flags: external

[ Code]
type
WPARAM = Integer;
LPARAM = Integer;
LRESULT = Integer;
TFNWndProc = Integer;

function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
function CallWindowProc(lpPrevWndFunc: TFNWndProc; hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; external 'CallWindowProcA@user32.dll stdcall';

var
OldStaticProcAddr: Longint;
Label1: TLabel;

function StaticWindowdProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
var
_String: String;
begin
if Msg = $000F then begin
_String:= WizardForm.StatusLabel.Caption
Label1.Caption:= _String; //для теста
end;
Result:= CallWindowProc(OldStaticProcAddr, hWnd, Msg, wParam, lParam);
end;

procedure InitializeWizard();
begin
OldStaticProcAddr:= SetWindowLong(WizardForm.StatusLabel.Handle, -4, CallbackAddr('StaticWindowdProc'));


Label1:= TLabel.Create(WizardForm);
with Label1 do
begin
Parent:= WizardForm.InstallingPage;
AutoSize:= False;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(14);
end;
// WizardForm.OuterNotebook.Hide;
end;

procedure DeinitializeSetup();
begin
SetWindowlong(WizardForm.StatusLabel.Handle, -4, OldStaticProcAddr);
end;При WizardForm.OuterNotebook.Hide;Лейбл пустой, и на WizardForm точно также было...

saurn
16-09-2014, 12:58
Nightwishh, ага, не дружит с невидимыми окнами, есть такое. Тут (http://forum.oszone.net/post-2091992-1651.html) присутствует другой вариант.

Nightwishh
16-09-2014, 13:32
saurn, Но там нет статуса, как я понял. Там путь и строкой ниже имя файла. Хотелось бы сделать этот статус, так как после распаковки работает секция [Run], а устанавливать всё это через код невыгодно.

AlexALSP
16-09-2014, 17:36
Подскажите еще один момент.

Задача:

1. копирование фалов
2. копирование файла , если они есть то делать имяфайла.bkp

Есть Выбор установки:

Программы (жесткий выбор)
Установить 123.dll
Установить 345.dll

Программы (с возможностью выбрать или снять выделение)
Установка 123.dll
Установка 345.dll

Вотр тут если выбрана установка второго пункта делать бэкап файлов с первого пункта
Если второй пункт не выбран , ничего не делать.


Вроде просто описал , подсобите ребята, кто знает как воплотить.

Dodakaedr
17-09-2014, 08:32
Подскажите как правильно экспортировать ключ реестра на этапе InitializeSetup? Это не работает. Надо экспортировать в папку где находиться инсталятор.
function InitializeSetup(): Boolean;
var
RCode: Integer;
begin
Exec( ExpandConstant( '{win}\regedit.exe' ), '/e Soft.reg ""HKEY_LOCAL_MACHINE\SOFTWARE\Soft\Drivers""', ExpandConstant( '{src}\Data\Settings' ), SW_HIDE, ewNoWait, RCode );
Result:=False;
end;

С экспортом разобрался, вот только не могу указать папку для экспорта {src}\Data\Settings
function InitializeSetup(): Boolean;
var
RCode: Integer;
RegKey: String;
begin
RegKey := 'HKEY_LOCAL_MACHINE\SOFTWARE\Soft\Drivers';
Exec( ExpandConstant( '{win}\regedit.exe' ), '-ea Soft.reg ' + AddQuotes( RegKey ), ExpandConstant( '{src}\Data\Settings' ), SW_HIDE, ewWaitUntilTerminated, RCode );
Result:=False;
end;

R.i.m.s.k.y.
17-09-2014, 09:31
Dodakaedr,
Exec( ExpandConstant( '{win}\regedit.exe' ), '-ea ' + ExpandConstant( '{src}\Data\Settings\' ) + 'Soft.reg ' + AddQuotes( RegKey ) , ExpandConstant( '{src}\Data\Settings' ), SW_HIDE, ewWaitUntilTerminated, RCode );

Dodakaedr
17-09-2014, 19:13
R.i.m.s.k.y., Не работает.

vint56
17-09-2014, 20:12
astafev_roma, все работает на обычной версий проверил 5.42
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[code]
function ReleaseCapture(): Longint; external 'ReleaseCapture@user32.dll stdcall';

procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(WizardForm.Handle,$0112,$F012,0)
end;

procedure InitializeWizard();
begin
with WizardForm do begin
BorderStyle:=bsNone;
Bevel.Hide;
InnerNotebook.Hide;
OuterNotebook.Hide;
Width:=ScaleX(791);
Height:=ScaleY(291);
Position:=poScreenCenter;
end;
//Создаем лейбл на всю форму, чтоб ее можно было двигать
with TLabel.Create(WizardForm) do begin
Parent:=WizardForm;
AutoSize:=False;
Top:=0;
Left:=0;
Width:=WizardForm.Width;
Height:= WizardForm.Height
Transparent:=True;
OnMouseDown:=@LabelOnMouseDown;
end;
end;

astafev_roma
17-09-2014, 20:21
все работает на обычной версий » ну да для лейбла он работает, а для картинок на стандарте нет (у меня фон картинкой сделан и соответственно ее и двигать нужно).

R.i.m.s.k.y.
17-09-2014, 21:05
Dodakaedr, , поставь SW_SHOW и покажи значение SysErrorMessage(RCode)

Dodakaedr
17-09-2014, 21:19
поставь SW_SHOW и покажи значение SysErrorMessage(RCode) »
Ошибок нету, но и экспорт не происходит#define MyAppName "My programm"
#define MyAppVersion "1.5"

[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
OutputDir=.
Compression=lzma
SolidCompression=yes
VersionInfoDescription={#MyAppName}
VersionInfoVersion={#MyAppVersion}

[Code]
function InitializeSetup(): Boolean;
var
RCode: Integer;
RegKey: String;
begin
RegKey := 'HKEY_CLASSES_ROOT\.mp3';
Exec( ExpandConstant( '{win}\regedit.exe' ), '-ea ' + ExpandConstant( '{src}\Data\Settings\' ) + 'Soft.reg ' + AddQuotes( RegKey ) , ExpandConstant( '{src}' ), SW_SHOW, ewWaitUntilTerminated, RCode );
Result:=False;
end;

El Sanchez
18-09-2014, 10:22
Ошибок нету, но и экспорт не происходит »
Dodakaedr, {src} может быть путем с пробелами, поэтому комстрока не отработает. И папку нужно проверять на наличие.
function InitializeSetup(): Boolean;
var
RCode: Integer;
PathName, RegKey: String;
begin
PathName := ExpandConstant('{src}\Data\Settings');
RegKey := 'HKEY_CLASSES_ROOT\.mp3';
if DirExists(PathName) then
Exec('regedit.exe', Format('-ea "%s\Soft.reg" "%s"', [PathName, RegKey]), '', SW_SHOW, ewWaitUntilTerminated, RCode);
Result := False;
end;

Dodakaedr
18-09-2014, 13:39
И папку нужно проверять на наличие. »
Это обязательно? Потому что её не будет изначально.

Хотя можно создать, но опять же не создает.
function InitializeSetup(): Boolean;
var
RCode: Integer;
PathName, RegKey: String;
begin
CreateDir(ExpandConstant( '{src}\Data\Settings' ));
PathName := ExpandConstant( '{src}\Data\Settings' );
RegKey := 'HKEY_CLASSES_ROOT\.mp3';
if DirExists(PathName) then
Exec('regedit.exe', Format('-ea "%s\Soft.reg" "%s"', [PathName, RegKey]), '', SW_SHOW, ewWaitUntilTerminated, RCode);
Result := False;
end;

Если указать CreateDir(ExpandConstant( '{src}\Data' )); то создает, а две не создает, можно как-то сделать чтобы создавалась {src}\Data\Settings

P.S. Работает. Сделал так: function InitializeSetup(): Boolean;
var
RCode: Integer;
PathName, RegKey: String;
begin
CreateDir(ExpandConstant( '{src}\Data'));
CreateDir(ExpandConstant( '{src}\Data\Settings'));
PathName := ExpandConstant( '{src}\Data\Settings' );
RegKey := 'HKEY_CLASSES_ROOT\.mp3';
if DirExists(PathName) then
Exec('regedit.exe', Format('-ea "%s\Soft.reg" "%s"', [PathName, RegKey]), '', SW_SHOW, ewWaitUntilTerminated, RCode);
Result := False;
end;

Теперь другой вопрос возник: с папками разобрались, а как эспортировать 2,3 и более ключей в один reg файл?

nik1967
18-09-2014, 15:40
с папками разобрались »

function InitializeSetup(): Boolean;
var
RCode: Integer;
PathName, RegKey: String;
begin
PathName:= ExpandConstant('{src}\Data\Settings');
ForceDirectories(PathName);
RegKey:= 'HKEY_CLASSES_ROOT\.mp3';
if DirExists(PathName) then
Exec('regedit.exe', Format('-ea "%s\Soft.reg" "%s"', [PathName, RegKey]), '', SW_SHOW, ewWaitUntilTerminated, RCode);
Result:= False;
end;

Dodakaedr
18-09-2014, 15:43
Так проще :) »
Действительно :) а по поводу ключей не подскажите?

audiofeel
18-09-2014, 16:04
решил приделать "слайд шоу" от экспедитора, но при закрытии ошибка
не знаю даже где что "рыть"
хотел уже взять пример от "ник 1967" но так и не понял как сделать так чтобы слайд шоу было только на странице распаковки
помогите
http://rghost.ru/58079813
http://rghost.ru/58079833

nik1967
18-09-2014, 17:28
хотел уже взять пример от "ник 1967" но так и не понял как сделать так чтобы слайд шоу было только на странице распаковки »
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpInstalling: Timer:= SetTimer(WizardForm.Handle, 0, {#SlideShowSpeed}, CallbackAddr('SlideShow'));
wpFinished: KillTimer(WizardForm.Handle, Timer);
end;
end;;

ROMKA-1977
18-09-2014, 18:30
Помогите пожалуйста!

Есть два кода:
1- скрипт для отображения списка дискового пространства.
2- скрипт отображающий текст из файла rtf в новом окне.

Необходимо объеденить два скрипта так чтобы в новом окне отображалась информация о дисковом пространстве.

Примеры скриптов:

[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Files]
Source: "ReadMeRu.rtf"; DestDir: "{tmp}"; Flags: ignoreversion

[code]
var
InfoForm: TSetupForm;
Info, Ok: TButton;
InfoBefore: TRichEditViewer;
ReadmeRu,ReadmeEn: AnsiString;

procedure Okclick(Sender: TObject);
begin
InfoForm.Close;
WizardForm.Enabled:=True;
end;

procedure FormClose(Sender: TObject; var Action: TCloseAction);
begin
WizardForm.Enabled:=true;
end;

procedure InfoClick(Sender: TObject);
begin
InfoForm:= CreateCustomForm();
with InfoForm do begin
ClientWidth := ScaleX(450);
ClientHeight := ScaleY(230);
CenterInsideControl(WizardForm, False);
Caption:='Readme';
onClose:=@FormClose;
Ok:=tbutton.create(InfoForm)
with Ok do begin
SetBounds(ScaleX(365),ScaleY(200),ScaleX(75),ScaleY(23));
parent:=InfoForm;
Caption:='OK';
onclick:=@OKclick;
end;
InfoBefore:= TRichEditViewer.Create(InfoForm);
with InfoBefore do begin
SetBounds(ScaleX(10),ScaleY(10),ScaleX(430),ScaleY(185));
Parent:= InfoForm;
// ParentColor := True;
// Color:= WizardForm.Color;
// BorderStyle:= bsNone;
ScrollBars:= ssVertical;
ReadOnly:= true;
RTFText:= ReadmeRu
end;
InfoForm.Show;
WizardForm.Enabled:=false;
end;
end;

procedure InitializeWizard;
begin
ExtractTemporaryFile('ReadMeRu.rtf');
LoadStringFromFile(ExpandConstant('{tmp}')+'\ReadMeRu.rtf', ReadmeRu);
Info:=tbutton.create(WizardForm);
with Info do begin
Parent:=WizardForm;
SetBounds(ScaleX(10),ScaleY(327),ScaleX(75),ScaleY(23));
Caption:='Readme';
OnClick:=@InfoClick;
end;
end;


[Setup]
OutputDir=Setup
AppName=DisksInfo
VersionInfoVersion=5.0
AppVerName=DisksInfo
DefaultDirName={pf}\My program
EnableDirDoesntExistWarning=true


[CustomMessages]
Ru.SysDirSelect=Выбранный путь включает в себя системную папку!%nВы уверены, что необходимо продолжать установку?

[Languages]
Name: Ru; MessagesFile: compiler:Languages\Russian.isl

[Code]
var n: Integer;
FreeMB, TotalMB: Cardinal;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;

const oneMB= 1024*1024;
function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего| '+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
end; End;

Function NextButtonClick(CurPageID: Integer): Boolean; Begin
Result:= True
if (CurPageID = wpSelectDir) and (Pos(Uppercase(ExpandConstant('{win}')), Uppercase(ExpandConstant('{app}'))) > 0) then Result:= MessageBox(StrToInt(ExpandConstant('{wizardhwnd}')), ExpandConstant('{cm:SysDirSelect}'), 'Установка в системную папку', MB_YESNO or $30) = idYes;
End;

Procedure CurPageChanged(CurPageID: Integer);
Begin
if CurPageID = wpSelectDir then ListBoxRefresh
End;

Procedure InitializeWizard;
Begin
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= [fsBold]
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
End;

Nordek
18-09-2014, 19:09
ROMKA-1977,

[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
EnableDirDoesntExistWarning=true

[Files]
Source: "ReadMeRu.rtf"; DestDir: "{tmp}"; Flags: ignoreversion

[CustomMessages]
Ru.SysDirSelect=Выбранный путь включает в себя системную папку!%nВы уверены, что необходимо продолжать установку?

[Languages]
Name: Ru; MessagesFile: compiler:Languages\Russian.isl

[Code]
var
InfoForm: TSetupForm;
Info, Ok: TButton;
InfoBefore: TRichEditViewer;
ReadmeRu,ReadmeEn: AnsiString;

n: Integer;
FreeMB, TotalMB: Cardinal;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;

const oneMB= 1024*1024;
function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего| '+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
end; End;

Function NextButtonClick(CurPageID: Integer): Boolean; Begin
Result:= True
if (CurPageID = wpSelectDir) and (Pos(Uppercase(ExpandConstant('{win}')), Uppercase(ExpandConstant('{app}'))) > 0) then Result:= MessageBox(StrToInt(ExpandConstant('{wizardhwnd}')), ExpandConstant('{cm:SysDirSelect}'), 'Установка в системную папку', MB_YESNO or $30) = idYes;
End;

Procedure CurPageChanged(CurPageID: Integer);
Begin
if CurPageID = wpSelectDir then ListBoxRefresh
End;


procedure Okclick(Sender: TObject);
begin
InfoForm.Close;
WizardForm.Enabled:=True;
end;

procedure FormClose(Sender: TObject; var Action: TCloseAction);
begin
WizardForm.Enabled:=true;
end;

procedure InfoClick(Sender: TObject);
begin
InfoForm:= CreateCustomForm();
with InfoForm do begin
ClientWidth := ScaleX(450);
ClientHeight := ScaleY(230);
CenterInsideControl(WizardForm, False);
Caption:='Readme';
onClose:=@FormClose;
Ok:=tbutton.create(InfoForm)
with Ok do begin
SetBounds(ScaleX(365),ScaleY(200),ScaleX(75),ScaleY(23));
parent:=InfoForm;
Caption:='OK';
onclick:=@OKclick;
end;
InfoBefore:= TRichEditViewer.Create(InfoForm);
with InfoBefore do begin
SetBounds(ScaleX(10),ScaleY(10),ScaleX(430),ScaleY(185));
Parent:= InfoForm;
// ParentColor := True;
// Color:= WizardForm.Color;
// BorderStyle:= bsNone;
ScrollBars:= ssVertical;
ReadOnly:= true;
RTFText:= ReadmeRu
end;
InfoForm.Show;
WizardForm.Enabled:=false;
end;
end;

procedure InitializeWizard;
begin
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= [fsBold]
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;

ExtractTemporaryFile('ReadMeRu.rtf');
LoadStringFromFile(ExpandConstant('{tmp}')+'\ReadMeRu.rtf', ReadmeRu);
Info:=tbutton.create(WizardForm);
with Info do begin
Parent:=WizardForm;
SetBounds(ScaleX(10),ScaleY(327),ScaleX(75),ScaleY(23));
Caption:='Readme';
OnClick:=@InfoClick;
end;
end;




© OSzone.net 2001-2012