var
ListBox: TListBox;
DiskListLabel,
PercentLabel: TNewStaticText;
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 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 TBorGBorMB(Float: Extended): string;
// функция определения ТБ, ГБ или МБ
begin
if Float<1024 then Result:=NumToStr(Float)+' МБ'
else if (Float/1024)<1024 then Result:=NumToStr(Float/1024)+' ГБ'
else if (Float/(1024*1024))<1024 then Result:=NumToStr(Float/(1024*1024))+' ТБ'
end;
procedure CreatePageComponents;
var
i, count: Integer;
begin
DiskListLabel := TNewStaticText.Create(WizardForm);
with DiskListLabel do
begin
Caption := ExpandConstant('{cm:DiskSpace}');
Parent := WizardForm;
AutoSize := False;
Font.Size := 9;
Font.Name := 'Courier New';
SetBounds(ScaleX(40), ScaleY(175), ScaleX(300), ScaleY(15));
end;
ListBox := TListBox.Create(WizardForm);
with ListBox do
begin
Parent := WizardForm;
Font.Name := 'Fixedsys';
Font.Size := 10;
SetBounds(ScaleX(40), ScaleY(195), ScaleX(208), ScaleY(84));
end;
count:= GetHardDrivesCount();
for i:= 0 to count - 1 do
ListBox.Items.Add(GetHardDriveName(i)+ ' ' + IntToStr((GetHardDriveFreeSpace(i)*100) div GetHardDriveTotalSpace(i)) + '% '+ TBorGBorMB(GetHardDriveFreeSpace(i)));
with WizardForm.DiskSpaceLabel do
begin
Parent := WizardForm;
Font.Size := 9;
Font.Name := 'Courier New';
SetBounds(ScaleX(200), ScaleY(357), ScaleX(445), ScaleY(15));
end;
end;
procedure HideComponents;
begin
WizardForm.GroupBrowseButton.Hide;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
HideComponents;
end;
procedure InitializeWizard();
begin
CreatePageComponents;
end;[/SPOILER]