ALTAIR_OC
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору AppName=Fallout 3 AppVerName=Fallout 3 DefaultDirName={pf}\My Program OutputDir=C:\ WizardImageFile=E:\WizardImageFile.bmp WizardSmallImageFile=E:\WizardSmallImageFile.bmp [Languages] Name: eng; MessagesFile: compiler:Default.isl Name: rus; MessagesFile: compiler:Languages\Russian.isl [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [CustomMessages] eng.ArcCancel=Cancel installation eng.ArcBreak=Installation cancelled! eng.ArcInfo=Extracted %1 Mb of %2 Mb (%3%%). Archive: %4 of %5. eng.ArcTitle=Extracting FreeArc archive eng.ArcError=Decompression failed with error code %1 eng.ArcFail=Decompression failed! eng.AllProgress=Overall extraction progress: %1%% eng.ArcBroken=Archive %1 is damaged%nor not enough free space. eng.Extracting=Extracting: %1 eng.remains=%1%%, %2 elapsed eng.LongTime=at no time eng.ending=ending rus.ArcCancel=Îòìåíèòü ðàñïàêîâêó rus.ArcBreak=Óñòàíîâêà ïðåðâàíà! rus.ArcInfo=Ðàñïàêîâàíî %1 Ìá èç %2 Ìá (%3%%). Àðõèâ: %4 èç %5. rus.ArcTitle=Ðàñïàêîâêà àðõèâîâ FreeArc rus.ArcError=Ðàñïàêîâùèê FreeArc âåðíóë êîä îøèáêè: %1 rus.ArcFail=Ðàñïàêîâêà íå çàâåðøåíà! rus.AllProgress=Îáùèé ïðîãðåññ ðàñïàêîâêè: %1%% rus.ArcBroken=Âîçìîæíî, àðõèâ %1 ïîâðåæä¸í%nèëè íåäîñòàòî÷íî ìåñòà íà äèñêå íàçíà÷åíèÿ. rus.Extracting=Ðàñïàêîâûâàåòñÿ: %1 rus.remains=%1%%, æäè %2 rus.LongTime=âå÷íî rus.ending=çàâåðøåíèå [Messages] DiskSpaceMBLabel=Òðåáóåòñÿ 10,0 Ãá ñâîáîäíîãî äèñêîâîãî ïðîñòðàíñòâà. [Files] Source: icon.ico; DestDir: {tmp}; Flags: dontcopy ;Source: C:\Overlord.arc; DestDir: {app}; Flags: nocompression Source: unarc.dll; DestDir: {tmp}; Flags: dontcopy deleteafterinstall Source: compiler:InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy [UninstallDelete] Type: filesandordirs; Name: {app} [Code] const Archives = '{src}\Overlord.arc'; // óêàæèòå ðàñïîëîæåíèå àðõèâîâ FreeArc; äëÿ âíåøíèõ ôàéëîâ ñòðîêó â [Files] äîáàâëÿòü íåîáÿçàòåëüíî PM_REMOVE = 1; CP_ACP = 0; CP_UTF8 = 65001; type #ifdef UNICODE ; åñëè ó âàñ îøèáêà íà ýòîé ñòðîêå, òî óñòàíîâèòå ïðåïðîöåññîð èëè èñïðàâüòå ñêðèïò äëÿ âàøåé âåðñèè Inno Setup #define A "W" #else #define A "A" ; òî÷êà âõîäà â SetWindowText, {#A} ìåíÿåòñÿ íà A èëè W â çàâèñèìîñòè îò âåðñèè PAnsiChar = PChar; // Required for Inno Setup 5.3.0 and higher. (òðåáóåòñÿ äëÿ Inno Setup âåðñèè 5.3.0 è íèæå) #endif #if Ver < 84018176 AnsiString = String; // There is no need for this line in Inno Setup 5.2.4 and below (äëÿ Inno Setup âåðñèé 5.2.4 è âûøå ýòà ñòðîêà íå íóæíà) #endif TMyMsg = record hwnd: HWND; message: UINT; wParam: Longint; lParam: Longint; time: DWORD; pt: TPoint; end; TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer; TArc = record Path: string; Size: Extended; end; var ProgressBar: TNewProgressBar; ExtractFile: TNewStaticText; lblExtractFileName: TLabel; btnCancelUnpacking: TButton; CancelCode, n, UnPackError, StartInstall: Integer; Arcs: array of TArc; msgError: string; m: Extended; Function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: string; cbMultiByte: integer; lpWideCharStr: string; cchWideChar: integer): longint; external 'MultiByteToWideChar@kernel32.dll stdcall'; Function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD; lpWideCharStr: string; cchWideChar: integer; lpMultiByteStr: string; cbMultiByte: integer; lpDefaultChar: integer; lpUsedDefaultChar: integer): longint; external 'WideCharToMultiByte@kernel32.dll stdcall'; function PeekMessage(var lpMsg: TMyMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall'; function TranslateMessage(const lpMsg: TMyMsg): BOOL; external 'TranslateMessage@user32.dll stdcall'; function DispatchMessage(const lpMsg: TMyMsg): Longint; external 'DispatchMessageA@user32.dll stdcall'; Function OemToChar(lpszSrc, lpszDst: AnsiString): longint; external 'OemToCharA@user32.dll stdcall'; function GetWindowLong(hWnd, nIndex: Integer): Longint; external 'GetWindowLongA@user32 stdcall delayload'; function SetWindowText(hWnd: Longint; lpString: String): Longint; external 'SetWindowText{#A}@user32 stdcall delayload'; function GetTickCount: DWord; external 'GetTickCount@kernel32'; function WrapFreeArcCallback (callback: TFreeArcCallback; paramcount: integer):longword; external 'wrapcallback@files:innocallback.dll stdcall'; function FreeArcExtract (callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; external 'FreeArcExtract@files:unarc.dll cdecl'; procedure AppProcessMessage; var Msg: TMyMsg; begin while PeekMessage(Msg, WizardForm.Handle, 0, 0, PM_REMOVE) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; Function NumToStr(Float: Extended): String; {Ïåðåâîä ÷èñëà â ñòðîêó ñ òî÷íîñòüþ 3 çíàêà (%.3n) ñ îêðóãëåíèåì äðîáíîé ÷àñòè, åñëè îíà åñòü} Begin Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.'); while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Length(Result) > 1) do SetLength(Result, Length(Result)-1); End; function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') 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; // OnClick event function for btnCancel procedure btnCancelUnpackingOnClick(Sender: TObject); begin if MsgBox( SetupMessage( msgExitSetupMessage ), mbInformation, MB_YESNO ) = IDYES then CancelCode:= -127; end; // Scans the specified folders for archives and add them to list function FindArcs(dir: string): Extended; var FSR: TFindRec; Begin if FindFirst(ExpandConstant(dir), FSR) then try repeat // Skip everything but the folders if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE; n:= GetArrayLength(Arcs); // Expand the folder list SetArrayLength(Arcs, n +1); Arcs[n].Path:= ExtractFilePath(ExpandConstant(Archives)) + FSR.Name; Arcs[n].Size:= Size64(FSR.SizeHigh, FSR.SizeLow); Result:= Result + Arcs[n].Size; until not FindNext(FSR); finally FindClose(FSR); end; End; // Converts OEM encoded string into ANSI // Ïðåîáðàçóåò OEM ñòðîêó â ANSI êîäèðîâêó function OemToAnsiStr( strSource: AnsiString): AnsiString; var nRet : longint; begin SetLength( Result, Length( strSource ) ); nRet:= OemToChar( strSource, Result ); end; // Converts ANSI encoded string into UTF-8 // Ïðåîáðàçóåò ñòðîêó èç ANSI â UTF-8 êîäèðîâêó function AnsiToUtf8( strSource: string ): string; var nRet : integer; WideCharBuf: string; MultiByteBuf: string; begin strSource:= strSource + chr(0); SetLength( WideCharBuf, Length( strSource ) * 2 ); SetLength( MultiByteBuf, Length( strSource ) * 2 ); nRet:= MultiByteToWideChar( CP_ACP, 0, strSource, -1, WideCharBuf, Length(WideCharBuf) ); nRet:= WideCharToMultiByte( CP_UTF8, 0, WideCharBuf, -1, MultiByteBuf, Length(MultiByteBuf), 0, 0); Result:= MultiByteBuf; end; // Sets the TaskBar title Procedure SetTaskBarTitle(Title: String); var h: Integer; Begin h:= GetWindowLong(MainForm.Handle, -8); if h <> 0 then SetWindowText(h, Title); End; // Converts milliseconds to standart time Function TicksToTime(Ticks: DWord; detail: Boolean): String; Begin {ìèëèñåêóíäû â ñòàíäàðòíîå âðåìÿ} if detail or (Ticks/3600 >= 1000) {hour} then if Ticks/3600000 > 23 then Result:= cm('LongTime') else 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/60 < 1000 {min} then Result:= IntToStr(Ticks/1000) +'.'+ NumToStr(trunc((Ticks/1000 - trunc(Ticks/1000))*10)) +'s' else Result:= IntToStr(Ticks/60000) +'m '+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2) +'s'; End; // The main callback function for unpacking FreeArc archives function FreeArcCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer; var percents, Elapsed: Integer; begin if string(what)='filename' then // Update FileName label lblExtractFileName.Caption:= FmtMessage( cm( 'Extracting' ), [OemToAnsiStr( str )] ) else if (string(what)='progress') and (sizeArc>0) then // Update progress bar with additional info with WizardForm.ProgressGauge do begin // Calculate current percents percents:= (Mb*1000) div sizeArc; ProgressBar.Position:= percents; ExtractFile.Caption:= FmtMessage(cm('ArcInfo'), [IntToStr(Mb), IntToStr(sizeArc), Format('%.1n', [Abs(percents/10)]), IntToStr(n+1), IntToStr(GetArrayLength(Arcs)) ]); Position:= Tag + round(ProgressBar.Position * m) percents:= (Position-Min)/((Max - Min)/1000) WizardForm.FileNameLabel.Caption:= FmtMessage(cm('AllProgress'), [Format('%.1n', [Abs(percents/10)])]); if position > 0 then Elapsed:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position)) else Elapsed:= 0; // Update the taskbar title if Elapsed = 0 then SetTaskBarTitle(cm('ending')) else SetTaskBarTitle(FmtMessage(cm('remains'), [IntToStr(percents/10), TicksToTime(Elapsed, false)])); end; AppProcessMessage; Result:= CancelCode; end; // Extracts all found archives function UnPack(Archives: string): Integer; var allSize: Extended; callback: longword; FreeMB, TotalMB: Cardinal; begin // Show the 'Cancel unpacking' button and set it as default button btnCancelUnpacking.Show; WizardForm.ActiveControl:= btnCancelUnpacking; WizardForm.ProgressGauge.Position:= 0; WizardForm.ProgressGauge.Max:= 1000; // Get the size of all archives allSize:= FindArcs(Archives); for n:= 0 to GetArrayLength(Arcs) -1 do begin m:= Arcs[n].Size/allSize; // Size of the current archive (îáú¸ì òåêóùåãî àðõèâà) WizardForm.ProgressGauge.Tag:= WizardForm.ProgressGauge.Position; CancelCode:= 0; AppProcessMessage; callback:= WrapFreeArcCallback(@FreeArcCallback,4); //FreeArcCallback has 4 arguments try // Pass the specified arguments to 'unarc.dll' Result:= FreeArcExtract (callback, 'x', '-o+', '-dp' + AnsiToUtf8( ExpandConstant('{app}') ), '--', Arcs[n].Path, '', '', '', '', ''); if Result = 0 then Result:= CancelCode; except Result:= -63; // ArcFail end; // Error occured if Result <> 0 then begin msgError:= FmtMessage(cm('ArcError'), [IntToStr(Result)]); GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')), True, FreeMB, TotalMB); case Result of -1: if FreeMB < 32 {Ìá íà äèñêå} then msgError:= SetupMessage(msgDiskSpaceWarningTitle) else msgError:= msgError + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Arcs[n].Path)]); -127: msgError:= cm('ArcBreak'); //Cancel button -63: msgError:= cm('ArcFail'); end; // MsgBox(msgError, mbInformation, MB_OK); //ñîîáùåíèå ïîêàçûâàåòñÿ íà ñòðàíèöå çàâåðøåíèÿ Log(msgError); Break; //ïðåðâàòü öèêë ðàñïàêîâêè end; end; // Hide the button btnCancelUnpacking.visible:= false; end; procedure CurStepChanged2(CurStep: TSetupStep); begin if CurStep = ssInstall then StartInstall:= GetTickCount; {âðåìÿ íà÷àëà ðàñïàêîâêè} if CurStep = ssPostInstall then begin UnPackError:= UnPack(Archives) if UnPackError = 0 then SetTaskBarTitle(SetupMessage(msgSetupAppTitle)) else begin // Error occured, uninstall it then Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); //îòêàò óñòàíîâêè èç-çà îøèáêè unarc.dll SetTaskBarTitle(SetupMessage(msgErrorTitle)) WizardForm.Caption:= SetupMessage(msgErrorTitle) +' — '+ cm('ArcBreak') end; end; end; // ñòàíäàðòíûé ñïîñîá îòêàòà (íå íóæíà CurPageChanged2), íî àðõèâû ðàñïàêîâûâàþòñÿ äî èçâëå÷åíèÿ ôàéëîâ èíñòàëëÿòîðà // if CurStep = ssInstall then // if UnPack(Archives) <> 0 then Abort; Procedure CurPageChanged2(CurPageID: Integer); Begin if (CurPageID = wpFinished) and (UnPackError <> 0) then begin // ðàñïàêîâùèê âåðíóë îøèáêó WizardForm.FinishedLabel.Font.Color:= $0000C0; //êðàñíûé WizardForm.FinishedLabel.Height:= WizardForm.FinishedLabel.Height * 2; WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) + #13#10#13#10 + msgError; end; End; procedure InitializeWizard2(); begin ProgressBar:= TNewProgressBar.Create(WizardForm); ExtractFile:=TNewStaticText.Create(WizardForm); lblExtractFileName:= TLabel.Create( WizardForm ); with WizardForm.ProgressGauge do begin // Create a label to show current FileName being extracted lblExtractFileName.parent:=WizardForm.InstallingPage; lblExtractFileName.autosize:=false; lblExtractFileName.Width:= Width; lblExtractFileName.top:=Top + ScaleY(35); lblExtractFileName.Caption:= ''; // Create a label to show percentage ExtractFile.parent:=WizardForm.InstallingPage; ExtractFile.autosize:=false; ExtractFile.Width:= Width; ExtractFile.top:=lblExtractFileName.Top + ScaleY(16); ExtractFile.caption:=cm('ArcTitle'); // Create a separate progress bar ProgressBar.SetBounds(Left, ExtractFile.Top + ScaleY(16), Width, Height); ProgressBar.Parent:= WizardForm.InstallingPage; ProgressBar.max:= 1000; ProgressBar.Position:= 0; end; // Create a 'Cancel unpacking' button and hide it for now. btnCancelUnpacking:=TButton.create(WizardForm); btnCancelUnpacking.Parent:= WizardForm; btnCancelUnpacking.SetBounds(260, WizardForm.cancelbutton.top, 135, WizardForm.cancelbutton.Height); btnCancelUnpacking.OnClick:= @btnCancelUnpackingOnClick; btnCancelUnpacking.Caption:= cm('ArcCancel'); btnCancelUnpacking.Hide; end; Procedure InitializeWizard(); begin with WizardForm do begin Position:=poScreenCenter ClientWidth:=690 ClientHeight:=496 Font.Color:=clWindow Font.Name:='MS Sans Serif' Font.Style:=[] with Bevel do begin Left:=0 Top:=313 Width:=497 Height:=3 Visible:=False end with CancelButton do begin Left:=600 Top:=462 Width:=77 Height:=25 BringToFront end with NextButton do begin Left:=500 Top:=462 Width:=77 Height:=25 BringToFront end with BackButton do begin Left:=206 Top:=462 Width:=77 Height:=25 BringToFront end with OuterNotebook do begin Left:=0 Top:=0 Width:=690 Height:=496 with WelcomePage do begin Color:=11232829 with WizardBitmapImage do begin Left:=0 Top:=0 Width:=690 Height:=496 end with WelcomeLabel2 do begin Left:=205 Top:=230 Width:=465 Height:=100 //ïåðâîå îêíî end with WelcomeLabel1 do begin Left:=205 Top:=190 Width:=465 Height:=28 Font.Color:=clWindow Font.Size:=8 end end with InnerPage do begin with Bevel1 do begin Left:=0 Top:=58 Width:=499 Height:=3 Visible:=False end with InnerNotebook do begin Left:=205 Top:=79 Width:=465 Height:=354 BringToFront Color:=11232829 // âòîðîå îêíî(ïóòü óñòàíîâêè) with LicensePage do begin with LicenseNotAcceptedRadio do begin Left:=0 Top:=338 Width:=465 Height:=17 Checked:=True end with LicenseAcceptedRadio do begin Left:=0 Top:=130 Width:=465 Height:=17 end with LicenseMemo do begin Left:=0 Top:=38 Width:=465 Height:=266 ReadOnly:=True ScrollBars:=ssVertical end with LicenseLabel1 do begin Left:=0 Top:=0 Width:=465 Height:=28 end end with PasswordPage do begin with PasswordEdit do begin Left:=0 Top:=50 Width:=465 Height:=21 Font.Color:=clWindowText end with PasswordEditLabel do begin Left:=0 Top:=34 Width:=465 Height:=14 end with PasswordLabel do begin Left:=0 Top:=0 Width:=465 Height:=28 end end with InfoBeforePage do begin with InfoBeforeMemo do begin Left:=0 Top:=24 Width:=465 Height:=327 ScrollBars:=ssVertical end with InfoBeforeClickLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end with UserInfoPage do begin with UserInfoSerialEdit do begin Left:=0 Top:=120 Width:=465 Height:=21 Font.Color:=clWindowText end with UserInfoSerialLabel do begin Left:=0 Top:=104 Width:=465 Height:=14 end with UserInfoOrgEdit do begin Left:=0 Top:=68 Width:=465 Height:=21 Font.Color:=clWindowText end with UserInfoOrgLabel do begin Left:=0 Top:=52 Width:=465 Height:=14 end with UserInfoNameEdit do begin Left:=0 Top:=16 Width:=465 Height:=21 Font.Color:=clWindowText end with UserInfoNameLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end with SelectDirPage do begin with SelectDirBitmapImage do begin Left:=0 Top:=0 Width:=32 Height:=32 Visible:=False end with DiskSpaceLabel do begin Left:=0 Top:=340 Width:=465 Height:=14 end with DirBrowseButton do begin Left:=388 Top:=288 Width:=77 Height:=25 end with DirEdit do begin Left:=0 Top:=290 Width:=378 Height:=21 Font.Color:=clWindowText end with SelectDirBrowseLabel do begin Left:=0 Top:=24 Width:=465 Height:=28 end with SelectDirLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end with SelectComponentsPage do begin with ComponentsDiskSpaceLabel do begin Left:=0 Top:=340 Width:=417 Height:=14 end with ComponentsList do begin Left:=0 Top:=48 Width:=465 Height:=275 Font.Color:=clWindow Color:=11232829 end with TypesCombo do begin Left:=0 Top:=24 Width:=465 Height:=21 Font.Color:=clWindow Color:=11232829 end with SelectComponentsLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end with SelectProgramGroupPage do begin with SelectGroupBitmapImage do begin Left:=0 Top:=0 Width:=32 Height:=32 Visible:=False end with NoIconsCheck do begin Left:=0 Top:=337 Width:=465 Height:=17 end with GroupBrowseButton do begin Left:=388 Top:=288 Width:=77 Height:=25 end with GroupEdit do begin Left:=0 Top:=290 Width:=378 Height:=21 Font.Color:=clWindowText end with SelectStartMenuFolderBrowseLabel do begin Left:=0 Top:=24 Width:=465 Height:=28 end with SelectStartMenuFolderLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end with SelectTasksPage do begin with TasksList do begin Left:=0 Top:=34 Width:=465 Height:=317 Color:=11232829 end with SelectTasksLabel do begin Left:=0 Top:=0 Width:=465 Height:=28 end end with ReadyPage do begin with ReadyMemo do begin Left:=0 Top:=34 Width:=465 Height:=317 Color:=11232829 end with ReadyLabel do begin Left:=0 Top:=0 Width:=465 Height:=28 end end with PreparingPage do begin with PreparingErrorBitmapImage do begin Left:=0 Top:=0 Width:=16 Height:=16 Visible:=False end with PreparingLabel do begin Left:=24 Top:=0 Width:=393 Height:=14 Visible:=False end end with InstallingPage do begin with FilenameLabel do begin Left:=0 Top:=16 Width:=465 Height:=16 end with StatusLabel do begin Left:=0 Top:=0 Width:=465 Height:=16 end with ProgressGauge do begin Left:=0 Top:=42 Width:=465 Height:=21 Min:=0 Max:=100 end end with InfoAfterPage do begin with InfoAfterMemo do begin Left:=0 Top:=24 Width:=465 Height:=327 ScrollBars:=ssVertical end with InfoAfterClickLabel do begin Left:=0 Top:=0 Width:=465 Height:=14 end end end with MainPanel do begin Left:=0 Top:=0 Width:=690 Height:=496 Color:=clWindow with WizardSmallBitmapImage do begin Left:=0 Top:=0 Width:=690 Height:=496 BackColor:=clWindow end with PageDescriptionLabel do begin Left:=25 Top:=25 Width:=500 Height:=14 Color:=6697728 Font.Color:=clWindow end with PageNameLabel do begin Left:=15 Top:=7 Width:=500 Height:=14 Color:=6697728 Font.Color:=clWindow end end end with FinishedPage do begin Color:=11232829 with WizardBitmapImage2 do begin Left:=0 Top:=0 Width:=690 Height:=496 end with NoRadio do begin Left:=205 Top:=227 Width:=465 Height:=17 end with YesRadio do begin Left:=205 Top:=199 Width:=465 Height:=17 end with RunList do begin Left:=205 Top:=199 Width:=465 Height:=149 BorderStyle:=bsNone end with FinishedLabel do begin Left:=205 Top:=119 Width:=465 Height:=53 end with FinishedHeadingLabel do begin Left:=205 Top:=79 Width:=465 Height:=24 Font.Color:=clWindow Font.Size:=8 end end end with BeveledLabel do begin Left:=10 Top:=468 Width:=150 Height:=14 Enabled:=False Color:=14405068 end end end; function ShowWindow(hWnd, nCmdShow: LongWord): LongWord; external 'ShowWindow@user32.dll stdcall'; Procedure BackgroundOnActivate(Sender: TObject); Begin if WizardForm.Visible then WizardForm.Show End; Procedure InitializeWizard4; var BackgroundForm: TForm; BackgroundImage: TBitmapImage; Begin BackgroundForm:= TForm.Create(nil) BackgroundForm.BorderStyle:= bsNone BackgroundForm.OnActivate:= @BackgroundOnActivate; ShowWindow(BackgroundForm.Handle, sw_ShowMaximized) // ôîíîâîå îêíî íà ïîëíûé ýêðàí BackgroundImage:= TBitmapImage.Create(BackgroundForm) BackgroundImage.Align:= alClient BackgroundImage.Stretch:= True ExtractTemporaryFile('BackgroundImage.bmp') BackgroundImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\BackgroundImage.bmp')) BackgroundImage.Parent:= BackgroundForm end; const NeedSize = 3700; var NeedSpaceLabel,FreeSpaceLabel: TLabel; FreeMB, TotalMB: Cardinal; Comp1,Comp2: TCheckBox; procedure GetFreeSpaceCaption(Sender: TObject); var Path: String; begin Path := ExtractFileDrive(WizardForm.DirEdit.Text); GetSpaceOnDisk(Path, True, FreeMB, TotalMB); if FreeMB > 1024 then FreeSpaceLabel.Caption := 'Ñâîáîäíî íà âûáðàííîì äèñêå: ' + FloatToStr(round(FreeMB/1024*100)/100) + ' GB' else FreeSpaceLabel.Caption := 'Ñâîáîäíî íà âûáðàííîì äèñêå: ' + IntToStr(FreeMB)+ ' MB'; begin if FreeMB < NeedSize then begin WizardForm.NextButton.Enabled:=false; end else WizardForm.NextButton.Enabled:=true; end; end; procedure InitializeWizard5(); begin WizardForm.DiskSpaceLabel.Hide; NeedSpaceLabel := TLabel.Create(WizardForm); with NeedSpaceLabel do begin Parent := WizardForm.SelectDirPage; Left := ScaleX(0); Top := ScaleY(198); Width := ScaleX(209); Height := ScaleY(13); Caption := 'Òðåáóåòñÿ äëÿ óñòàíîâêè: xxx GB'; end; FreeSpaceLabel := TLabel.Create(WizardForm); with FreeSpaceLabel do begin Parent := WizardForm.SelectDirPage; Left := ScaleX(0); Top := ScaleY(216); Width := ScaleX(209); Height := ScaleY(13); end; Comp2 := TCheckBox.Create(WizardForm); with Comp2 do begin Parent := WizardForm.SelectDirPage; Caption := '1'; Left := ScaleX(0); Top := ScaleY(136); Width := ScaleX(97); Height := ScaleY(17); TabOrder := 1; end; Comp1 := TCheckBox.Create(WizardForm); with Comp1 do begin Parent := WizardForm.SelectDirPage; Caption := '2'; Left := ScaleX(0); Top := ScaleY(160); Width := ScaleX(97); Height := ScaleY(17); TabOrder := 0; end; WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption; WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0; end; procedure CurPageChanged5(CurPageID: Integer); begin if CurPageID = wpSelectDir then if FreeMB < NeedSize then begin WizardForm.NextButton.Enabled:=False end; end; | Всего записей: 102 | Зарегистр. 07-07-2009 | Отправлено: 01:20 09-07-2009 | Исправлено: ALTAIR_OC, 01:49 09-07-2009 |
|