Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 5]
Johny777, R.i.m.s.k.y., Спасибо.
R.i.m.s.k.y., да это было не важно что из окон открыто. Главное было параметры shutdown в инно узнать.
просто я прописывал перезагрузку как указала команда shutdown help
[Run]
Filename: shutdown.exe; Parameters: -r -t 5; Flags: runhidden nowait postinstall unchecked
что в конечном счете у меня перезагрузка не происходила. а оказалось что в инно параметры задаются совсем другим способом.
а так для надежности есть более радикальный и удобный способ. например
[#Code]
var
Res : integer;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep=usDone then
begin
if MsgBox('Перезагрузить компьютер?',mbconfirmation, mb_yesno) = IDYES then
begin
Exec('shutdown.exe ', ' /r /t 5', ExpandConstant('{sys}'), SW_HIDE, ewWaitUntilIdle, Res);
end;
end;
end;
R.i.m.s.k.y.
31-08-2012, 17:55
SatHan, есть глобальная функция NeedRestart - почитай про нее
El Sanchez, в том варианте, который вы предложили, при компиляции пишет type mismatch
Вот код:
var
phMPQ: THandle;
function SFileSetAddFileCallback(hMpq: THandle; pfnAddFileCB, pvUserData: Longint): BOOL; external 'SFileSetAddFileCallback@files:stormlib.dll stdcall';
procedure AddFileCallback(pvUserData: Longint; dwBytesWritten, dwTotalBytes: DWORD; bFinalCall: BOOL);
begin
//
end;
//
procedure CurStepChanged(CurStep: TSetupStep);
begin
SFileSetAddFileCallback (phMPQ, @AddFileCallback, 0);
end;
А вот так пробовал я. В этом случае компилируется, но выходит ошибка в инсталляторе
"Exeption: Accsess violation at adress xxxxxxxx. Write of address xxxxxxxx
var
phMPQ: THandle;
type
TCallback = procedure (pvUserData: Integer; dwBytesWritten, dwTotalBytes: DWORD; bFinalCall: BOOL);
function SFileSetAddFileCallback(hMpq: THandle; pfnAddFileCB: TCallback; pvUserData: Integer): BOOL; external 'SFileSetAddFileCallback@files:stormlib.dll stdcall';
procedure AddFileCallback(pvUserData: Integer; dwBytesWritten, dwTotalBytes: DWORD; bFinalCall: BOOL);
begin
//
end;
//
Procedure CurPageChanged(CurPageID: Integer);
begin
SFileSetAddFileCallback (phMPQ, @AddFileCallback, 0);
end;
подскажите пожалуйста как сделать чтоб при отмене инсталятор быстро завершался? »может как можно (выгрузкой Unload или таймерами KillTimer) завершить? в помощи почитал но ничего не понял совсем что там нада делать.
при принудительном завершении setup.tmp и setup.exe всё равно нагрузка идёт, в %temp% обнаружил папки *..tmp. в одной из них есть ещё папка _isetup в ней два файла _RegDLL.tmp и _shfoldr.dll может из за них идёт нагрузка. мож на них нада какую процедуру повесить?
El Sanchez
01-09-2012, 12:20
El Sanchez, в том варианте, который вы предложили, при компиляции пишет type mismatch
Вот код: »
SFileSetAddFileCallback (phMPQ, @AddFileCallback, 0); »
al1511, ну и где я это предлагал? Я написал:
SFileSetAddFileCallback(phMPQ, CallbackAddr('AddFileCallback'), 0);
CallbackAddr - функция из расширенной китайской версии Inno, возвращающая указатель на callback-функцию AddFileCallback. Если у вас оригинальная версия, то для работы с callback-функциями понадобится сторонняя библиотека innocallback.dll (http://bit.ly/ObivdM)
CallbackAddr - функция из расширенной китайской версии Inno, »
Я не знал, что это функция из расширенной версии. Спасибо
Callback работает, но теперь возникла другая проблема )) Во время упаковки файлов в архив окно Inno Setup зависает (как будто ждёт завершения выполнения dll) и отвисает только тогда, когда заканчивается добавление файлов в архив... Информация в окне во время добавления файлов не меняется, и окошко даже нельзя двигать...
Помогите, пожалуйста, разобраться!
Народ помогите новичку! слепил скрипт из is game script generator и решил вставить скин из isskins при компиляции выдает такую ошибку, что не так сделал?
[Setup]
SourceDir=.
OutputDir=Setup
AppName=GTA San Andreas
AppVerName=GTA San Andreas
AppVersion=GTA San Andreas
AppPublisher=Îëåã Ãèíèÿòîâ
AppCopyright=Îëåã Ãèíèÿòîâ
AppPublisherURL=SpiCeMaN@spaces.ru
AppSupportURL=SpiCeMaN@spaces.ru
AppUpdatesURL=SpiCeMaN@spaces.ru
DefaultDirName={pf}\GTA San Andreas
DefaultGroupName=GTA San Andreas
AllowNoIcons=yes
OutputBaseFilename=setup
WizardImageFile=C:\Users\Vadim\Desktop\ISS\GTA-San-Andreas.bmp
WizardSmallImageFile=C:\Users\Vadim\Desktop\ISS\grand_theft_auto_san_andreas_icon_v2_1_by_kamizanon-d4tuvym.bmp
SetupIconFile=C:\Users\Vadim\Desktop\ISS\grand_theft_auto_san_andreas_icon_v2_1_by_kamizanon-d4tuvym.ico
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/normal
DiskSpanning=yes
DiskSliceSize=2100000000
SlicesPerDisk=1
LicenseFile=license.txt
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
[Files]
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "bass.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "C:\Users\Vadim\Desktop\ISS\GTA_San_Andreas-GTA_San_Andreas.mp3"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: C:\Users\Vadim\Desktop\ISS\ISSkin.dll; DestDir: {tmp}; Flags: dontcopy
Source: C:\Users\Vadim\Desktop\ISS\tiger.cjstyles; DestDir: {tmp}; Flags: dontcopy
Source: "C:\GAMES\GTA San Andreas\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
[Icons]
Name: "{group}\GTA San Andreas"; Filename: "{app}\gta_sa.exe"; WorkingDir: "{app}";
Name: "{userdesktop}\GTA San Andreas"; Filename: "{app}\gta_sa.exe"; WorkingDir: "{app}"; Tasks: desktopicon;
Name: "{group}\{cm:UninstallProgram,GTA San Andreas}"; Filename: "{uninstallexe}"
[Run]
Description: "{cm:LaunchProgram, GTA San Andreas}"; Filename: "{app}\gta_sa.exe"; WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent unchecked
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[сode]
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('aqualux.cjstyles');
LoadSkin(ExpandConstant('{tmp}\aqualux.cjstyles'), '');
Result := True;
end;
procedure DeinitializeSetup();
begin
UnloadSkin();
end;
const
Indent=10;
dURL=2;
var
URLLabel,URLLabelShadow:TLabel;
procedure ShowMP3Panel(hMainFrm:HWND;StartVolume:integer;DefMP3Dir,BASSDir,MLabel:PChar;IsShowMP3Info,IsBkgFrm Visible:boolean;ShowTimeMP3Info:integer;dBottom:integer);external 'ShowMP3Panel@files:isgsg.dll stdcall';
procedure KillMP3Panel;external 'KillMP3Panel@files:isgsg.dll stdcall';
procedure URLLabelClick(Sender: TObject);
var
ErrorCode:integer;
begin
ShellExec('open','SpiCeMaN@spaces.ru','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
procedure URLLabelMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top+dURL;
URLLabel.Left:=URLLabel.Left+dURL;
URLLabel.Font.Style:=URLLabel.Font.Style+[fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabelShadow.Visible:=False;
end;
procedure URLLabelMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top-dURL;
URLLabel.Left:=URLLabel.Left-dURL;
URLLabel.Font.Style:=URLLabel.Font.Style-[fsUnderline];
URLLabel.Font.Color:=clMaroon;
URLLabelShadow.Visible:=True;
end;
function InitializeSetup:boolean;
begin
ExtractTemporaryFile('GTA_San_Andreas-GTA_San_Andreas.mp3');
ExtractTemporaryFile('bass.dll');
Result:=True;
end;
procedure InitializeWizard;
begin
URLLabelShadow:=TLabel.Create(WizardForm);
with URLLabelShadow do begin
Top:=ScaleY(331);
Left:=ScaleX(25);
Caption:='SpiCeMaN@spaces.ru';
AutoSize:=True;
Parent:=WizardForm;
Transparent:=True;
Font.Color:=$969696;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
end;
URLLabel:=TLabel.Create(WizardForm);
with URLLabel do begin
Top:=ScaleY(331)-dURL;
Left:=ScaleX(25)-dURL;
Caption:='SpiCeMaN@spaces.ru';
AutoSize:=True;
Parent:=WizardForm;
Cursor:=crHand;
Transparent:=True;
Font.Color:=clMaroon;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
BringToFront;
OnClick:=@URLLabelClick;
OnMouseDown:=@URLLabelMouseDown;
OnMouseUp:=@URLLabelMouseUp;
end;
ShowMP3Panel(WizardForm.Handle,80,ExpandConstant('{tmp}'),ExpandConstant('{tmp}'),'www.csmania.ru',F alse,False,0,Indent);
end;
procedure DeinitializeSetup;
begin
KillMP3Panel;
end;
Habetdin
03-09-2012, 11:59
spice, в секции [code] дублируются одинаковые функции/процедуры InitializeSetup и DeinitializeSetup. Fixed version, вроде должно работать :gigi:, только секция [code]:
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
const
Indent=10;
dURL=2;
var
URLLabel,URLLabelShadow:TLabel;
procedure ShowMP3Panel(hMainFrm:HWND;StartVolume:integer;DefMP3Dir,BASSDir,MLabel:PChar;IsShowMP3Info,IsBkgFrm Visible:boolean;ShowTimeMP3Info:integer;dBottom:integer);external 'ShowMP3Panel@files:isgsg.dll stdcall';
procedure KillMP3Panel;external 'KillMP3Panel@files:isgsg.dll stdcall';
procedure URLLabelClick(Sender: TObject);
var
ErrorCode:integer;
begin
ShellExec('open','http://spaces.ru/mysite/?name=SpiCeMaN','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;
procedure URLLabelMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top+dURL;
URLLabel.Left:=URLLabel.Left+dURL;
URLLabel.Font.Style:=URLLabel.Font.Style+[fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabelShadow.Visible:=False;
end;
procedure URLLabelMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top-dURL;
URLLabel.Left:=URLLabel.Left-dURL;
URLLabel.Font.Style:=URLLabel.Font.Style-[fsUnderline];
URLLabel.Font.Color:=clMaroon;
URLLabelShadow.Visible:=True;
end;
function InitializeSetup:boolean;
begin
ExtractTemporaryFile('GTA_San_Andreas-GTA_San_Andreas.mp3');
ExtractTemporaryFile('bass.dll');
ExtractTemporaryFile('aqualux.cjstyles');
LoadSkin(ExpandConstant('{tmp}\aqualux.cjstyles'), '');
Result:=True;
end;
procedure InitializeWizard;
begin
URLLabelShadow:=TLabel.Create(WizardForm);
with URLLabelShadow do begin
Top:=ScaleY(331);
Left:=ScaleX(25);
Caption:='SpiCeMaN@spaces.ru';
AutoSize:=True;
Parent:=WizardForm;
Transparent:=True;
Font.Color:=$969696;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
end;
URLLabel:=TLabel.Create(WizardForm);
with URLLabel do begin
Top:=ScaleY(331)-dURL;
Left:=ScaleX(25)-dURL;
Caption:='SpiCeMaN@spaces.ru';
AutoSize:=True;
Parent:=WizardForm;
Cursor:=crHand;
Transparent:=True;
Font.Color:=clMaroon;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
BringToFront;
OnClick:=@URLLabelClick;
OnMouseDown:=@URLLabelMouseDown;
OnMouseUp:=@URLLabelMouseUp;
end;
ShowMP3Panel(WizardForm.Handle,80,ExpandConstant('{tmp}'),ExpandConstant('{tmp}'),'www.csmania.ru',F alse,False,0,Indent);
end;
procedure DeinitializeSetup;
begin
UnloadSkin();
KillMP3Panel;
end;
я не понял что ты изменил, но все равно спасибо за помощь!
помогло!
Habetdin
03-09-2012, 12:22
что ты изменил »
Например:
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('aqualux.cjstyles');
LoadSkin(ExpandConstant('{tmp}\aqualux.cjstyles'), '');
Result := True;
end;
...
function InitializeSetup:boolean;
begin
ExtractTemporaryFile('GTA_San_Andreas-GTA_San_Andreas.mp3');
ExtractTemporaryFile('bass.dll');
Result:=True;
end;
Стало:
function InitializeSetup:boolean;
begin
ExtractTemporaryFile('GTA_San_Andreas-GTA_San_Andreas.mp3');
ExtractTemporaryFile('bass.dll');
ExtractTemporaryFile('aqualux.cjstyles');
LoadSkin(ExpandConstant('{tmp}\aqualux.cjstyles'), '');
Result:=True;
end;
P.S.: ISSJoiner из шапки должен помочь в будущем ;)
у меня все эти программы дополнения для inno setup есть но я ими не пользуюсь(не умею) у меня inno ultra.
как ISSJoiner пользоваться не подскажешь?
Gnom_aka_Lexander
03-09-2012, 12:44
как ISSJoiner пользоваться не подскажешь? »
Небольшое руководство по ипользованию утилиты ISS Joiner. (http://innoultra.ru/?p=378)
специально для тех, кто не любит читать, набросал.
Спасибо большое! теперь я разобрался!
народ помогите плиз! объединил 3 скрипта вроде все правильно сделал, но при компиляции такая ошибка
что это значит?
вот скрипт ; Ñêðèïò ñîçäàí ÷åðåç Ìàñòåð Inno Setup Script.
; ÈÑÏÎËÜÇÓÉÒÅ ÄÎÊÓÌÅÍÒÀÖÈÞ ÄËß ÏÎÄÐÎÁÍÎÑÒÅÉ ÈÑÏÎËÜÇÎÂÀÍÈß INNO SETUP!
[Setup]
; Ïðèìå÷àíèå: Çíà÷åíèå AppId èäåíòèôèöèðóåò ýòî ïðèëîæåíèå.
; Íå èñïîëüçóéòå îäíî è òîæå çíà÷åíèå â ðàçíûõ óñòàíîâêàõ.
; (Äëÿ ãåíåðàöèè çíà÷åíèÿ GUID, íàæìèòå Èíñòðóìåíòû | Ãåíåðàöèÿ GUID.)
AppId={{401CE660-D285-4327-AE2C-3CFB06643CC9}
AppName=ôîòî
AppVersion=1.5
;AppVerName=ôîòî 1.5
AppPublisher=Ìîÿ êîìïàíèÿ, Inc.
AppPublisherURL=http://www.ñàéò.com/
AppSupportURL=http://www.ñàéò.com/
AppUpdatesURL=http://www.ñàéò.com/
DefaultDirName={pf}\ôîòî
DefaultGroupName=ôîòî
OutputDir=C:\Users\Vadim\Desktop\ISS
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[Name]
Name: russian; Name: compiler:Name\Russian.isl
[CustomMessages]
russian.hour= ÷àñîâ
russian.min= ìèí
russian.sec= ñåê
[Files]
Source: C:\Users\Vadim\Desktop\ISS\ôîòî\innocallback.dll; Flags: dontcopy
Source: C:\Users\Vadim\Desktop\ôîòî\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
; Ïðèìå÷àíèå: Íå èñïîëüçóéòå "Flags: ignoreversion" äëÿ ñèñòåìíûõ ôàéëîâ
Source: C:\Users\Vadim\Desktop\ISS\ôîòî\ISSkin.dll; DestDir: {tmp}; Flags: dontcopy
Source: C:\Users\Vadim\Desktop\ISS\ôîòî\aqualux.cjstyles; DestDir: {tmp}; Flags: dontcopy
[c0de]
type
PDisplay_Device = record
cb: DWord;
DeviceName: array [0..31] of char;
DeviceString: array [0..127] of char;
StateFlags: DWord;
DeviceID, DeviceKey: array [0..127] of char;
end;
TMixerCaps = record
vPid, vDriverVersion: DWord;
sName: array [0..31] of char;
Support, cDestinations: DWord;
end;
// Ïðîâåðêà âåðñèè Windows
#if Pos("4.", GetFileVersion(AddBackslash(GetEnv("windir")) + "Explorer.exe")) == 1
{Win9x}
TMemoryStatusEx = record
dwLength, dwMemoryLoad: DWord;
LoTotalPhys, LoAvailPhys, LoTotalPageFile, LoAvailPageFile,
LoTotalVirtual, LoAvailVirtual, LoAvailExtendedVirtual, HiTotalPhys,
HiAvailPhys, HiTotalPageFile, HiAvailPageFile, HiTotalVirtual, HiAvailVirtual,
HiAvailExtendedVirtual: Integer;
end;
function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
external 'GlobalMemoryStatus@kernel32.dll stdcall';
#else
{WinNT}
TMemoryStatusEx = record
dwLength, dwMemoryLoad: DWord;
LoTotalPhys, HiTotalPhys, LoAvailPhys, HiAvailPhys,
LoTotalPageFile, HiTotalPageFile, LoAvailPageFile, HiAvailPageFile,
LoTotalVirtual, HiTotalVirtual, LoAvailVirtual, HiAvailVirtual, LoAvailExtendedVirtual,
HiAvailExtendedVirtual: Integer;
end;
function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
external 'GlobalMemoryStatusEx@kernel32.dll stdcall';
#endif
const
DISPLAY_DEVICE_PRIMARY_DEVICE = 4;
oneMB = 1024*1024;
NeedMHz = 1800;
NeedVideoRAM = 128;
NeedSoundCard = 'Creative X-Fi';
NeedMB = 512;
NeedPageFile = 1024;
var
InfoPage: TWizardPage;
TopText, BottomText: TNewStaticText;
ChangeText: Boolean;
SystemPanel, ProcessorPanel, VideoPanel,
AudioPanel, RAMPanel, PageFilePanel: TMemo;
SystemVersionPanel, ProcessorMHzPanel, VideoRAMPanel,
AudioNamePanel, RAMTotalPanel, PageFileTotalPanel: TMemo;
lpCaps: TMixerCaps;
Version: TWindowsVersion;
MemoryEx: TMemoryStatusEx;
n, errCode: Integer;
Keys: TArrayOfString;
DeviceValue: Cardinal;
lpDisplayDevice: PDisplay_Device;
function GetSystemMetrics(nIndex: Integer): Integer;
external 'GetSystemMetrics@user32.dll stdcall';
function GetDeviceCaps(hDC, nIndex: Integer): Integer;
external 'GetDeviceCaps@GDI32 stdcall';
function CreateDC(lpDriverName, lpDeviceName, lpOutput: String; lpInitData: Integer): Integer;
external 'CreateDCA@GDI32 stdcall';
function EnumDisplayDevices(lpDevice, iDevNum: DWord; var lpDisplayDevice: PDisplay_Device; dwFlags: DWord): Boolean;
external 'EnumDisplayDevicesA@user32.dll stdcall';
function mixerGetDevCaps(uDeviceID: LongInt; var lpCaps: TMixerCaps; uSize: LongInt): LongInt;
external 'mixerGetDevCapsA@winmm.dll stdcall';
function mixerGetNumDevs: Integer;
external 'mixerGetNumDevs@winmm.dll stdcall';
// Äîïîëíèòü ÷èñëî äî êðàòíîãî Multiple
function ToMultiple(Bytes, Multiple: Integer): Integer;
begin
if Abs(Bytes/Multiple) > Bytes/Multiple then
Result := (Bytes/Multiple + 1)*Multiple
else
Result := Bytes
end;
// Ïåðåâîä ÷èñëà â çíà÷åíèå Áò/Êá/Ìá/Ãá/Òá (äî 3õ çíàêîâ ïîñëå çàïÿòîé)
function ByteOrTB(Bytes: Extended; noMB: Boolean): String;
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 Size64(Hi, Lo: Integer): Extended;
begin
Result := Lo
if Lo < 0 then
Result := Result + $7FFFFFFF + $7FFFFFFF + 2
for Hi := Hi-1 downto 0 do Result := Result + $7FFFFFFF + $7FFFFFFF + 2
end;
function CheckCPU(NeedMHz: Integer): Boolean;
var
String: String;
begin
String := 'Hardware\Description\System\CentralProcessor'; RegGetSubkeyNames(HKLM, String, Keys) // Êîëè÷åñòâî ÿäåð
for n := 0 to GetArrayLength(Keys)-1 do
RegQueryStringValue(HKLM, String + '\' + Keys[n], 'ProcessorNameString', Keys[n])
if not RegQueryDWordValue(HKLM, String + '\0', '~MHz', DeviceValue) or (DeviceValue < NeedMHz) then
Exit
else
Result := True
end;
function CheckMemorySize(NeedRAM: Integer): Boolean;
begin
MemoryEx.dwLength := SizeOf(MemoryEx)
if not GlobalMemoryStatusEx(MemoryEx) then
MsgBox('Îøèáêà ôóíêöèè:' + #13 + 'GlobalMemoryStatusEx', mbError, mb_Ok)
else
if (ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) < NeedRAM) then
Exit
else
Result := True
end;
procedure CreateCheckForm();
begin
TopText := TNewStaticText.Create(InfoPage)
with TopText do
begin
Parent := InfoPage.Surface
Left := 0
AutoSize := True
end
BottomText := TNewStaticText.Create(InfoPage)
with BottomText do
begin
Parent := InfoPage.Surface
Caption := 'Êîãäà Âû áóäåòå ãîòîâû ïðîäîëæèòü óñòàíîâêó, íàæìèòå «Äàëåå».'
Font.Color := clBlack
Left := 0
Top := 200
AutoSize := True
end
SystemPanel := TMemo.Create(InfoPage)
with SystemPanel do
begin
Text := 'Ñèñòåìà'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := ScaleY(33)
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
SystemVersionPanel := TMemo.Create(InfoPage)
with SystemVersionPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := SystemPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
ProcessorPanel := TMemo.Create(InfoPage)
with ProcessorPanel do
begin
Text := 'Ïðîöåññîð'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := SystemPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
ProcessorMHzPanel := TMemo.Create(InfoPage)
with ProcessorMHzPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := ProcessorPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
VideoPanel := TMemo.Create(InfoPage)
with VideoPanel do
begin
Text := 'Âèäåîàäàïòåð'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := ProcessorPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
VideoRAMPanel := TMemo.Create(InfoPage)
with VideoRAMPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := VideoPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
AudioPanel := TMemo.Create(InfoPage)
with AudioPanel do
begin
Text := 'Çâóêîâàÿ êàðòà'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := VideoPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
AudioNamePanel := TMemo.Create(InfoPage)
with AudioNamePanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := AudioPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
RAMPanel := TMemo.Create(InfoPage)
with RAMPanel do
begin
Text := 'Îáú¸ì ïàìÿòè'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := AudioPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
RAMTotalPanel := TMemo.Create(InfoPage)
with RAMTotalPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := RAMPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
PageFilePanel := TMemo.Create(InfoPage)
with PageFilePanel do
begin
Text := 'Ôàéë ïîäêà÷êè'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := RAMPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end;
PageFileTotalPanel := TMemo.Create(InfoPage)
with PageFileTotalPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := PageFilePanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
end;
procedure UpdateInfo();
var
DeviceName, DeviceKey: String;
begin
ChangeText := False
GetWindowsVersionEx(Version)
// Îïåðàöèîííàÿ ñèñòåìà:
SystemVersionPanel.Color := $CCFFCC
DeviceKey := 'Software\Microsoft\Windows NT\CurrentVersion'
if not UsingWinNT then StringChange(DeviceKey, 'Windows NT', 'Windows')
RegQueryStringValue(HKLM, DeviceKey, 'ProductName', DeviceName)
if RegQueryStringValue(HKLM, DeviceKey, 'CSDVersion', DeviceKey) then
DeviceName := DeviceName + ' ' + DeviceKey
StringChange(DeviceName, 'Microsoft ', '')
SystemVersionPanel.Text := ' ' + DeviceName + ' ñáîðêà ' + IntToStr(Version.Major) + '.' + IntToStr(Version.Minor) +
'.' + IntToStr(Version.Build)
if (Pos('2000 Service Pack 4', SystemVersionPanel.Text) = 0) and // Windows 2000 SP4
(Pos('XP Service Pack 2', SystemVersionPanel.Text) = 0) and // Windows XP SP2
(Pos('Vista', SystemVersionPanel.Text) = 0) and // Windows Vista (c ëþáûì SP èëè áåç íåãî)
(Pos('Windows 7', SystemVersionPanel.Text) = 0) then
begin
SystemVersionPanel.Color := $CCCCFF
ChangeText := True
end
// Ïðîöåññîð:
ProcessorMHzPanel.Color := $CCFFCC
if not CheckCPU(NeedMHz) then
begin
ProcessorMHzPanel.Color := $CCCCFF
ChangeText := True
end
ProcessorMHzPanel.Text := ' ' + DelSp(Keys[0]) + ' @' + IntToStr(DeviceValue) + ' MHz'
if GetArrayLength(Keys) > 1 then
ProcessorPanel.Text := 'Ïðîöåññîðû' // + ' (' + IntToStr(GetArrayLength(Keys)) + ')'
// Âèäåîêàðòà:
VideoRAMPanel.Color := $CCFFCC
lpDisplayDevice.cb := SizeOf(lpDisplayDevice)
DeviceKey := ''
n := 0
while not (EnumDisplayDevices(0, n, lpDisplayDevice, 0) and
(lpDisplayDevice.StateFlags and DISPLAY_DEVICE_PRIMARY_DEVICE > 0)) and (n < 127) do n := n + 1
for n := 0 to 127 do DeviceKey := DeviceKey + lpDisplayDevice.DeviceKey[n]
Delete(DeviceKey, Pos(Chr(0), DeviceKey), 127) // Êëþ÷ äðàéâåðà ïîëó÷àåì èç API
StringChange(DeviceKey, '\Registry\Machine\', '')
errCode := 1
DeviceValue := 0
if RegQueryBinaryValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceName) then
for n := 1 to Length(DeviceName) do
begin
DeviceValue := DeviceValue + Ord(DeviceName[n])*errCode
errCode := errCode*$100
end
else
if RegQueryDWordValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceValue) then
else
RegQueryDWordValue(HKLM, DeviceKey + '\Info', 'VideoMemory', DeviceValue)
DeviceName := ''
for n := 0 to 127 do DeviceName := DeviceName + lpDisplayDevice.DeviceString[n]
Delete(DeviceName, Pos(Chr(0), DeviceName), 127)
if DeviceName <> '' then
if DeviceValue > 0 then
VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ', '+ ByteOrTB(DeviceValue/oneMB, False)
else
VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ' (Standard), '+ ByteOrTB(DeviceValue/oneMB, False)
else
begin
VideoRAMPanel.Text := ' Äðàéâåð óñòðîéñòâà íå îáíàðóæåí'
VideoRAMPanel.Color := $CCCCFF
ChangeText := True
end
if (DeviceValue/oneMB < NeedVideoRAM) then
begin
VideoRAMPanel.Color := $CCCCFF
ChangeText := True
end
VideoRAMPanel.Text := VideoRAMPanel.Text + ', ' + IntToStr(GetSystemMetrics(0)) + 'x' +
IntToStr(GetSystemMetrics(1)) + ' (' + IntToStr(GetDeviceCaps(CreateDC('DISPLAY','','',0),14) *
GetDeviceCaps(CreateDC('DISPLAY','','',0),12)) + ' bit)'
// Çâóêîâàÿ êàðòà:
AudioNamePanel.Color := $CCFFCC
// for errCode := 0 to 1 do // Âûâîä îñíîâíîãî çâóêîâîãî óñòðîéñòâà
for errCode := 0 to mixerGetNumDevs do
begin
mixerGetDevCaps(errCode-1, lpCaps, SizeOf(lpCaps))
DeviceName := ' '
for n := 0 to 31 do DeviceName := DeviceName + lpCaps.sName[n]
Delete(DeviceName, Pos(Chr(0), DeviceName), 31)
Delete(DeviceName, Pos(' [', DeviceName), 31)
StringChange(DeviceName, 'SB ', 'Creative ')
Delete(DeviceName, Pos(' Audio', DeviceName), 31)
SetArrayLength(Keys, errCode)
if errCode > 0 then Keys[errCode-1] := DeviceName
end
if GetArrayLength(Keys) > 1 then
begin
AudioPanel.Text := 'Çâóêîâûå êàðòû'
// AudioPanel.Text := 'Çâóêîâûå êàðòû (' + IntToStr(GetArrayLength(Keys)) +')'
AudioNamePanel.Text := ''
for n := 1 to GetArrayLength(Keys) do
AudioNamePanel.Text := AudioNamePanel.Text + Keys[n-1] // + '(' + IntToStr(n) + ')'
end
else
if GetArrayLength(Keys) = 0 then
begin
AudioNamePanel.Text := ' Äðàéâåð óñòðîéñòâà íå îáíàðóæåí'
AudioNamePanel.Color := $CCCCFF
ChangeText := True
end
else
AudioNamePanel.Text := Keys[0]
if Pos(NeedSoundCard, AudioNamePanel.Text) = 0 then
AudioNamePanel.Text := AudioNamePanel.Text + ' (ðåêîìåíäóåòñÿ ' + NeedSoundCard + ')'
// Îáú¸ì ïàìÿòè:
RAMTotalPanel.Color := $CCFFCC
if not CheckMemorySize(NeedMB) then
begin
RAMTotalPanel.Color := $CCCCFF
ChangeText := True
end
RAMTotalPanel.Text := ' ' + ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16), False) + ' âñåãî, ' +
ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) -
Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' èñïîëüçóåòñÿ, ' +
ByteOrTB(Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' ñâîáîäíî'
// Âèðòóàëüíàÿ ïàìÿòü:
PageFileTotalPanel.Color := $CCFFCC
PageFileTotalPanel.Text := ' ' + ByteOrTB(Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB, False) + ' âñåãî, ' +
ByteOrTB((Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile) -
Size64(MemoryEx.HiAvailPageFile, MemoryEx.LoAvailPageFile))/oneMB, False) + ' çàíÿòî ñèñòåìíûì êýøåì'
if Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB < NeedPageFile then
begin
PageFileTotalPanel.Color := $CCCCFF
ChangeText := True
end
if ChangeText = True then
begin
TopText.Top := 0
TopText.Caption := 'Íå âñå êîìïîíåíòû óäîâëåòâîðÿþò ìèíèìàëüíûì òðåáîâàíèÿì èãðû.' #13
'Ïîæàëóéñòà, ïðîâåðüòå ïîçèöèè, âûäåëåííûå êðàñíûì öâåòîì.'
TopText.Font.Color := clRed
// WizardForm.NextButton.Enabled := False
end
else
begin
TopText.Caption := 'Âñå êîìïîíåíòû ñîîòâåòñòâóþò ìèíèìàëüíûì òðåáîâàíèÿì èãðû.'
TopText.Font.Color := clGreen
TopText.Top := 8
// WizardForm.NextButton.Enabled := True
end
end;
procedure InitializeWizard1();
begin
InfoPage := CreateCustomPage(wpLicense, 'Àïïàðàòíîå è ïðîãðàììíîå îáåñïå÷åíèå',
'Ïðîãðàììà óñòàíîâêè îáíàðóæèëà ñëåäóþùèå íàîáõîäèìûå êîìïîíåíòû.')
CreateCheckForm() // Ñîçäàíèå îáúåêòîâ TMemo, â êîòîðûõ áóäåò âûâîäèòñÿ èíôîðìàöèÿ î ñèñòåìå
UpdateInfo() // Îáíîâëåíèå èíôîðìàöèè î ñèñòåìå
end;
procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID = InfoPage.ID then UpdateInfo() // Îáíîâëåíèå èíôîðìàöèè î ñèñòåìå
end;
// --- Source: 2.iss ------------------------------------------------------------
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
var
PercentsTimer: LongWord;
PercentsLabel: TLabel;
function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload';
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.1n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
Procedure PercentsProc(h, msg, idevent, dwTime: Longword);
Begin
with WizardForm.ProgressGauge do
begin
PercentsLabel.Caption:= 'Âûïîëíåíî ' + NumToStr((Position*100)/Max) + ' %';
end;
End;
procedure DeinitializeSetup2();
begin
KillTimer(0, PercentsTimer);
end;
procedure InitializeWizard2();
begin
PercentsLabel:= TLabel.Create(WizardForm);
with PercentsLabel do
begin
Left:= WizardForm.ProgressGauge.Left;
Top:= WizardForm.ProgressGauge.Top + WizardForm.ProgressGauge.Height + ScaleY(10);
Width:= WizardForm.StatusLabel.Width;
Height:= WizardForm.StatusLabel.Height;
AutoSize:= False;
Transparent := True;
Parent:= WizardForm.InstallingPage;
end;
end;
procedure CurStepChanged2(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
PercentsTimer:= SetTimer(0, 0, 100, WrapTimerProc(@PercentsProc, 4));
end;
end;
// --- Source: 3.iss ------------------------------------------------------------
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
var
StartInstall: Integer;
TimeLabel: TLabel;
TimerID: Longword;
function GetTickCount: DWord; external 'GetTickCount@kernel32';
function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload';
Function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail then {hh: mm:ss format}
Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2)
else if Ticks/3600 >= 1000 then {more than hour}
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 then {1..60 minutes}
Result:= IntToStr(Ticks/60000) +m+' '+ IntToStr(Ticks/1000 - Ticks/1000/60*60) +s
else Result:= Format('%.1n', [Abs(Ticks/1000)]) +s {less than one minute}
End;
procedure GetTime(HandleW, Msg, idEvent, TimeSys: LongWord);
var Remaining: Integer;
begin
with WizardForm.ProgressGauge do begin
if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position))
TimeLabel.Caption:= 'Inoaeinu ' + TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)
if (Remaining = 0) then TimeLabel.Caption:= 'Çàâåðøåíèå...'
end;
end;
procedure InitializeWizard3();
begin
TimeLabel:= TLabel.Create(WizardForm)
TimeLabel.SetBounds(ScaleX(0), ScaleY(80), ScaleX(457), ScaleY(20));
TimeLabel.AutoSize:= False
TimeLabel.Transparent:= True;
TimeLabel.Parent:= WizardForm.InstallingPage;
end;
procedure CurStepChanged3(CurStep: TSetupStep);
begin
If CurStep = ssInstall then
begin
StartInstall:= GetTickCount
TimerID:= SetTimer(0,0, 500, WrapTimerProc(@GetTime, 4))
end;
end;
procedure DeinitializeSetup3();
begin
KillTimer(0, TimerID)
end;
// --- Dispatching code ------------------------------------------------------------
procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
end;
procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
end;
procedure DeinitializeSetup();
begin
DeinitializeSetup2();
DeinitializeSetup3();
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
CurStepChanged2(CurStep);
CurStepChanged3(CurStep);
end;
spice »
У тебя дублируется функция: TTimerProc. Повтор.
блин а как это исправить?
блин а как это исправить? »Может так?
[Setup]
AppId={{401CE660-D285-4327-AE2C-3CFB06643CC9}
AppName=oioi
AppVersion=1.5
;AppVerName=oioi 1.5
AppPublisher=Iiy eiiiaiey, Inc.
AppPublisherURL=http://www.naeo.com/
AppSupportURL=http://www.naeo.com/
AppUpdatesURL=http://www.naeo.com/
DefaultDirName={pf}\oioi
DefaultGroupName=oioi
OutputDir=C:\Users\Vadim\Desktop\ISS
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[Name]
Name: russian; Name: compiler:Name\Russian.isl
[CustomMessages]
russian.hour= Часы
russian.min= Минуты
russian.sec= Секунды
[Files]
Source: C:\Users\Vadim\Desktop\ISS\oioi\innocallback.dll; Flags: dontcopy
Source: C:\Users\Vadim\Desktop\oioi\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
;
Source: C:\Users\Vadim\Desktop\ISS\oioi\ISSkin.dll; DestDir: {tmp}; Flags: dontcopy
Source: C:\Users\Vadim\Desktop\ISS\oioi\aqualux.cjstyles; DestDir: {tmp}; Flags: dontcopy
[#code]
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
//
PDisplay_Device = record
cb: DWord;
DeviceName: array [0..31] of char;
DeviceString: array [0..127] of char;
StateFlags: DWord;
DeviceID, DeviceKey: array [0..127] of char;
end;
TMixerCaps = record
vPid, vDriverVersion: DWord;
sName: array [0..31] of char;
Support, cDestinations: DWord;
end;
// I?iaa?ea aa?nee Windows
#if Pos("4.", GetFileVersion(AddBackslash(GetEnv("windir")) + "Explorer.exe")) == 1
{Win9x}
TMemoryStatusEx = record
dwLength, dwMemoryLoad: DWord;
LoTotalPhys, LoAvailPhys, LoTotalPageFile, LoAvailPageFile,
LoTotalVirtual, LoAvailVirtual, LoAvailExtendedVirtual, HiTotalPhys,
HiAvailPhys, HiTotalPageFile, HiAvailPageFile, HiTotalVirtual, HiAvailVirtual,
HiAvailExtendedVirtual: Integer;
end;
function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
external 'GlobalMemoryStatus@kernel32.dll stdcall';
#else
{WinNT}
TMemoryStatusEx = record
dwLength, dwMemoryLoad: DWord;
LoTotalPhys, HiTotalPhys, LoAvailPhys, HiAvailPhys,
LoTotalPageFile, HiTotalPageFile, LoAvailPageFile, HiAvailPageFile,
LoTotalVirtual, HiTotalVirtual, LoAvailVirtual, HiAvailVirtual, LoAvailExtendedVirtual,
HiAvailExtendedVirtual: Integer;
end;
function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean;
external 'GlobalMemoryStatusEx@kernel32.dll stdcall';
#endif
const
DISPLAY_DEVICE_PRIMARY_DEVICE = 4;
oneMB = 1024*1024;
NeedMHz = 1800;
NeedVideoRAM = 128;
NeedSoundCard = 'Creative X-Fi';
NeedMB = 512;
NeedPageFile = 1024;
var
InfoPage: TWizardPage;
TopText, BottomText: TNewStaticText;
ChangeText: Boolean;
SystemPanel, ProcessorPanel, VideoPanel,
AudioPanel, RAMPanel, PageFilePanel: TMemo;
SystemVersionPanel, ProcessorMHzPanel, VideoRAMPanel,
AudioNamePanel, RAMTotalPanel, PageFileTotalPanel: TMemo;
lpCaps: TMixerCaps;
Version: TWindowsVersion;
MemoryEx: TMemoryStatusEx;
n, errCode: Integer;
Keys: TArrayOfString;
DeviceValue: Cardinal;
lpDisplayDevice: PDisplay_Device;
function GetSystemMetrics(nIndex: Integer): Integer;
external 'GetSystemMetrics@user32.dll stdcall';
function GetDeviceCaps(hDC, nIndex: Integer): Integer;
external 'GetDeviceCaps@GDI32 stdcall';
function CreateDC(lpDriverName, lpDeviceName, lpOutput: String; lpInitData: Integer): Integer;
external 'CreateDCA@GDI32 stdcall';
function EnumDisplayDevices(lpDevice, iDevNum: DWord; var lpDisplayDevice: PDisplay_Device; dwFlags: DWord): Boolean;
external 'EnumDisplayDevicesA@user32.dll stdcall';
function mixerGetDevCaps(uDeviceID: LongInt; var lpCaps: TMixerCaps; uSize: LongInt): LongInt;
external 'mixerGetDevCapsA@winmm.dll stdcall';
function mixerGetNumDevs: Integer;
external 'mixerGetNumDevs@winmm.dll stdcall';
// Aiiieieou ?enei ai e?aoiiai Multiple
function ToMultiple(Bytes, Multiple: Integer): Integer;
begin
if Abs(Bytes/Multiple) > Bytes/Multiple then
Result := (Bytes/Multiple + 1)*Multiple
else
Result := Bytes
end;
// Ia?aaia ?enea a cia?aiea Ao/Ea/Ia/Aa/Oa (ai 3o ciaeia iinea caiyoie)
function ByteOrTB(Bytes: Extended; noMB: Boolean): String;
begin
if not noMB then
Result := FloatToStr(Int(Bytes)) + ' Ia'
else
if Bytes < 1024 then
Result := FloatToStr(Int(Bytes)) + ' Ao'
else
if Bytes/1024 < 1024 then
Result := FloatToStr(round((Bytes/1024)*10)/10) + ' Ea'
else
if Bytes/oneMB < 1024 then
Result := FloatToStr(round(Bytes/oneMB*100)/100) + ' Ia'
else
if Bytes/oneMB/1000 < 1024 then
Result := FloatToStr(round(Bytes/oneMB/1024*1000)/1000) + ' Aa'
else
Result := FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) + ' Oa'
StringChange(Result, ',', '.')
end;
// Oaaeaiea ia?aeuiuo, eiia?iuo e iiaoi?iuo i?iaaeia
function DelSp(String: String): String;
begin
while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1)
Result := Trim(String)
end;
function Size64(Hi, Lo: Integer): Extended;
begin
Result := Lo
if Lo < 0 then
Result := Result + $7FFFFFFF + $7FFFFFFF + 2
for Hi := Hi-1 downto 0 do Result := Result + $7FFFFFFF + $7FFFFFFF + 2
end;
function CheckCPU(NeedMHz: Integer): Boolean;
var
String: String;
begin
String := 'Hardware\Description\System\CentralProcessor'; RegGetSubkeyNames(HKLM, String, Keys) // Eiee?anoai yaa?
for n := 0 to GetArrayLength(Keys)-1 do
RegQueryStringValue(HKLM, String + '\' + Keys[n], 'ProcessorNameString', Keys[n])
if not RegQueryDWordValue(HKLM, String + '\0', '~MHz', DeviceValue) or (DeviceValue < NeedMHz) then
Exit
else
Result := True
end;
function CheckMemorySize(NeedRAM: Integer): Boolean;
begin
MemoryEx.dwLength := SizeOf(MemoryEx)
if not GlobalMemoryStatusEx(MemoryEx) then
MsgBox('Ioeaea ooieoee:' + #13 + 'GlobalMemoryStatusEx', mbError, mb_Ok)
else
if (ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) < NeedRAM) then
Exit
else
Result := True
end;
procedure CreateCheckForm();
begin
TopText := TNewStaticText.Create(InfoPage)
with TopText do
begin
Parent := InfoPage.Surface
Left := 0
AutoSize := True
end
BottomText := TNewStaticText.Create(InfoPage)
with BottomText do
begin
Parent := InfoPage.Surface
Caption := 'Eiaaa Au aoaaoa aioiau i?iaie?eou onoaiiaeo, ia?ieoa «Aaeaa».'
Font.Color := clBlack
Left := 0
Top := 200
AutoSize := True
end
SystemPanel := TMemo.Create(InfoPage)
with SystemPanel do
begin
Text := 'Nenoaia'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := ScaleY(33)
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
SystemVersionPanel := TMemo.Create(InfoPage)
with SystemVersionPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := SystemPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
ProcessorPanel := TMemo.Create(InfoPage)
with ProcessorPanel do
begin
Text := 'I?ioanni?'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := SystemPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
ProcessorMHzPanel := TMemo.Create(InfoPage)
with ProcessorMHzPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := ProcessorPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
VideoPanel := TMemo.Create(InfoPage)
with VideoPanel do
begin
Text := 'Aeaaiaaaioa?'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := ProcessorPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
VideoRAMPanel := TMemo.Create(InfoPage)
with VideoRAMPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := VideoPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
AudioPanel := TMemo.Create(InfoPage)
with AudioPanel do
begin
Text := 'Caoeiaay ea?oa'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := VideoPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
AudioNamePanel := TMemo.Create(InfoPage)
with AudioNamePanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := AudioPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
RAMPanel := TMemo.Create(InfoPage)
with RAMPanel do
begin
Text := 'Iau?i iaiyoe'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := AudioPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end
RAMTotalPanel := TMemo.Create(InfoPage)
with RAMTotalPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := RAMPanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
PageFilePanel := TMemo.Create(InfoPage)
with PageFilePanel do
begin
Text := 'Oaee iiaea?ee'
Alignment := taCenter
Parent := InfoPage.Surface
Left := ScaleX(0)
Top := RAMPanel.Top + 27
Width := ScaleX(100)
Height := ScaleY(22)
ReadOnly := True
Color := $EEEEEE
end;
PageFileTotalPanel := TMemo.Create(InfoPage)
with PageFileTotalPanel do
begin
Alignment := taLeftJustify
Parent := InfoPage.Surface
Left := ScaleX(104)
Top := PageFilePanel.Top
Width := ScaleX(310)
Height := ScaleY(22)
ReadOnly := True
end
end;
procedure UpdateInfo();
var
DeviceName, DeviceKey: String;
begin
ChangeText := False
GetWindowsVersionEx(Version)
// Iia?aoeiiiay nenoaia:
SystemVersionPanel.Color := $CCFFCC
DeviceKey := 'Software\Microsoft\Windows NT\CurrentVersion'
if not UsingWinNT then StringChange(DeviceKey, 'Windows NT', 'Windows')
RegQueryStringValue(HKLM, DeviceKey, 'ProductName', DeviceName)
if RegQueryStringValue(HKLM, DeviceKey, 'CSDVersion', DeviceKey) then
DeviceName := DeviceName + ' ' + DeviceKey
StringChange(DeviceName, 'Microsoft ', '')
SystemVersionPanel.Text := ' ' + DeviceName + ' nai?ea ' + IntToStr(Version.Major) + '.' + IntToStr(Version.Minor) +
'.' + IntToStr(Version.Build)
if (Pos('2000 Service Pack 4', SystemVersionPanel.Text) = 0) and // Windows 2000 SP4
(Pos('XP Service Pack 2', SystemVersionPanel.Text) = 0) and // Windows XP SP2
(Pos('Vista', SystemVersionPanel.Text) = 0) and // Windows Vista (c e?aui SP eee aac iaai)
(Pos('Windows 7', SystemVersionPanel.Text) = 0) then
begin
SystemVersionPanel.Color := $CCCCFF
ChangeText := True
end
// I?ioanni?:
ProcessorMHzPanel.Color := $CCFFCC
if not CheckCPU(NeedMHz) then
begin
ProcessorMHzPanel.Color := $CCCCFF
ChangeText := True
end
ProcessorMHzPanel.Text := ' ' + DelSp(Keys[0]) + ' @' + IntToStr(DeviceValue) + ' MHz'
if GetArrayLength(Keys) > 1 then
ProcessorPanel.Text := 'I?ioanni?u' // + ' (' + IntToStr(GetArrayLength(Keys)) + ')'
// Aeaaiea?oa:
VideoRAMPanel.Color := $CCFFCC
lpDisplayDevice.cb := SizeOf(lpDisplayDevice)
DeviceKey := ''
n := 0
while not (EnumDisplayDevices(0, n, lpDisplayDevice, 0) and
(lpDisplayDevice.StateFlags and DISPLAY_DEVICE_PRIMARY_DEVICE > 0)) and (n < 127) do n := n + 1
for n := 0 to 127 do DeviceKey := DeviceKey + lpDisplayDevice.DeviceKey[n]
Delete(DeviceKey, Pos(Chr(0), DeviceKey), 127) // Ee?? a?aeaa?a iieo?aai ec API
StringChange(DeviceKey, '\Registry\Machine\', '')
errCode := 1
DeviceValue := 0
if RegQueryBinaryValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceName) then
for n := 1 to Length(DeviceName) do
begin
DeviceValue := DeviceValue + Ord(DeviceName[n])*errCode
errCode := errCode*$100
end
else
if RegQueryDWordValue(HKLM, DeviceKey, 'HardwareInformation.MemorySize', DeviceValue) then
else
RegQueryDWordValue(HKLM, DeviceKey + '\Info', 'VideoMemory', DeviceValue)
DeviceName := ''
for n := 0 to 127 do DeviceName := DeviceName + lpDisplayDevice.DeviceString[n]
Delete(DeviceName, Pos(Chr(0), DeviceName), 127)
if DeviceName <> '' then
if DeviceValue > 0 then
VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ', '+ ByteOrTB(DeviceValue/oneMB, False)
else
VideoRAMPanel.Text := ' ' + DelSp(DeviceName) + ' (Standard), '+ ByteOrTB(DeviceValue/oneMB, False)
else
begin
VideoRAMPanel.Text := ' A?aeaa? ono?ienoaa ia iaia?o?ai'
VideoRAMPanel.Color := $CCCCFF
ChangeText := True
end
if (DeviceValue/oneMB < NeedVideoRAM) then
begin
VideoRAMPanel.Color := $CCCCFF
ChangeText := True
end
VideoRAMPanel.Text := VideoRAMPanel.Text + ', ' + IntToStr(GetSystemMetrics(0)) + 'x' +
IntToStr(GetSystemMetrics(1)) + ' (' + IntToStr(GetDeviceCaps(CreateDC('DISPLAY','','',0),14) *
GetDeviceCaps(CreateDC('DISPLAY','','',0),12)) + ' bit)'
// Caoeiaay ea?oa:
AudioNamePanel.Color := $CCFFCC
// for errCode := 0 to 1 do // Auaia iniiaiiai caoeiaiai ono?ienoaa
for errCode := 0 to mixerGetNumDevs do
begin
mixerGetDevCaps(errCode-1, lpCaps, SizeOf(lpCaps))
DeviceName := ' '
for n := 0 to 31 do DeviceName := DeviceName + lpCaps.sName[n]
Delete(DeviceName, Pos(Chr(0), DeviceName), 31)
Delete(DeviceName, Pos(' [', DeviceName), 31)
StringChange(DeviceName, 'SB ', 'Creative ')
Delete(DeviceName, Pos(' Audio', DeviceName), 31)
SetArrayLength(Keys, errCode)
if errCode > 0 then Keys[errCode-1] := DeviceName
end
if GetArrayLength(Keys) > 1 then
begin
AudioPanel.Text := 'Caoeiaua ea?ou'
// AudioPanel.Text := 'Caoeiaua ea?ou (' + IntToStr(GetArrayLength(Keys)) +')'
AudioNamePanel.Text := ''
for n := 1 to GetArrayLength(Keys) do
AudioNamePanel.Text := AudioNamePanel.Text + Keys[n-1] // + '(' + IntToStr(n) + ')'
end
else
if GetArrayLength(Keys) = 0 then
begin
AudioNamePanel.Text := ' A?aeaa? ono?ienoaa ia iaia?o?ai'
AudioNamePanel.Color := $CCCCFF
ChangeText := True
end
else
AudioNamePanel.Text := Keys[0]
if Pos(NeedSoundCard, AudioNamePanel.Text) = 0 then
AudioNamePanel.Text := AudioNamePanel.Text + ' (?aeiiaiaoaony ' + NeedSoundCard + ')'
// Iau?i iaiyoe:
RAMTotalPanel.Color := $CCFFCC
if not CheckMemorySize(NeedMB) then
begin
RAMTotalPanel.Color := $CCCCFF
ChangeText := True
end
RAMTotalPanel.Text := ' ' + ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16), False) + ' anaai, ' +
ByteOrTB(ToMultiple(trunc(Size64(MemoryEx.HiTotalPhys, MemoryEx.LoTotalPhys)/oneMB), 16) -
Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' eniieucoaony, ' +
ByteOrTB(Size64(MemoryEx.HiAvailPhys, MemoryEx.LoAvailPhys)/oneMB, False) + ' naiaiaii'
// Ae?ooaeuiay iaiyou:
PageFileTotalPanel.Color := $CCFFCC
PageFileTotalPanel.Text := ' ' + ByteOrTB(Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB, False) + ' anaai, ' +
ByteOrTB((Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile) -
Size64(MemoryEx.HiAvailPageFile, MemoryEx.LoAvailPageFile))/oneMB, False) + ' caiyoi nenoaiiui eyoai'
if Size64(MemoryEx.HiTotalPageFile, MemoryEx.LoTotalPageFile)/oneMB < NeedPageFile then
begin
PageFileTotalPanel.Color := $CCCCFF
ChangeText := True
end
if ChangeText = True then
begin
TopText.Top := 0
TopText.Caption := 'Ia ana eiiiiiaiou oaiaeaoai?y?o ieieiaeuiui o?aaiaaieyi ea?u.' #13
'Ii?aeoenoa, i?iaa?uoa iiceoee, auaaeaiiua e?aniui oaaoii.'
TopText.Font.Color := clRed
// WizardForm.NextButton.Enabled := False
end
else
begin
TopText.Caption := 'Ana eiiiiiaiou niioaaonoao?o ieieiaeuiui o?aaiaaieyi ea?u.'
TopText.Font.Color := clGreen
TopText.Top := 8
// WizardForm.NextButton.Enabled := True
end
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = InfoPage.ID then UpdateInfo() // Iaiiaeaiea eioi?iaoee i nenoaia
end;
// --- Source: 2.iss ------------------------------------------------------------
var
PercentsTimer: LongWord;
PercentsLabel: TLabel;
function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload';
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.1n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
Procedure PercentsProc(h, msg, idevent, dwTime: Longword);
Begin
with WizardForm.ProgressGauge do
begin
PercentsLabel.Caption:= 'Auiieiaii ' + NumToStr((Position*100)/Max) + ' %';
end;
End;
// --- Source: 3.iss ------------------------------------------------------------
var
StartInstall: Integer;
TimeLabel: TLabel;
TimerID: Longword;
function GetTickCount: DWord; external 'GetTickCount@kernel32';
Function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail then {hh: mm:ss format}
Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2)
else if Ticks/3600 >= 1000 then {more than hour}
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 then {1..60 minutes}
Result:= IntToStr(Ticks/60000) +m+' '+ IntToStr(Ticks/1000 - Ticks/1000/60*60) +s
else Result:= Format('%.1n', [Abs(Ticks/1000)]) +s {less than one minute}
End;
procedure GetTime(HandleW, Msg, idEvent, TimeSys: LongWord);
var Remaining: Integer;
begin
with WizardForm.ProgressGauge do begin
if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position))
TimeLabel.Caption:= 'Inoaeinu ' + TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)
if (Remaining = 0) then TimeLabel.Caption:= 'Caaa?oaiea...'
end;
end;
procedure InitializeWizard();
begin
PercentsLabel:= TLabel.Create(WizardForm);
with PercentsLabel do
begin
Left:= WizardForm.ProgressGauge.Left;
Top:= WizardForm.ProgressGauge.Top + WizardForm.ProgressGauge.Height + ScaleY(10);
Width:= WizardForm.StatusLabel.Width;
Height:= WizardForm.StatusLabel.Height;
AutoSize:= False;
Transparent := True;
Parent:= WizardForm.InstallingPage;
end;
//procedure InitializeWizard1();
begin
InfoPage := CreateCustomPage(wpLicense, 'Aiia?aoiia e i?ia?aiiiia iaania?aiea',
'I?ia?aiia onoaiiaee iaia?o?eea neaao?uea iaiaoiaeiua eiiiiiaiou.')
CreateCheckForm() // Nicaaiea iauaeoia TMemo, a eioi?uo aoaao auaiaeony eioi?iaoey i nenoaia
UpdateInfo() // Iaiiaeaiea eioi?iaoee i nenoaia
end;
//procedure InitializeWizard3();
begin
TimeLabel:= TLabel.Create(WizardForm)
TimeLabel.SetBounds(ScaleX(0), ScaleY(80), ScaleX(457), ScaleY(20));
TimeLabel.AutoSize:= False
TimeLabel.Transparent:= True;
TimeLabel.Parent:= WizardForm.InstallingPage;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep = ssInstall then
begin
StartInstall:= GetTickCount
TimerID:= SetTimer(0,0, 500, WrapTimerProc(@GetTime, 4))
PercentsTimer:= SetTimer(0, 0, 100, WrapTimerProc(@PercentsProc, 4));
end;
end;
//procedure CurStepChanged2(CurStep: TSetupStep);
//begin
//if CurStep = ssInstall then
//begin
//PercentsTimer:= SetTimer(0, 0, 100, WrapTimerProc(@PercentsProc, 4));
//end;
//end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID)
KillTimer(0, PercentsTimer);
end;
//procedure DeinitializeSetup2();
//begin
//KillTimer(0, PercentsTimer);
//end;
// --- Dispatching code ------------------------------------------------------------
//procedure InitializeWizard();
//begin
// InitializeWizard1();
// InitializeWizard2();
// InitializeWizard3();
//end;
//procedure CurPageChanged(CurPageID: Integer);
//begin
// CurPageChanged1(CurPageID);
//end;
//procedure DeinitializeSetup();
//begin
// DeinitializeSetup2();
// DeinitializeSetup3();
//end;
//procedure CurStepChanged(CurStep: TSetupStep);
//begin
// CurStepChanged2(CurStep);
// CurStepChanged3(CurStep);
//end;
В следующий раз для вставки сюда своего кода, открывай свой скрипт в блокноте (например Notepad++) и копипасть от туда сюда, а то ведь не дело видеть иероглифы подобны этим [Ia ana eiiiiiaiou oaiaeaoai?y?o ieieiaeuiui o?aaiaaieyi ea?u.'].
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.