PDA

Показать полную графическую версию : [архив] Inno Setup .:[все вопросы]:.


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 [46] 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

Krekerpro
09-06-2009, 23:05
Есть у кого нибудь get_hw_caps.dll?
При попытки скомпилировать выдаёт следующие http://clip2net.com/clip/m0/1244574459-clip-30kb.png ,я так пологая что надо что то дописать?

Konstantin_555
09-06-2009, 23:12
Цитата Konstantin_555:
Как при удалении сделать подобное диалоговое окно? (Т.е. возможность выбора удаляемых компонентов) »
Если необходим выбор удаляемых компонентов, то придётся рисовать новую форму, а уже в ней указывать компоненты. Просто насколько знаю, в сообщении нельзя нарисовать чебоксы... »
Где в Inno Setup рисуется новая форма, можешь подсказать?

Serega
09-06-2009, 23:17
При попытки скомпилировать выдаёт »
В самом начале скрипта, запишите:
#define TIME_FOR_VIEW 5

Где в Inno Setup рисуется новая форма »
В секции кода... :) Я просто не знаю, как можно объяснить, так сказать, на пальцах...

Raf-9600
09-06-2009, 23:23
Есть у кого нибудь get_hw_caps.dll? »
http://narod.ru/disk/9309585000/dll.rar.html

Krekerpro
09-06-2009, 23:24
Serega,
Опять ему чтот не нравится http://clip2net.com/clip/m0/1244575423-clip-34kb.png :(

Konstantin_555
09-06-2009, 23:37
Цитата Konstantin_555:Где в Inno Setup рисуется новая форма »
В секции кода... Я просто не знаю, как можно объяснить, так сказать, на пальцах... »
А есть где-то ссылка на подробное описание создания форм? Не найду в гугле..

Serega
09-06-2009, 23:55
Опять ему чтот не нравится »
Ух, какой он у вас привередливый... :)
Попробуйте закомментировать эту строку, должно помочь.

