2
All Кто нибудь может помочь реализовать
вот это.
[more=В этом коде]
Код: [code]
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;
function CheckSystemPage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
ProcessorName: string;
Processor, VideoCardPanel, AudioCardPanel, RAMPanel, PageFilePanel: TPanel;
ProcessorNamePanel, VideoCardNamePanel, AudioCardNamePanel, RAMTotalPanel, PageFileTotalPanel: TPanel;
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 := 5;
AutoSize := True;
end;
StaticText2 := TNewStaticText.Create(Page);
with StaticText2 do
begin
Parent := Page.Surface;
Caption := 'Когда Вы будите готовы продолжить установку, нажмите «Далее».'
Left := 0;
Top := 220;
AutoSize := True;
end;
Processor := TPanel.Create(Page);
with Processor do
begin
Parent := Page.Surface;
Caption := ' Процессор';
Left := ScaleX(0);
Top := ScaleY(32);
alignment := taLeftJustify;
Width := ScaleX(121);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 0;
end;
ProcessorNamePanel := TPanel.Create(Page);
with ProcessorNamePanel do
begin
Parent := Page.Surface;
Caption := DelSP(ProcessorName) + ' ' + IntToStr(ProcessorMHZ) + 'MHz'; //новое обработанное значение строки
//Caption :=ProcessorName+' '+IntToStr(ProcessorMHZ)+'MHz' ;
Left := ScaleX(128);
Top := ScaleY(32);
alignment := taLeftJustify;
Width := ScaleX(281);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
Color := $ccffcc;
TabOrder := 1;
end;
if ProcessorMHZ < 1800 then
begin
ProcessorNamePanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
end;
VideoCardPanel := TPanel.Create(Page);
with VideoCardPanel do
begin
Parent := Page.Surface;
Caption := ' Видеоадаптер';
Left := ScaleX(0);
alignment := taLeftJustify;
Top := Processor.Top + 27;
Width := ScaleX(121);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 0;
end;
VideoCardNamePanel := TPanel.Create(Page);
with VideoCardNamePanel do
begin
Parent := Page.Surface;
Caption := ' ' + GetVideoCardName; //+' ОЗУ-'+inttostr(round(GetVidMemLocal/1000000))+' МБ';
//Caption:=' ОЗУ-'+inttostr(GetVidMemLocal)+' МБ';
VidrAM := GetVidMemLocal / 1000000;
if VidRam > 127 then
begin
if VidRam < 200 then Caption := Caption + ' ОЗУ - 128 МB'
else if VidRam < 300 then Caption := Caption + ' ОЗУ - 256 МB'
else if VidRam < 400 then Caption := Caption + ' ОЗУ - 384 МB'
else if VidRam > 500 then Caption := Caption + ' ОЗУ - 512 МB';
end;
Left := ScaleX(128);
Top := VideoCardPanel.Top;
alignment := taLeftJustify;
Width := ScaleX(281);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
Color := $ccffcc;
TabOrder := 1;
end;
if GetVidMemLocal < 127000000 then //128 MB
begin
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
VideoCardNamePanel.Color := $ccccff;
end;
AudioCardPanel := TPanel.Create(Page);
with AudioCardPanel do
begin
Parent := Page.Surface;
Caption := ' Звуковая карта';
Left := ScaleX(0);
Top := VideoCardPanel.Top + 27;
alignment := taLeftJustify;
Width := ScaleX(121);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 0;
end;
AudioCardNamePanel := TPanel.Create(Page);
with AudioCardNamePanel do
begin
Parent := Page.Surface;
Caption := ' ' + GetSoundCardName;
Left := ScaleX(128);
alignment := taLeftJustify;
Top := AudioCardPanel.Top;
Width := ScaleX(281);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 1;
Color := $ccffcc;
end;
if
GetSoundCards = 0 then
begin
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
AudioCardNamePanel.Color := $ccccff;
end;
RAMPanel := TPanel.Create(Page);
with RAMPanel do
begin
Parent := Page.Surface;
Caption := ' ОЗУ'
Left := 0;
Top := AudioCardPanel.Top + 27;
alignment := taLeftJustify;
Width := ScaleX(121);
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 0;
end;
RAMTotalPanel := TPanel.Create(Page);
with RAMTotalPanel do
begin
Parent := Page.Surface;
Caption := ' ' + IntToStr(GetSystemPhys + 1) + ' MB'
Left := AudioCardNamePanel.Left;
Top := RAMPanel.Top;
alignment := taLeftJustify;
Width := AudioCardNamePanel.Width;
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 1;
Color := $ccffcc;
end;
if GetSystemPhys + 1 < 1024 then
begin
RAMTotalPanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
end;
PageFilePanel := TPanel.Create(Page);
with PageFilePanel do
begin
Parent := Page.Surface;
Caption := ' Файл подкачки';
alignment := taLeftJustify;
Left := 0;
Top := RAMPanel.Top + 27;
Width := RAMPanel.Width;
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 0;
end;
PageFileTotalPanel := TPanel.Create(Page);
with PageFileTotalPanel do
begin
Parent := Page.Surface;
Caption := ' ' + IntToStr(GetSystemPage) + ' MB';
Left := RAMTotalPanel.Left;
Top := PageFilePanel.Top;
alignment := taLeftJustify;
Width := RAMTotalPanel.Width;
Height := ScaleY(25);
BevelInner := bvSpace;
BevelOuter := bvLowered;
TabOrder := 1;
Color := $ccffcc;
end;
if GetSystemPage < 1247 then
begin
PageFileTotalPanel.Color := $ccccff;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
end;
Result := Page.ID;
end;
procedure InitializeWizard();
begin
CheckSystemPage(wpWelcome);
end;