Автор: Forslay
Дата сообщения: 23.08.2007 19:16
Люди, помогите пожалуйста расположить данные в нужном порядке!
Как надо:
Система
DirectX
Процессор
Видюха
Звуковая
Оператива
Файл подкачки
[more][Setup]
AppName=Системная страничка со сталкера
AppVerName=Системная страничка со сталкера лучшая
AppVersion=1.0
AppPublisher=Chuvakstepan
AppCopyright=Chuvakstepan
defaultDirName={pf}\Chuvakstepan\SUKI VSE
outputBaseFileName=sysfuck
[Files]
Source: compiler:DLL\get_hw_caps.dll; DestDir: {sys}; DestName: GET_HW_CAPS.dll; Flags: dontcopy noencryption
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Code]
const
NeedMHZ = 2100;
NeedVRAM = 256;
NeedRAM = 120;
oneMB= 5480*5480;
NeedSize = 400;
BufferLen= 32;
DRIVE_UNKNOWN = 0;
DRIVE_NO_ROOT_DIR = 1;
DRIVE_REMOVEABLE = 2;
DRIVE_FIXED = 3;
DRIVE_REMOTE = 4;
DRIVE_CDROM = 5;
DRIVE_RAMDISK = 6;
AW_FADE_IN = $00080000;
AW_FADE_OUT = $00090000;
AW_SLIDE_IN_LEFT = $00040001;
AW_SLIDE_OUT_LEFT = $00050002;
AW_SLIDE_IN_RIGHT = $00040002;
AW_SLIDE_OUT_RIGHT = $00050001;
AW_SLIDE_IN_TOP = $00040004;
AW_SLIDE_OUT_TOP = $00050008;
AW_SLIDE_IN_BOTTOM = $00040008;
AW_SLIDE_OUT_BOTTOM = $00050004;
AW_DIAG_SLIDE_IN_TOPLEFT = $00040005;
AW_DIAG_SLIDE_OUT_TOPLEFT = $0005000A;
AW_DIAG_SLIDE_IN_TOPRIGHT = $00040006;
AW_DIAG_SLIDE_OUT_TOPRIGHT = $00050009;
AW_DIAG_SLIDE_IN_BOTTOMLEFT = $00040009;
AW_DIAG_SLIDE_OUT_BOTTOMLEFT = $00050006;
AW_DIAG_SLIDE_IN_BOTTOMRIGHT = $0004000A;
AW_DIAG_SLIDE_OUT_BOTTOMRIGHT = $00050005;
AW_EXPLODE = $00040010;
AW_IMPLODE = $00050010;
MB_ICONINFORMATION = $40;
MB_ICONEXCLAMATION = $30;
MB_ICONQUESTION = $20;
MB_ICONSTOP = $10;
MB_ICONNONE = $0;
type TMemoryStatus = record dwLength, dwMemoryLoad, dwTotalPhys, dwAvailPhys, dwTotalPageFile, dwAvailPageFile, dwTotalVirtual, dwAvailVirtual: Longint; end;
var
OldCursor, NewCursor: Longint;
hWnd: Integer;
mp3Handle: HWND;
mp3Name: string;
ListBox: TListBox;
Splash: TSetupForm;
PlayButton, PauseButton, StopButton: TPanel;
PlayImage, PauseImage, StopImage: TBitmapImage;
PlayLabel, PauseLabel, StopLabel: TLabel;
FreeMB, TotalMB: Cardinal;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
VolumeName, FileSystemName, Uninstall, Location: String;
SerialEdit1, SerialEdit2, SerialEdit3, SerialEdit4, SerialEdit5, SerialEditUSER : TEdit;
StaticText, StaticText1, StaticText2, StaticText23 : TNewStaticText;
Chert, Chert2, Chert3, Chert4 : TLabel;
Page: TWizardPage;
Memory: TMemoryStatus;
RadioButton_1,RadioButton_2: TRadioButton;
ResultCode: Integer;
ProgressLabel, SizeLabel: TLabel;
procedure DirOnClick(Sender: TObject);
var res: Boolean;
UserSelectDir: string;
begin UserSelectDir := WizardForm.DirEdit.Text;
res := BrowseForFolder('Выберите директорию для установки и нажмите ''ОК''', UserSelectDir, True);
if res then
begin WizardForm.DirEdit.Text := UserSelectDir;
end;
end;
function AnimateWindow(hWnd: HWND; dwTime: DWORD; dwFlags: DWORD): Boolean;
external 'AnimateWindow@user32 stdcall';
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;
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;
end;
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 GetHardDriveTotalSpace(hdd: integer): Integer;
external 'hwc_GetHardDriveTotalSpace@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 MessageBox(hWnd: Integer; lpText, lpCaption: string; uType: Cardinal): Integer;
external 'MessageBoxA@user32.dll stdcall';
procedure GlobalMemoryStatus(var lpBuffer: TMemoryStatus); external 'GlobalMemoryStatus@kernel32.dll';
function GetSystemMetrics(nIndex: Integer):Integer; external 'GetSystemMetrics@user32.dll stdcall';
function GetHardDrivesCount: Integer; external 'hwc_GetHardDrivesCount@files:get_hw_caps.dll stdcall';
function GetHardDriveName(hdd: Integer): PChar; external 'hwc_GetHardDriveName@files:get_hw_caps.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MorG(MB: Integer; autoGB: Boolean): string;
begin if (MB < 1000) or not autoGB then Result:= IntToStr(MB)+ 'Мб' else Result:= FloatToStr(round(MB/1024*1000)/1000)+ 'Гб'
end;
function DelSp(const s:string):string;
var
c, i: integer;
stt, st, st1: string;
begin
c := 0;
st := s;
for i := 0 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 DecodeVersion( verstr: String; var verint: array of Integer );
var
i,p: Integer; s: string;
begin
verint := [0,0,0,0];
i := 0;
while ( (Length(verstr) > 0) and (i < 4) ) do
begin
p := pos('.', verstr);
if p > 0 then
begin
if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
verint[i] := StrToInt(s);
i := i + 1;
verstr := Copy( verstr, p+1, Length(verstr));
end
else
begin
verint[i] := StrToInt( verstr );
verstr := '';
end;
end;
end;
function CompareVersion( ver1, ver2: String ) : Integer;
var
verint1, verint2: array of Integer;
i: integer;
begin
SetArrayLength( verint1, 4 );
DecodeVersion( ver1, verint1 );
SetArrayLength( verint2, 4 );
DecodeVersion( ver2, verint2 );
Result := 0; i := 0;
while ( (Result = 0) and ( i < 4 ) ) do
begin
if verint1[i] > verint2[i] then
Result := 1
else
if verint1[i] < verint2[i] then
Result := -1
else
Result := 0;
i := i + 1;
end;
end;
function GetDirectXVersion(): String;
var
sVersion: String;
begin
sVersion := '';
RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\DirectX', 'Version', sVersion );
Result := sVersion;
end;
procedure Page_CancelButtonClick(Page: TWizardPage; var Cancel, Confirm: Boolean);
begin
Confirm:=False;
Cancel:=True;
end;
function CheckSystemPage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
ProcessorName,ProductName,CSDVersion: string;
ProcessorPanel,ProcessorNamePanel,VideoCardPanel,VideoCardNamePanel,AudioCardPanel,AudioCardNamePanel,RAMPanel,RAMTotalPanel,DirectXPanel,DirectXTotalPanel,OSPanel,OSTotalPanel: TPanel;
ProcessorMHZ,FreeMB,TotalMB: Cardinal; PageFilePanel: TPanel; PageFileTotalPanel: TPanel;
StaticText,StaticText2: TNewStaticText;
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
GlobalMemoryStatus(Memory);
GetSpaceOnDisk(ExpandConstant('{sd}'),True,FreeMB,TotalMB);
GetVolumeInformation(ExpandConstant('{sd}'), VolumeName, BufferLen-1,VolumeSerialNo,MaxComponentLength,FileSystemFlags,FileSystemName,BufferLen-1);
RegQueryStringValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0','ProcessorNameString', ProcessorName);
RegQueryDWordValue(HKLM, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0','~MHz', ProcessorMHZ);
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion','ProductName', ProductName);
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion','CSDVersion', CSDVersion);
GetVidMemLocal;
GetSoundCards;
Page := CreateCustomPage(PreviousPageId,'Проверка системных требований','Программа установки обнаружила следующие необходимые компоненты:');
StaticText:=TNewStaticText.Create(Page);
with StaticText do
begin
Parent:=Page.Surface;
Caption:='Все компоненты удовлетворяют требованиям игры.';
Left:=0;
Top:=190;
AutoSize:=True;
end;
StaticText2:=TNewStaticText.Create(Page);
with StaticText2 do
begin
Parent:=Page.Surface;
Caption:='Когда будуте готовы продолжить установку, нажмите <<Далее>>.'
Left:=0;
Top:=220;
AutoSize:=True;
end;
OSPanel:=TPanel.Create(Page);
with OSPanel do
begin
Parent:=Page.Surface;
Caption:=' Система';
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(118);
Height := ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
OSTotalPanel:=TPanel.Create(Page);
with OSTotalPanel do
begin
Parent:=Page.Surface;
Caption:=+' '+ProductName+' '+CSDVersion+' сборка '+IntToStr(Version.Major)+'.'+IntToStr(Version.Minor)+'.'+IntToStr(Version.Build);
Left := ScaleX(120);
Top := ScaleY(0);
Width := ScaleX(309);
Height := ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color := $CCFFCC;
Alignment:=taLeftJustify;
GetWindowsVersionEx(Version);
if Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 1) and (Version.ServicePackMajor < 1) then
begin
OSTotalPanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
end;
ProcessorPanel := TPanel.Create(Page);
with ProcessorPanel do
begin
Parent := Page.Surface;
Caption := ' Процессор';
Left:=ScaleX(0);
Top:=OSPanel.Top+27;
Width:=OSPanel.Width;
Height:=ScaleY(25);
BevelInner := bvLowered;
TabOrder := 0;
Alignment:=taLeftJustify;
end;
ProcessorNamePanel := TPanel.Create(Page);
with ProcessorNamePanel do
begin
Parent := Page.Surface;
Caption := DelSp(ProcessorName)+' '+'['+IntToStr(ProcessorMHZ)+' МГц]';
Left:=OSTotalPanel.Left;
Top:=ProcessorPanel.Top;
Width:=OSTotalPanel.Width;
Height:=ScaleY(25);
BevelInner := bvLowered;
Color := $CCFFCC;
TabOrder := 1;
Alignment:=taLeftJustify;
if ProcessorMHZ<NeedMHZ then
begin
Caption := Caption+' < '+FloatToStr(round(NeedMHZ))+ ' МГц'
ProcessorNamePanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
end;
VideoCardPanel:=TPanel.Create(Page);
with VideoCardPanel do
begin
Parent:=Page.Surface;
Caption:=' Графическая карта';
Left:=ScaleX(0);
Top:=ProcessorPanel.Top+27;
Width:=ProcessorPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
VideoCardNamePanel:=TPanel.Create(Page);
with VideoCardNamePanel do
begin
Parent:=Page.Surface;
Caption:= ' ' + Trim(GetVideoCardName)+ ', '+ MorG(round(GetVidMemLocal/oneMB/64)*64,False);
Left:=ProcessorNamePanel.Left;
Top:=VideoCardPanel.Top;
Width:=ProcessorNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
Color := $CCFFCC;
TabOrder:=1;
Alignment:=taLeftJustify;
if round(GetVidMemLocal/oneMB/64)*64 < NeedVRAM then
begin Caption:= Caption + ' < ' + MorG(NeedVRAM,False);
VideoCardNamePanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
Caption:= Caption + ', '+ IntToStr(GetSystemMetrics(0)) + 'x' +IntToStr(GetSystemMetrics(1));
end;
RAMPanel:=TPanel.Create(Page);
with RAMPanel do
begin
Parent:=Page.Surface;
Caption:=' Оперативная память'
Left:=0;
Top:=VideoCardPanel.Top+27;
Width:=VideoCardPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
RAMTotalPanel:=TPanel.Create(Page);
with RAMTotalPanel do
begin
Parent:=Page.Surface;
Caption:=' '+MorG(round(Memory.dwTotalPhys/oneMB/64)*64,False)+' всего, '+MorG(Memory.dwAvailPhys/oneMB,False)+' свободно, '
Left:=VideoCardNamePanel.Left;
Top:=RAMPanel.Top;
Width:=VideoCardNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color := $CCFFCC;
Alignment:=taLeftJustify;
if round(Memory.dwTotalPhys/oneMB/64)*64<NeedRAM then
begin
Caption:= Caption+'требуется '+MorG(NeedRAM,False);
Color:= $ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end
else
Caption:= Caption +MorG((Memory.dwTotalPhys - Memory.dwAvailPhys)/oneMB,False) +' используется';
end;
AudioCardPanel:=TPanel.Create(Page);
with AudioCardPanel do
begin
Parent:=Page.Surface;
Caption:=' Звуковая карта';
Left:=ScaleX(0);
Top:=RAMPanel.Top+27;
Width:=RAMPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
AudioCardNamePanel:=TPanel.Create(Page);
with AudioCardNamePanel do
begin
Parent:=Page.Surface;
Caption:=+' '+GetSoundCardName;
Left:=RAMTotalPanel.Left;
Top:=AudioCardPanel.Top;
Width:=RAMTotalPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color := $CCFFCC;
Alignment:=taLeftJustify;
if GetSoundCards = 0 then
begin
Caption:=' Устройство не обнаружено';
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
AudioCardNamePanel.Color:=$ccccff;
end;
end;
DirectXPanel:=TPanel.Create(Page);
with DirectXPanel do
begin
Parent:=Page.Surface;
Caption:=' Версия DirectX';
Left:=0;
Top:=AudioCardPanel.Top+27;
Width:=AudioCardPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
end;
DirectXTotalPanel:=TPanel.Create(Page);
with DirectXTotalPanel do
begin
Parent:=Page.Surface;
Left:=AudioCardNamePanel.Left;
Top:=DirectXPanel.Top;
Width:=AudioCardNamePanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=1;
Color := $CCFFCC;
Alignment:=taLeftJustify;
// DirectX 8.0 is 4.8.0
// DirectX 8.1 is 4.8.1
// DirectX 9.0 is 4.9.0
if CompareVersion( GetDirectXVersion(), '4.9.0') > 0 then
begin
Caption:=+' DirectX 9.0 ('+GetDirectXVersion+')';
end
else
begin
Caption:=+' Требуется DirectX 9.0 или выше';
DirectXTotalPanel.Color:=$ccccff;
StaticText.Caption:='Компоненты, выделенные красным цветом, не удовлетворяют требованиям' + #13 + 'игры.';
end;
if GetSystemPhys + 1 < 256 then
begin RAMTotalPanel.Color := clRed;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
end;
PageFilePanel := TPanel.Create(Page);
with PageFilePanel do
begin
Parent:=Page.Surface;
Caption:=' Файл подкачки';
Left:=0;
Top:=AudioCardPanel.Top+54;
Width:=AudioCardPanel.Width;
Height:=ScaleY(25);
BevelInner:=bvLowered;
TabOrder:=0;
Alignment:=taLeftJustify;
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 := bvLowered;
TabOrder := 1;
Color := $CCFFCC;
end;
if GetSystemPage < 4000 then
begin PageFileTotalPanel.Color := clRed;
StaticText.Caption := 'Не все компоненты удовлетворяют требованиям игры.';
end;
end;
Result := Page.ID;
end;
procedure InitializeWizard();
begin
CheckSystemPage(wpLicense);
end;[/more]