А есть где-то ссылка на подробное описание создания форм? »
Подробное описание вы не найдёте. Есть коротко написаное описание, в Справке к Inno. Есть пример, в папке Examples, название скрипта не помню. Вот, как-то делал форму авторан:
[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=lzma/ultra
InternalCompressLevel=ultra
SolidCompression=yes

[Files]
Source: AutoRun.bmp; Flags: dontcopy

[Code]
var
AutoRun: TSetupForm;
img1: TBitmapImage;
btn, btn1: TButton;
btn2: TButton;
btn3: TButton;
btn4: TButton;
btn5: TButton;
btn6: TButton;
btn7: TButton;
btn8: TButton;
i, t: integer;

procedure btn7Click(Sender: TObject);
begin
btn7.Height:= 21;
btn7.Width:= 21;
btn7.Top:= 325;
btn7.Font.Style := [fsBold];
btn8.Height:= 23;
btn8.Width:= 23;
btn8.Top:= 324;
btn8.Font.Style := [];
end;

procedure btn8Click(Sender: TObject);
begin
btn7.Height:= 23;
btn7.Width:= 23;
btn7.Top:= 324;
btn7.Font.Style := [];
btn8.Height:= 21;
btn8.Width:= 21;
btn8.Top:= 325;
btn8.Font.Style := [fsBold];
end;


procedure CreateAutoRun;
begin
//AutoRun
AutoRun := CreateCustomForm;
with AutoRun do begin
Left := 498;
Top := 75;
Width := 586;
Height := 386;
BorderIcons := [];
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
Position := poScreenCenter;
end;
//img1
img1 := TBitmapImage.Create(AutoRun);
ExtractTemporaryFile('AutoRun.bmp');
with img1 do begin
Parent := AutoRun;
Left := 10;
Top := 10;
Width := 220;
Height := 335;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\AutoRun.bmp'));
end;
//btn1
btn1:= TButton.Create(AutoRun);
with btn1 do begin
Parent := AutoRun;
Left := 248;
Top := 15;
Width := 313;
Height := 22;
Caption:= 'Начать игру';
Cursor:= crHand;
end;
//btn2
btn2:= TButton.Create(AutoRun);
with btn2 do begin
Parent:= AutoRun;
Left := 248;
Top := 75;
Width := 313;
Height := 22;
Caption:= 'Установка';
Cursor:= crHand;
end;
//btn3
btn3:= TButton.Create(AutoRun);
with btn3 do begin
Parent:= AutoRun;
Left := 248;
Top := 135;
Width := 313;
Height := 22;
Caption:= 'Техническая поддержка';
Cursor:= crHand;
end;
//btn4
btn4:= TButton.Create(AutoRun);
with btn4 do begin
Parent:= AutoRun;
Left := 248;
Top := 195;
Width := 313;
Height := 22;
Caption:= 'Readme';
Cursor:= crHand;
end;
//btn5
btn5:= TButton.Create(AutoRun);
with btn5 do begin
Parent:= AutoRun;
Left := 248;
Top := 255;
Width := 313;
Height := 22;
Caption:= 'Веб-сайт';
Cursor:= crHand;
end;
//btn6
btn6:= TButton.Create(AutoRun);
with btn6 do begin
Parent:= AutoRun;
Left := 248;
Top := 315;
Width := 313;
Height := 22;
Caption:= 'Выход';
Cursor:= crHand;
ModalResult:= mrCancel;
end;
//btn7
btn7:= TButton.Create(AutoRun);
with btn7 do begin
Parent := AutoRun;
Left := 8;
Top := 324;
Width := 23;
Height := 23;
Cursor := crHand;
Caption := 'EN';
Font.Color := clWindowText;
Font.Height := -5;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 6;
OnClick := @btn7Click;
end;
//btn8
btn8:= TButton.Create(AutoRun);
with btn8 do begin
Parent := AutoRun;
Left := 31;
Top := 325;
Width := 21;
Height := 21;
Cursor := crHand;
Caption := 'RU';
Font.Color := clWindowText;
Font.Height := -5;
Font.Name := 'MS Sans Serif';
Font.Style := [fsBold];
ParentFont := False;
TabOrder := 6;
OnClick := @btn8Click;
end;
AutoRun.ShowModal;
end;

procedure InitializeWizard;
begin
CreateAutoRun;
end;

Krekerpro
10-06-2009, 00:08
Попробуйте закомментировать эту строку, должно помочь.
Эм,эт как? :blush2:

Serega
10-06-2009, 00:15
Krekerpro, покажите свой код. Ошибка говорит о том, что неизвестная переменная, а она должна задаваться в скрипте.

Krekerpro
10-06-2009, 00:33
Serega,
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl



[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
Source: compiler:get_hw_caps.dll; DestDir: {tmp}; Flags: dontcopy
Source: compiler:InnoCallback.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: C:\Program Files\Inno Setup 5\Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion
Source: D:\Program Files\Yamicsoft\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: C:\Documents and Settings\Admin\Мои документы\Мои рисунки\Безымянный3.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak
Source: C:\Documents and Settings\Admin\Мои документы\Мои рисунки\Безымянный.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy noencryption nocompression solidbreak


; NOTE: Don't use "Flags: ignoreversion" on any shared system files


[Icons]
Name: {group}\My Program; Filename: {app}\MyProg.exe
Name: {commondesktop}\My Program; Filename: {app}\MyProg.exe; Tasks: desktopicon

[Run]
Filename: {app}\MyProg.exe; Description: {cm:LaunchProgram,My Program}; Flags: nowait postinstall skipifsilent

[_Code]
var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
case currTime of
{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Безымянный3.bmp')) end;
2*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Безымянный.bmp')) end;

end;
if CurrTime = 9*{#TIME_FOR_VIEW} then CurrTime := -1;
end;


procedure InitializeWizard;
begin
ExtractTemporaryFile('Безымянный3.bmp');
ExtractTemporaryFile('Безымянный.bmp');


currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.FileNameLabel.Parent := WizardForm;
WizardForm.FileNameLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.FileNameLabel.Left := ScaleX(10);
WizardForm.FileNameLabel.Width := ScaleX(397);
WizardForm.FileNameLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_1.bmp'));
SplashImage.Hide;
end;

procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible:=false
WizardForm.PageDescriptionLabel.Visible:=false
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.FileNameLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled :=True
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(2)
end
else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end
If CurPageID=wpFinished then
end;
end;

procedure DeInitializeSetup();
begin
KillTimer(0, TimerID);
end;

Serega
10-06-2009, 00:48
Krekerpro, у меня с вашего примера, компилируется нормально.

Krekerpro
10-06-2009, 00:54
Serega,
А чем компилируете?

Serega
10-06-2009, 00:59
Krekerpro, у меня расширенная версия от Restools, но это не влияет на ваш скрипт. У вас ошибка, что неизвестный индетификатор, а он у вас задан в скрипте currTime: Integer;

P.S.
А вы исправили название секции с [_Code] на [Code]?

Krekerpro
10-06-2009, 01:32
Serega,
Да,исправил

Serega
10-06-2009, 12:49
Krekerpro, тогда действительно, попробуйте закоментировать, пример:
// currTime := 0;

Krekerpro
10-06-2009, 13:18
Serega,
Спасибо огромное,всё отлично работает :)

Krekerpro
10-06-2009, 14:19
Соедините кто нибудь пожалуйста [_code] var n: Integer; FreeMB, TotalMB: Cardinal; VolumeName, FileSystemName: String; VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint; ListBox: TListBox; StartMenuTreeView: TStartMenuFolderTreeView; const oneMB= 1024*1024; function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall'; function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall'; function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall'; function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall'; Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)} 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 CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов} Begin if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength) else Result:= String; End; Procedure GetDiskInfo(Disk: String); Begin FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256); GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31); FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки'; End; Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin ListBox.Items.Clear for n:= 1 to 31 do // диск 'А' пропустить if (GetLogicalDrives and (1 shl n)) > 0 then if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':'); for n:= 0 to ListBox.Items.Count -1 do begin Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление } if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path); if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10); if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String; ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end; End; var baseDisk, baseDir: string; Procedure ObjectOnClick(Sender: TObject); Begin Case TObject(Sender) of ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then if baseDisk = ListBox.Items[n][1] then WizardForm.DirEdit.Text:= baseDir else WizardForm.DirEdit.Text:= ListBox.Items[n][1] +':\'+ ExtractFileName(WizardForm.DirEdit.Text) StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}' WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end; end; End; Procedure CurPageChanged(CurPageID: Integer); Begin if CurPageID = wpSelectDir then ListBoxRefresh End; Procedure InitializeWizard; Begin ListBox:= TListBox.Create(WizardForm) ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12)) ListBox.Font.Size:= 9 ListBox.Font.Style:= [fsBold] ListBox.Font.Name:= 'Courier New'; ListBox.OnClick:= @ObjectOnClick; ListBox.Parent:= WizardForm.SelectDirPage; baseDir:= WizardForm.DirEdit.Text baseDisk:= WizardForm.DirEdit.Text[1] End;
И [_Code] var TimerID: LongWord; currTime: Integer; SplashImage: TBitmapImage; type TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord); function WrapTimerProc(callback:TProc; paramcount:integer):longword; external 'wrapcallback@files:InnoCallback.dll stdcall'; function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall'; function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall'; procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord); begin currTime := currTime + 1; case currTime of {#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_2.bmp')) end; 2*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_3.bmp')) end; 3*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_4.bmp')) end; 4*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_5.bmp')) end; 5*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_6.bmp')) end; 6*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_7.bmp')) end; 7*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_8.bmp')) end; 8*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_9.bmp')) end; 9*{#TIME_FOR_VIEW}: begin SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_10.bmp'))end; end; if CurrTime = 9*{#TIME_FOR_VIEW} then CurrTime := -1; end; procedure InitializeWizard; begin ExtractTemporaryFile('Image_1.bmp'); ExtractTemporaryFile('Image_2.bmp'); ExtractTemporaryFile('Image_3.bmp'); ExtractTemporaryFile('Image_4.bmp'); ExtractTemporaryFile('Image_5.bmp'); ExtractTemporaryFile('Image_6.bmp'); ExtractTemporaryFile('Image_7.bmp'); ExtractTemporaryFile('Image_8.bmp'); ExtractTemporaryFile('Image_9.bmp'); ExtractTemporaryFile('Image_10.bmp'); currTime := 0; WizardForm.ProgressGauge.Parent := WizardForm; WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12); WizardForm.ProgressGauge.Left := ScaleX(10); WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20); WizardForm.ProgressGauge.Height := 16; WizardForm.ProgressGauge.Hide; WizardForm.FileNameLabel.Parent := WizardForm; WizardForm.FileNameLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18); WizardForm.FileNameLabel.Left := ScaleX(10); WizardForm.FileNameLabel.Width := ScaleX(397); WizardForm.FileNameLabel.Hide; SplashImage := TBitmapImage.Create(WizardForm); SplashImage.Top := 0; SplashImage.Left := 0; SplashImage.Width := WizardForm.MainPanel.Width; SplashImage.Height := WizardForm.Bevel.Top; SplashImage.Parent := WizardForm.InnerPage; SplashImage.Stretch := True; SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_1.bmp')); SplashImage.Hide; end; procedure CurPageChanged(CurPageID: Integer); var pfunc: LongWord; begin if (CurPageID = wpInstalling) then begin pfunc := WrapTimerProc(@OnTimer, 5); TimerID := SetTimer(0, 0, 1000, pfunc); WizardForm.PageNameLabel.Visible:=false WizardForm.PageDescriptionLabel.Visible:=false WizardForm.InnerNotebook.Hide; WizardForm.Bevel1.Hide; WizardForm.MainPanel.Hide; WizardForm.PageNameLabel.Hide; WizardForm.PageDescriptionLabel.Hide; WizardForm.ProgressGauge.Show; WizardForm.FileNameLabel.Show; SplashImage.Show; WizardForm.CancelButton.Enabled :=True WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100) end else begin WizardForm.ProgressGauge.Hide; SplashImage.Hide; WizardForm.FileNameLabel.Hide; if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then begin WizardForm.InnerNotebook.Show; WizardForm.Bevel1.Show; WizardForm.MainPanel.Show; WizardForm.PageNameLabel.Show; WizardForm.PageDescriptionLabel.Show; end If CurPageID=wpFinished then end; end; procedure DeInitializeSetup(); begin KillTimer(0, TimerID); end;

Serega
10-06-2009, 20:15
Соедините кто нибудь пожалуйста »
Вы хоть сами то разберёте, что там написано? Используйте теги .

Serega
11-06-2009, 00:03
Соедините кто нибудь пожалуйста »
Ну такого, я ещё ни разу не видел, что весь код в одну строку...
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);

