Цитата Habetdin:
Можно убить запуском команды
А это можно как-то в код добавить? Чтоб без батника.
Код: Выделить всё
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ErrorCode: Integer;
begin
if CurUninstallStep = usUninstall then
begin
if RunTask('USBSRService.exe', false) then
Exec('taskkill', '/f /im USBSRService.exe', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
UnloadDll(ExpandConstant('{app}\ISTask.dll'));
end;
end;Код: Выделить всё
[Setup]
AppName=BigMapPack
AppVersion=1.0
AppPublisher=Publisher
AppPublisherURL=http://www.site.ru./
AppVerName=BigMapPack version 1.0
DefaultDirName={pf}\Steam\SteamApps\<your steam login>
Compression=lzma2
SetupIconFile=pack.ico <------- этот ярлык не крепится при большом количестве файлов
WizardImageFile=logo.bmp
Uninstallable=no
[Files]
Source: "maps\*"; DestDir: "{app}\counter-strike source\cstrike\maps";
[Languages]
Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "en"; MessagesFile: "compiler:Default.isl"
[Messages]
ru.SelectDirBrowseLabel=Вместо <your steam login> введите ваш логин в steam, программа сама установит в директорию с:\program files\steam\SteamApps\<ваш логин в steam>\counter-strike source\cstrike\maps
en.SelectDirBrowseLabel=Enter your steam login, end click nextКод: Выделить всё
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
RegDeleteKeyIncludingSubkeys(HKCU, 'Software\SafelyRemove');
end;Код: Выделить всё
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=lzma/ultra
InternalCompressLevel=ultra
SolidCompression=yes
[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
[Files]
Source: compiler:Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion
[Registry]
Root: HKLM; Subkey: Software\My Program; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletekey
[Code]
function InitializeSetup: Boolean;
var
path: string;
res: Integer;
begin
Result:= True;
if RegValueExists(HKLM, 'Software\My Program', 'InstallPath') then
if RegQueryStringValue(HKLM, 'Software\My Program', 'InstallPath', path) then
if FileExists(path + '\MyProg.exe') then
if MsgBox('Запустить My Program?', mbConfirmation, MB_YESNO) = IDYES then
begin
Exec(path + '\MyProg.exe', '', '', SW_SHOW, ewWaitUntilTerminated, res);
Result:= False;
end;
end;
Код: Выделить всё
var state: boolean;
const
NeedSize = 20;
DRIVE_UNKNOWN = 0;
DRIVE_NO_ROOT_DIR = 1;
DRIVE_REMOVEABLE = 2;
DRIVE_FIXED = 3;
DRIVE_REMOTE = 4;
DRIVE_CDROM = 5;
DRIVE_RAMDISK = 6;
var
ListBox: TListBox;
Text: TNewStaticText;
function GetLogicalDrives: DWORD;
external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: string): Longint;
external 'GetDriveTypeA@kernel32.dll stdcall';
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';
function DelSp(const s: string): string; // функция удаления пробелов в начале строки
var
c, i: integer;
stt, st, st1: string;
begin
c := 0;
st := s;
for i := 1 to Length(st) do
begin
stt := copy(st, i, 1);
if (stt = ' ') and (c >= 1) then
begin
st1 := st1;
c := c + 1;
end
else if (stt = ' ') and (c = 0) then
begin
c := c + 1;
st1 := st1 + stt;
end
else if (stt ' ') then
begin
c := 0;
st1 := st1 + stt;
end
end;
Result := st1;
end;
procedure ListBoxOnClick(Sender: TObject);
var
NewLetter, OldString: string;
i: Integer;
begin
for i := 0 to ListBox.Items.Count - 1 do
begin
if ListBox.Selected[i] then
begin
NewLetter := Copy(ListBox.Items[i], 0, 1);
OldString := Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text));
WizardForm.DirEdit.Text := NewLetter + OldString;
end;
end;
end;
procedure InitializeWizard();
var
Page: TWizardPage;
Text: TNewStaticText;
Memo: TMemo;
Path: string;
FreeMB, TotalMB: Cardinal;
drives: DWORD;
i: integer;
begin
Text := TNewStaticText.Create(WizardForm);
Text.Top := 102;
Text.Width := 332;
Text.Height := 14;
Text.Caption := 'Список жестких дисков и свободного места';
Text.Parent := WizardForm.SelectDirPage;
ListBox := TListBox.Create(WizardForm);
ListBox.Top := 120;
ListBox.Width := 332;
ListBox.Height := ScaleY(90);
ListBox.Parent := WizardForm.SelectDirPage;
ListBox.OnClick := @ListBoxOnClick;
ListBox.Font.Name := 'Courier New';
ListBox.Font.Size := 10;
ListBox.Font.Style := [fsBold];
ListBox.Color := clBtnFace;
drives := GetLogicalDrives();
for i := 0 to 31 do
begin
if (drives and (1 shl i)) > 0 then
begin
Path := chr(ord('A') + i) + ':\';
if GetDriveType(Path) = DRIVE_FIXED then
begin
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB>1024 then ListBox.Items.Add(Path + ' ' + IntToStr(round(FreeMB / TotalMB * 100)) + '% ' + floatToStr(round(FreeMB/1024*100)/100) + ' GB')
else ListBox.Items.Add(Path + ' ' + IntToStr(round(FreeMB / TotalMB * 100)) + '% ' + IntToStr(FreeMB) + ' MB');
end;
end;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Path,s: String;
FreeMB, TotalMB: Cardinal;
begin
Result:= True;
if CurPageID = wpSelectDir then
begin
Path:= ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < (NeedSize*1024) then
begin
if FreeMB>1024 then
begin
s:='Для установки приложения необходимо '+ IntTostr(NeedSize)+ ' GB,'#13+'а на выбранном Вами диске доступно только '+ floatToStr(round(FreeMB/1024*100)/100) + ' GB!'
end
else s:='Для установки приложения необходимо '+ IntTostr(NeedSize)+ ' GB,'#13+'а на выбранном Вами диске доступно только '+ + IntToStr(FreeMB)+' MB';
MsgBox(s, mbCriticalError, MB_OK)
Result := False;
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
Page: TWizardPage;
Text: TNewStaticText;
Memo,Windows,SP,Version,Build,registered,WindowsName,SP_Num,Version_Num,Build_num,registered_name: TMemo;
Os,OS1: string; // строка с названием необходимой ОС
// state: boolean;
ProcessorName: string;
Processor, VideoCardPanel, AudioCardPanel, RAMPanel, PageFilePanel: TMemo;
ProcessorNamePanel, VideoCardNamePanel, AudioCardNamePanel, RAMTotalPanel, PageFileTotalPanel: TMemo;
ProcessorMHZ: Cardinal;
StaticText, StaticText2: TNewStaticText;
VidRam: integer;
begin
if CurPageID = wpUserInfo then
begin
//подменяем сраницу информации о пользователе на информацию об ОС
wizardForm.UserInfoNameEdit.visible:=false;
wizardForm.UserInfoNameEdit.text:='Игрок'; //на случай, когда имя пользователя не указано в системе
wizardForm.UserInfoNameLabel.visible:=false;
wizardForm.UserInfoOrgLabel.visible:=false;
wizardForm.UserInfoOrgEdit.visible:=false;
wizardForm.UserInfoOrgEdit.text:='Группа игроков ';//на случай, когда организация не указано в системе
wizardForm.PageNameLabel.Caption := 'Аппаратное обеспечение и Операционная система';
wizardForm.PageDescriptionLabel.Caption := 'Программа установки обнаружила следующие необходимые компоненты и Операционную систему ';
RegQueryStringValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', 'ProcessorNameString', ProcessorName);
RegQueryDWordValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', '~MHz', ProcessorMHZ);
OS:=' Microsoft Windows XP Service Pack 2'; //строка является суммой из записей в реестре о Наименовании ОС и сервис-паке
OS1:=' Microsoft Windows 2000 Service Pack 4'; //строка является суммой из записей в реестре о Наименовании ОС и сервис-паке
Windows := TMemo.Create(WizardForm);
StaticText := TNewStaticText.Create(TNewStaticText.Create(WizardForm));
with StaticText do begin
Left := 0;
Top := 52;
Width := 417;
Height := 14;
Caption := 'Все компоненты удовлетворяют требованиям игры.';
Parent := WizardForm.UserInfoPage;
StaticText.font.color:=clGreen;
end
with Windows do
begin
Text := ' Операц. система';
Parent := WizardForm.UserInfoPage;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(20);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end
Processor := TMemo.Create(WizardForm);
with Processor do begin
Text := ' Процессор';
Parent := WizardForm.UserInfoPage;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(77);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end
VideoCardPanel := TMemo.Create(WizardForm);
with VideoCardPanel do begin
Text := ' Видеоадаптер';
Parent := WizardForm.UserInfoPage;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(104);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end
AudioCardPanel := TMemo.Create(WizardForm);
with AudioCardPanel do begin
Text := ' Звуковая карта';
Parent := WizardForm.UserInfoPage;
Color := clBtnFace;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(131);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
end
RAMPanel := TMemo.Create(WizardForm);
with RAMPanel do begin
Text := ' ОЗУ';
Parent := WizardForm.UserInfoPage;
Color := clBtnFace;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(158);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
end
PageFilePanel := TMemo.Create(WizardForm);
with PageFilePanel do begin
Text := ' Файл подкачки';
Parent := WizardForm.UserInfoPage;
Color := clBtnFace;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(185);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
ProcessorNamePanel := TMemo.Create(WizardForm);
with ProcessorNamePanel do begin
Text := DelSP(ProcessorName) + ' ' + IntToStr(ProcessorMHZ) + 'MHz'; //новое обработанное значение строки
Parent := WizardForm.UserInfoPage;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(77);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
if ProcessorMHZ < 1800 then
begin
ProcessorNamePanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
StaticText.font.color:=clRed;
end;
VideoCardNamePanel := TMemo.Create(WizardForm);
with VideoCardNamePanel do begin
Text := ' ' + GetVideoCardName; //+' ОЗУ-'+inttostr(round(GetVidMemLocal/1000000))+' МБ'
Parent := WizardForm.UserInfoPage;
VidrAM := GetVidMemLocal / 1000000;
if VidRam > 127 then
begin
if VidRam < 200 then text := text + ' ОЗУ - 128 МB'
else if VidRam < 300 then text := text + ' ОЗУ - 256 МB'
else if VidRam < 400 then text := text + ' ОЗУ - 384 МB'
else if VidRam > 500 then text := text + ' ОЗУ - 512 МB';
end;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(104);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
if GetVidMemLocal < 127000000 then //128 MB
begin
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
StaticText.font.color:=clRed;
VideoCardNamePanel.Color := $ccccff;
end;
end
AudioCardNamePanel := TMemo.Create(WizardForm);
with AudioCardNamePanel do begin
Text := ' ' + GetSoundCardName;
Parent := WizardForm.UserInfoPage;
Color := $CCFFCC;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(131);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R
ReadOnly := True;
end
RAMTotalPanel := TMemo.Create(WizardForm);
with RAMTotalPanel do begin
Text := ' ' + IntToStr(GetSystemPhys + 1) + ' MB';
Parent := WizardForm.UserInfoPage;
Color := $CCFFCC;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(158);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
if GetSystemPhys + 1 < 1024 then
begin
RAMTotalPanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
StaticText.font.color:=clRed;
end;
end;
PageFileTotalPanel := TMemo.Create(WizardForm);
with PageFileTotalPanel do begin
Text := ' ' + IntToStr(GetSystemPage) + ' MB';
Parent := WizardForm.UserInfoPage;
Color := $CCFFCC;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(185);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
if GetSystemPage < 1247 then
begin
PageFileTotalPanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
StaticText.font.color:=clRed;
end;
end;
end
if ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion,ProductName|}')='' then
begin
WindowsName := TMemo.Create(WizardForm);
with WindowsName do begin
Text := ExpandConstant(' {reg:HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion,ProductName|}')+ExpandConstant(' {reg:HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion,CSDVersion|}');
Parent := WizardForm.UserInfoPage;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(20);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end
end
end;
// Проверка Windows 9x
if ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion,ProductName|}')'' then
begin
WindowsName := TMemo.Create(WizardForm);
with WindowsName do begin
Text := ExpandConstant(' {reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion,ProductName|}')+ExpandConstant(' {reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion,CSDVersion|}');
Parent := WizardForm.UserInfoPage;
Color := $CCFFCC;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(20);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
end
end;
if OS=(WindowsName.Text) then state:=true else
if OS1=(WindowsName.Text) then state:=true else state:=false;
Text := TNewStaticText.Create(WizardForm);
with Text do begin
Left := 0;
Top := 0;
Width := 417;
Height := 14;
if state then
begin
Font.Color:=clGreen;
WindowsName.color:=$CCFFCC;
// SP_Num.color:=$CCFFCC;
Caption := 'Операционная система соответствует требованиям игры.';
end
else
begin
Font.Color:=clREd;
WindowsName.color:=clRed;
WindowsName.Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
WindowsName.Top := ScaleY(20);
WindowsName.Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
WindowsName.Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
WindowsName.ReadOnly := True;
Caption := 'Операционная система не соответствует требованиям игры.';
end
Parent := WizardForm.UserInfoPage;
end
Text := TNewStaticText.Create(TNewStaticText.Create(WizardForm));
with Text do begin
Left := 0;
Top := 220;
Width := 417;
Height := 14;
Caption := 'Когда Вы будете готовы продолжить установку, нажмите «Далее».';
Parent := WizardForm.UserInfoPage;
end
if not state then
begin
wizardForm.Nextbutton.enabled:=false;
end;
end;
end;
добавить в этот
[url=#]скрипт[/url]
[code]
const
NeedSize = 20;
DRIVE_UNKNOWN = 0;
DRIVE_NO_ROOT_DIR = 1;
DRIVE_REMOVEABLE = 2;
DRIVE_FIXED = 3;
DRIVE_REMOTE = 4;
DRIVE_CDROM = 5;
DRIVE_RAMDISK = 6;
var
ListBox: TListBox;
Text: TNewStaticText;
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';
function GetLogicalDrives: DWORD;
external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: string): Longint;
external 'GetDriveTypeA@kernel32.dll stdcall';
function DelSp(const s: string): string; //функция удаления табуляции и пробелов в начале строки
var
c, i: integer;
stt, st, st1: string;
begin
c := 0;
st := s;
for i := 1 to Length(st) do
begin
stt := copy(st, i, 1);
if (stt = ' ') and (c >= 1) then
begin
st1 := st1;
c := c + 1;
end
else if (stt = ' ') and (c = 0) then
begin
c := c + 1;
st1 := st1 + stt;
end
else if (stt ' ') then
begin
c := 0;
st1 := st1 + stt;
end
end;
Result := st1;
end;
function CheckSystemPage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
ProcessorName: string;
Processor, VideoCardPanel, AudioCardPanel, RAMPanel, PageFilePanel: TMemo;
ProcessorNamePanel, VideoCardNamePanel, AudioCardNamePanel, RAMTotalPanel, PageFileTotalPanel: TMemo;
ProcessorMHZ: Cardinal;
StaticText, StaticText2: TNewStaticText;
VidRam: integer;
begin
RegQueryStringValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', 'ProcessorNameString', ProcessorName);
RegQueryDWordValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', '~MHz', ProcessorMHZ);
GetVidMemLocal;
GetSoundCards;
Page := CreateCustomPage(PreviousPageId, 'Аппаратное Обеспечение', 'Программа установки обнаружила следующие необходимые компоненты');
StaticText := TNewStaticText.Create(Page);
with StaticText do
begin
Parent := Page.Surface;
Caption := 'Все компоненты удовлетворяют требованиям игры.';
Left := 0;
Top := 0;
AutoSize := True;
end;
StaticText2 := TNewStaticText.Create(Page);
with StaticText2 do
begin
Parent := Page.Surface;
Caption := 'Когда Вы будете готовы продолжить установку, нажмите «Далее».';
Left := 0;
Top := 220;
AutoSize := True;
end;
//******************************************* [Начало - Процессор] ***************************************************//
Processor := TMemo.Create(Page);
with Processor do
begin
Text := ' Процессор';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(30);
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end;
ProcessorNamePanel := TMemo.Create(Page);
with ProcessorNamePanel do
begin
Text := DelSP(ProcessorName) + ' ' + IntToStr(ProcessorMHZ) + 'MHz'; //новое обработанное значение строки
//Caption :=ProcessorName+' '+IntToStr(ProcessorMHZ)+'MHz' ;
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := ScaleY(30);
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end;
if ProcessorMHZ < 1800 then //Минимальное количество частоты в MHz
begin
StaticText.Caption := 'Компоненты, выделенные красным, не удовлетворяют требованиям игры.'#13+'Проверьте соответствие системным требованиям.';
ProcessorNamePanel.Color := $CCCCFF;
end;
//******************************************* [Конец - Процессор] ****************************************************//
//******************************************* [Начало - Видеоадаптер] ************************************************//
VideoCardPanel := TMemo.Create(Page);
with VideoCardPanel do
begin
Text := ' Видеоадаптер';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := Processor.Top + 27;
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end;
VideoCardNamePanel := TMemo.Create(Page);
with VideoCardNamePanel do
begin
Text := ' ' + GetVideoCardName; //+' ОЗУ-'+inttostr(round(GetVidMemLocal/1000000))+' МБ';
//Caption:=' ОЗУ-'+inttostr(GetVidMemLocal)+' МБ';
Alignment := taLeftJustify;
Parent := Page.Surface;
VidrAM := GetVidMemLocal / 1000000;
if VidRam > 127 then
begin
if VidRam < 200 then Text := Text + '128 МB'
else if VidRam < 300 then Text := Text + '256 МB'
else if VidRam < 400 then Text := Text + '384 МB'
else if VidRam > 500 then Text := Text + '512 МB';
end;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := VideoCardPanel.Top;
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end;
if GetVidMemLocal < 127000000 then //Минимальное объем ОЗУ [в байтах] у видеоадаптера 128 MB
begin
StaticText.Caption := 'Компоненты, выделенные красным, не удовлетворяют требованиям игры.'#13+'Проверьте соответствие системным требованиям.';
VideoCardNamePanel.Color := $CCCCFF;
end;
//******************************************* [Конец - Видеоадаптер] *************************************************//
//******************************************* [Начало - Звуковая карта] **********************************************//
AudioCardPanel := TMemo.Create(Page);
with AudioCardPanel do
begin
Text := ' Звуковая карта';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := VideoCardPanel.Top + 27;
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end;
AudioCardNamePanel := TMemo.Create(Page);
with AudioCardNamePanel do
begin
Text := ' ' + GetSoundCardName;
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := AudioCardPanel.Top;
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end;
if
GetSoundCards = 0 then
begin
StaticText.Caption := 'Компоненты, выделенные красным, не удовлетворяют требованиям игры.'#13+'Проверьте соответствие системным требованиям.';
AudioCardNamePanel.Color := $CCCCFF;
end;
//******************************************* [Конец - Звуковая карта] ***********************************************//
//******************************************* [Начало - ОЗУ] *********************************************************//
RAMPanel := TMemo.Create(Page);
with RAMPanel do
begin
Text := ' Память';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := AudioCardPanel.Top + 27;
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end;
RAMTotalPanel := TMemo.Create(Page);
with RAMTotalPanel do
begin
Text := ' ' + IntToStr(GetSystemPhys + 1) + ' MB';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := RAMPanel.Top;
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end;
if GetSystemPhys + 1 < 1024 then //Минимальное объем ОЗУ 1 Гб или 1024 Мб
begin
StaticText.Caption := 'Компоненты, выделенные красным, не удовлетворяют требованиям игры.'#13+'Проверьте соответствие системным требованиям.';
RAMTotalPanel.Color := $CCCCFF;
end;
//******************************************* [Конец - ОЗУ] **********************************************************//
//******************************************* [Начало - Файл подкачки] ***********************************************//
PageFilePanel := TMemo.Create(Page);
with PageFilePanel do
begin
Text := ' Файл подкачки';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(0); //оригинал S.T.A.L.K.E.R.
Top := RAMPanel.Top + 27;
Width := ScaleX(106); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := clBtnFace;
end;
PageFileTotalPanel := TMemo.Create(Page);
with PageFileTotalPanel do
begin
Text := ' ' + IntToStr(GetSystemPage) + ' MB';
Alignment := taLeftJustify;
Parent := Page.Surface;
Left := ScaleX(110); //оригинал S.T.A.L.K.E.R.
Top := PageFilePanel.Top;
Width := ScaleX(304); //оригинал S.T.A.L.K.E.R.
Height := ScaleY(22); //оригинал S.T.A.L.K.E.R.
ReadOnly := True;
Color := $CCFFCC;
end;
if GetSystemPage < 2048 then //Минимальное объем файла [в мегабайтах] подкачки 1 Гб или 1024 Мб
begin
StaticText.Caption := 'Компоненты, выделенные красным, не удовлетворяют требованиям игры.'#13+'Проверьте соответствие системным требованиям.';
PageFileTotalPanel.Color := $CCCCFF;
end;
Result := Page.ID;
end;
//******************************************* [Конец - Файл подкачки] ************************************************//
procedure ListBoxOnClick(Sender: TObject);
var
NewLetter, OldString: string;
i: Integer;
begin
for i := 0 to ListBox.Items.Count - 1 do
begin
if ListBox.Selected[i] then
begin
NewLetter := Copy(ListBox.Items[i], 0, 1);
OldString := Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text));
WizardForm.DirEdit.Text := NewLetter + OldString;
end;
end;
end;
procedure InitializeWizard();
var
Page: TWizardPage;
Text: TNewStaticText;
Memo: TMemo;
Path: string;
FreeMB, TotalMB: Cardinal;
drives: DWORD;
i: integer;
begin
CheckSystemPage(wpLicense);
Text := TNewStaticText.Create(WizardForm);
Text.Top := 110;
Text.Width := 332;
Text.Height := 14;
Text.Caption := 'Список жестких дисков и свободного места';
Text.Parent := WizardForm.SelectDirPage;
ListBox := TListBox.Create(WizardForm);
ListBox.Top := 128;
ListBox.Width := 208;
ListBox.Height := ScaleY(84);
ListBox.Parent := WizardForm.SelectDirPage;
ListBox.OnClick := @ListBoxOnClick;
ListBox.Font.Name := 'Courier New';
ListBox.Font.Size := 10;
ListBox.Font.Style := [fsBold];
ListBox.Color := clBtnFace;
drives := GetLogicalDrives();
for i := 0 to 31 do
begin
if (drives and (1 shl i)) > 0 then
begin
Path := chr(ord('A') + i) + ':\';
if GetDriveType(Path) = DRIVE_FIXED then
begin
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB>1024 then ListBox.Items.Add(Path + ' ' + IntToStr(round(FreeMB / TotalMB * 100)) + '% ' + floatToStr(round(FreeMB/1024*100)/100) + ' GB')
else ListBox.Items.Add(Path + ' ' + IntToStr(round(FreeMB / TotalMB * 100)) + '% ' + IntToStr(FreeMB) + ' MB');
end;
end;
end;
end;
чтобы получилось вот так
[url=http://radikal.ru/F/s61.radikal.ru/i172/0909/c8/5381501aa1f4.jpg.html][/url]
и если можно объединить код с проверкой ОС, типа этого [url=http://radikal.ru/F/i074.radikal.ru/0909/ea/15bdf0f349a5.jpg.html]
[/url]
Заранее большое спасибо [img]images/smilies/new/smile.gif[/img] [img]images/smilies/new/smile.gif[/img] [img]images/smilies/new/smile.gif[/img]