var
n: Integer;
FreeMB, TotalMB: Cardinal;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;
baseDisk, baseDir: string;

TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;

const
oneMB = 1024*1024;

function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint;
external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
external 'MessageBoxA@user32.dll stdcall';

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
case currTime of
{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_2.bmp'))
end;
2*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_3.bmp'))
end;
3*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_4.bmp'))
end;
4*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_5.bmp'))
end;
5*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_6.bmp'))
end;
6*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_7.bmp'))
end;
7*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_8.bmp'))
end;
8*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_9.bmp'))
end;
9*{#TIME_FOR_VIEW}:
begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_10.bmp'))
end;
end;
if CurrTime = 9*{#TIME_FOR_VIEW} then CurrTime := -1;
end;

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String;
{ Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
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 CutString(String: String; MaxLength: Longint): String;
{ Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then
Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength) else
Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32);
VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName);
VolumeName:= DelSp(VolumeName);
if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh;
var
FreeB, TotalB: Cardinal;
Path, String: string;
Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then
ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do
begin
Path:= Copy(ListBox.Items[n],1,2) +'\'
{ если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then
begin
GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then
String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else
String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then
begin
TotalB:= TotalMB;
FreeB:= FreeMB;
String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String
end else
String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String; ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9);
end;
end;
End;

Procedure ObjectOnClick(Sender: TObject);
Begin
Case TObject(Sender) of
ListBox:
for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then
if baseDisk = ListBox.Items[n][1] then
WizardForm.DirEdit.Text:= baseDir else
WizardForm.DirEdit.Text:= ListBox.Items[n][1] +':\'+ ExtractFileName(WizardForm.DirEdit.Text)
StartMenuTreeView:
if StartMenuTreeView.Directory <> '' then
WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else
WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck:
begin
WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled);
StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled;
WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled
end;
end;
End;

/////////////////////////////////////////////////////////////////////////
procedure InitializeWizard;
begin
ExtractTemporaryFile('Image_1.bmp');
ExtractTemporaryFile('Image_2.bmp');
ExtractTemporaryFile('Image_3.bmp');
ExtractTemporaryFile('Image_4.bmp');
ExtractTemporaryFile('Image_5.bmp');
ExtractTemporaryFile('Image_6.bmp');
ExtractTemporaryFile('Image_7.bmp');
ExtractTemporaryFile('Image_8.bmp');
ExtractTemporaryFile('Image_9.bmp');
ExtractTemporaryFile('Image_10.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY(12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;
WizardForm.FileNameLabel.Parent := WizardForm;
WizardForm.FileNameLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.FileNameLabel.Left := ScaleX(10);
WizardForm.FileNameLabel.Width := ScaleX(397);
WizardForm.FileNameLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_1.bmp'));
SplashImage.Hide;

ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= [fsBold]
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
baseDir:= WizardForm.DirEdit.Text
baseDisk:= WizardForm.DirEdit.Text[1]
end;

procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if CurPageID = wpSelectDir then ListBoxRefresh
if CurPageID = wpInstalling then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible:=false
WizardForm.PageDescriptionLabel.Visible:=false
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageDescriptionLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.FileNameLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled :=True
WizardForm.CancelButton.Top := WizardForm.Bevel.Top + ScaleY(100)
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageDescriptionLabel.Show;
end
If CurPageID=wpFinished then
end;
end;

procedure DeInitializeSetup();
begin
KillTimer(0, TimerID);
end;

Krekerpro
11-06-2009, 14:53
Ещё хотелось бы узнать как это реализовать http://clip2net.com/clip/m19309/1244717476-clip-32kb.png
И вот это http://clip2net.com/clip/m19309/1244717534-clip-22kb.png ,как я понимаю здесь используется фри арк,в процессах винды для установки используется unpack.dll




© OSzone.net 2001-2012