Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 3]
Dark_Delphin
05-10-2011, 23:20
Всем добрый вечер.
Какой скрипт нужно дописать что-бы картинка была на остальных страницах кроме первой и последней странице?
Заранее спасибо.
R.i.m.s.k.y.
06-10-2011, 08:06
я хренею, дорогая редакция
такой вопрос возникает каждую пятую страницу
ntrx, поиск вверху, и пиши нормально, от жирного шрифта сообщения никто не подорвется внезапно хелпать
GRiD555x
06-10-2011, 10:31
скажите какую строку убрать в скрипте при расспаковке там пишет,тестовый подсчёт времени,времени нету токо написанно тестовый подсчёт времени,какую строку надо убрать,и чтобы в конце не было в инсталяторе время установки тестовый подсчёт?самое главное что нету времени токо текст!!!
valyok666
06-10-2011, 10:41
GRiD555x,прикрути к инсталлу records.inf, и тогда там где будет указано время до окончания установки. ИЛИ на крайний случай ты можешь вручную расставить проценты для распаковки и тогда, у тебя опять же там будет написано время до окончания установки.
GRiD555x
06-10-2011, 10:43
records.inf »
Это тупо вписать к инсталятору Setup?
No4noylis
06-10-2011, 10:44
GRiD555x, :read:
Для осуществения работоспособности библиотеки существует 2 вида определения процентных соотношений между операциями на всем прогрессбаре:
Автоматическая расстановка процентных соотношений в операциях.
При автоматической расстановке необходим тестовый проход для определения времени выполнения каждой операции относительно других.
Для включения данного режима необходимо заполнить вторые значения всех функций извлечения архивов нулями.
Краткая инструкция:
а) первым делом убедитесь, что в начале скрипта закомментирована строка
#define records
(т.е. необходимо поставить точку с запятой в начале этой строки);
б) компилим проект и запускаем на установку. Это и будет нашим тестовым проходом. Все операции должны дойти до конца и завершиться удачно. Прогрессбар будет зашкаливать и все компоненты будут извлечены вне зависимости от того выбраны они, или нет. Все так и должно быть!
в) после тестового прогона в указанной папке создастся файл records.inf (имя и путь назначается в процедуре инициализации. О ней см. "подробное описание функций" ниже), его необходимо добавить в проект, раскомметировав, или добавив в начале скрипта строку:
#define records
Так же стоит отметить, что если сам скрипт находится в папке отличной от той, в которую компилится проект (например в скрипте NFS:Undercover откомпиленный файл сохраняется в Output\setup.exe), то records.inf создастся в папке с setup.exe и его необходимо будет перенести непосредственно к скрипту, или же подправить в секции [Files] его истинное расположение, например:
#ifdef records
Source: Output\records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
г) снова откомпилить проект.
После этого инсталлер готов к работе.
При запуске процесс выполнения операций будет равномерно и корректно отображаться на прогрессбаре.
Ручная расстановка процентов на каждую операцию.
При ручной расстановке если в проекте множество операций, все расчеты необходимо производить вручную. Т.е. сумма процентов всех выполненных операций должна равняться 100%, иначе корректного отображения на прогрессбаре не будет.
Для включения данного режима необходимо заполнить вторые значения всех функций извлечения архивов значениями процентов, отличными от 0 (числа могут быть дробными).
При групповой распаковке архивов по маске (типа *.pcf) для операции задается общий процент на все распаковываемые файлы данной командой, а уж каждый из найденных файлов будет разбивать указанный кусок прогрессбара еще на части пропорциональные размерам файлов. Например строка:
if not ISArcExtract (0, 100, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), false, '', '', '') then break;
...
распакует все *.arc архивы из {src} в {app}, при чем весь прогрессбар будет поделен на кусочки пропрорциональные размерам архивов. В общем тут все так же как в скрипте распаковки FreeArc.iss и ему подобным. Таким образом при распаковке нескольких архивов одного типа проще пользоваться ручной расстановкой, т.к. отличие расперделения процентов от автоматической будет совсем небольшим, но за то не требуется тестовый проход.
Вот некоторые правила, которые неоходимо выполнять при ручной расстановке:
а) сумма процентов учитывая ветвления (использование компонентов, условий) в скрипте должна составлять 100;
б) у компонентов, для которых возможен выбор только одного из нескольких, должны быть одинаковые значения процентов;
в) НЕЛЬЗЯ использовать компоненты, которые можно выбирать одновременно с другими в одной группе (например несколько рядом стоящих компонент без флага exclusive), потому что сумма процентов при различном выборе пользователя может отличаться от 100.
valyok666
06-10-2011, 10:46
GRiD555x, ну когда тестовый прогон сделан он автоматом всё расставил)
#define records
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
No4noylis, справка РулеЗ
GRiD555x
06-10-2011, 15:10
ну когда тестовый прогон сделан он автоматом всё расставил) »
Так спс,а как сделать чтобы в последнем завершающем окне не выскакивало окошко,время установки?
valyok666
06-10-2011, 15:16
GRiD555x, кинь сюда скрипт я тебе отключу
там лейбл убрать надо)
GRiD555x
06-10-2011, 15:22
valyok666,
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define NeedSize "5000000000"
#define NeedMem 512
#define SecondProgressBar
;#define records
;#define precomp04
;#define precomp038
;#define unrar
;#define exe
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C6C85FA9-2B92-4A34-A7E2-FDEBA2D04DF8}
AppName=TrackMania 2
AppVersion=ПКВШ
;AppVerName=TrackMania 2 ПКВШ
AppPublisher=TrackMania 2
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\TrackMania 2
DefaultGroupName=TrackMania 2
OutputDir=D:\устанв
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[CustomMessages]
rus.ExtractedFile=Извлекается файл:
rus.Extracted=Распаковка архивов...
rus.CancelButton=Отменить распаковку
rus.Error=Ошибка распаковки!
rus.ElapsedTime=Прошло:
rus.RemainingTime=Осталось времени:
rus.EstimatedTime=Всего:
rus.AllElapsedTime=Время установки:
[Files]
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
;Source: Include\arc.ini; DestDir: {tmp}; Flags: dontcopy
;Source: Include\srep.exe; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp04
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp04.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp038
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef exe
Source: "D:\GAME\TrackMania 2\ManiaPlanetLauncher.exe"; DestDir: "{app}"; Flags: ignoreversion
#endif
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\TrackMania 2"; Filename: "{app}\ManiaPlanetLauncher.exe"
Name: "{commondesktop}\TrackMania 2"; Filename: "{app}\ManiaPlanetLauncher.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\ManiaPlanetLauncher.exe"; Description: "{cm:LaunchProgram,TrackMania 2}"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
Type: filesandordirs; Name: {app}
[code ]
const
PCFonFLY=true;
notPCFonFLY=false;
var
LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
LabelPct2: TLabel;
ISDoneProgressBar2:TNewProgressBar;
#endif
MyCancelButton: TButton;
Cancel:integer;
MyError:boolean;
PCFVer:double;
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function WrapMyCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall';
function ISArcExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: BOOL ):BOOL; external 'ISArcExtract@files:ISDone.dll stdcall';
function IS7ZipExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):BOOL; external 'IS7zipExtract@files:ISDone.dll stdcall';
function ISRarExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):BOOL; external 'ISRarExtract@files:ISDone.dll stdcall';
function ISPrecompExtract(CurComponent:longword; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):BOOL; external 'ISPrecompExtract@files:ISDone.dll stdcall';
function ISSRepExtract(CurComponent:longword; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):BOOL; external 'ISSrepExtract@files:ISDone.dll stdcall';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):BOOL; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall';
function ISDoneInitialize(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:longword; PrecompVers: double; RecursiveSubDir:boolean; WinHandle, NeededMem:longint; callback:TCallback):BOOL; external 'ISDoneInitialize@files:ISDone.dll stdcall';
function ISDoneStop:BOOL; external 'ISDoneStop@files:ISDone.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
if CurrentPct<=1000 then
ISDoneProgressBar2.Position := CurrentPct;
LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
LabelCurrFileName.Caption:=MinimizePathName(ExpandConstant('{cm:ExtractedFile} ')+CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width);
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := Cancel;
end;
procedure CancelButtonOnClick(Sender: TObject);
begin
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then Cancel:=1;
end;
procedure HideComponents;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
LabelPct2.Hide;
#endif
end;
procedure ShowComponents;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar1.Width+ScaleX(5);
Top := ISDoneProgressBar1.Top + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do begin
Parent := WizardForm.InstallingPage;
Left := ScaleX(0);
Top := PBTop+ScaleY(8);
Width := ISDoneProgressBar1.Width;
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
end;
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar2.Width+ScaleX(5);
Top := ISDoneProgressBar2.Top + ScaleY(2);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
Left := ScaleX(0);
Top := PBTop + ScaleY(35);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := ISDoneProgressBar1.Width div 2;
Top := LabelTime1.Top;
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
AutoSize := False;
Width := 300;
Left := 180;
Top := 200;
end;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(135);
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(360);
Top:=WizardForm.cancelbutton.top;
OnClick:=@CancelButtonOnClick;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and MyError then
begin
LabelTime3.Hide;
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;
function CheckError:boolean;
begin
result:= not MyError;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:longword;
tmp:integer;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Hide;
ShowComponents;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
Cancel:=0;
// Распаковка всех необходимых файлов в папку {tmp}.
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
// ExtractTemporaryFile('arc.ini');
// ExtractTemporaryFile('srep.exe');
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp04
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp04.exe');
#endif
#ifdef precomp038
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef precomp04
PCFVer:=0.4;
#else
#ifdef precomp038
PCFVer:=0.38;
#else
PCFVer:=0;
#endif
#endif
repeat
MyError:=true;
if not ISDoneInitialize(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, PCFVer, false, MainForm.Handle, {#NeedMem}, @ProgressCallback) then break;
repeat
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
MyError:=false;
until true;
ISDoneStop;
until true;
HideComponents;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and MyError then begin
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, tmp);
end;
end;
valyok666
06-10-2011, 15:27
GRiD555x,
#define NeedSize "5000000000"
#define NeedMem 512
#define SecondProgressBar
;#define records
;#define precomp04
;#define precomp038
;#define unrar
;#define exe
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C6C85FA9-2B92-4A34-A7E2-FDEBA2D04DF8}
AppName=TrackMania 2
AppVersion=ПКВШ
;AppVerName=TrackMania 2 ПКВШ
AppPublisher=TrackMania 2
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\TrackMania 2
DefaultGroupName=TrackMania 2
OutputDir=D:\устанв
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[CustomMessages]
rus.ExtractedFile=Извлекается файл:
rus.Extracted=Распаковка архивов...
rus.CancelButton=Отменить распаковку
rus.Error=Ошибка распаковки!
rus.ElapsedTime=Прошло:
rus.RemainingTime=Осталось времени:
rus.EstimatedTime=Всего:
[Files]
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
;Source: Include\arc.ini; DestDir: {tmp}; Flags: dontcopy
;Source: Include\srep.exe; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp04
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp04.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp038
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\RTconsole.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef exe
Source: "D:\GAME\TrackMania 2\ManiaPlanetLauncher.exe"; DestDir: "{app}"; Flags: ignoreversion
#endif
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\TrackMania 2"; Filename: "{app}\ManiaPlanetLauncher.exe"
Name: "{commondesktop}\TrackMania 2"; Filename: "{app}\ManiaPlanetLauncher.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\ManiaPlanetLauncher.exe"; Description: "{cm:LaunchProgram,TrackMania 2}"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
Type: filesandordirs; Name: {app}
[code ]
const
PCFonFLY=true;
notPCFonFLY=false;
var
LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2: TLabel;
ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
LabelPct2: TLabel;
ISDoneProgressBar2:TNewProgressBar;
#endif
MyCancelButton: TButton;
Cancel:integer;
MyError:boolean;
PCFVer:double;
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function WrapMyCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall';
function ISArcExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: BOOL ):BOOL; external 'ISArcExtract@files:ISDone.dll stdcall';
function IS7ZipExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):BOOL; external 'IS7zipExtract@files:ISDone.dll stdcall';
function ISRarExtract(CurComponent:longword; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):BOOL; external 'ISRarExtract@files:ISDone.dll stdcall';
function ISPrecompExtract(CurComponent:longword; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):BOOL; external 'ISPrecompExtract@files:ISDone.dll stdcall';
function ISSRepExtract(CurComponent:longword; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):BOOL; external 'ISSrepExtract@files:ISDone.dll stdcall';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):BOOL; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall';
function ISDoneInitialize(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:longword; PrecompVers: double; RecursiveSubDir:boolean; WinHandle, NeededMem:longint; callback:TCallback):BOOL; external 'ISDoneInitialize@files:ISDone.dll stdcall';
function ISDoneStop:BOOL; external 'ISDoneStop@files:ISDone.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
if CurrentPct<=1000 then
ISDoneProgressBar2.Position := CurrentPct;
LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
LabelCurrFileName.Caption:=MinimizePathName(ExpandConstant('{cm:ExtractedFile} ')+CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width);
LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := Cancel;
end;
procedure CancelButtonOnClick(Sender: TObject);
begin
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then Cancel:=1;
end;
procedure HideComponents;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar1.Hide;
LabelPct1.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
#ifdef SecondProgressBar
ISDoneProgressBar2.Hide;
LabelPct2.Hide;
#endif
end;
procedure ShowComponents;
var PBTop:integer;
begin
PBTop:=ScaleY(50);
ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar1 do begin
Parent := WizardForm.InstallingPage;
Height := WizardForm.ProgressGauge.Height;
Left := ScaleX(0);
Top := PBTop;
Width := ScaleX(365);
Max := 1000;
end;
LabelPct1 := TLabel.Create(WizardForm);
with LabelPct1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar1.Width+ScaleX(5);
Top := ISDoneProgressBar1.Top + ScaleY(2);
Width := ScaleX(80);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width+ScaleX(30);
Left := ScaleX(0);
Top := ScaleY(30);
end;
#ifdef SecondProgressBar
PBTop:=PBTop+ScaleY(25);
ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar2 do begin
Parent := WizardForm.InstallingPage;
Left := ScaleX(0);
Top := PBTop+ScaleY(8);
Width := ISDoneProgressBar1.Width;
Max := 1000;
Height := WizardForm.ProgressGauge.Height;
end;
LabelPct2 := TLabel.Create(WizardForm);
with LabelPct2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Left := ISDoneProgressBar2.Width+ScaleX(5);
Top := ISDoneProgressBar2.Top + ScaleY(2);
Width := ScaleX(80);
end;
#endif
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := ISDoneProgressBar1.Width div 2;
Left := ScaleX(0);
Top := PBTop + ScaleY(35);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
Width := LabelTime1.Width+ScaleX(40);
Left := ISDoneProgressBar1.Width div 2;
Top := LabelTime1.Top;
end;
MyCancelButton:=TButton.Create(WizardForm);
with MyCancelButton do begin
Parent:=WizardForm;
Width:=ScaleX(135);
Caption:=ExpandConstant('{cm:CancelButton}');
Left:=ScaleX(360);
Top:=WizardForm.cancelbutton.top;
OnClick:=@CancelButtonOnClick;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and MyError then
begin
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;
function CheckError:boolean;
begin
result:= not MyError;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:longword;
tmp:integer;
begin
if CurStep = ssInstall then begin //Если необходимо, можно поменять на ssPostInstall
WizardForm.ProgressGauge.Hide;
WizardForm.CancelButton.Hide;
ShowComponents;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
Cancel:=0;
// Распаковка всех необходимых файлов в папку {tmp}.
ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
// ExtractTemporaryFile('arc.ini');
// ExtractTemporaryFile('srep.exe');
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp04
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp04.exe');
#endif
#ifdef precomp038
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('RTconsole.exe');
ExtractTemporaryFile('precomp038.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef unrar
ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef precomp04
PCFVer:=0.4;
#else
#ifdef precomp038
PCFVer:=0.38;
#else
PCFVer:=0;
#endif
#endif
repeat
MyError:=true;
if not ISDoneInitialize(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, PCFVer, false, MainForm.Handle, {#NeedMem}, @ProgressCallback) then break;
repeat
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
MyError:=false;
until true;
ISDoneStop;
until true;
HideComponents;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and MyError then begin
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, tmp);
end;
end;
терь норм должно быть
GRiD555x
06-10-2011, 15:29
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked »
ты эти строки добавил?
valyok666
06-10-2011, 15:30
GRiD555x, я скопировал то что ты написал и убрал то что не нужно
остальное я не трогал
GRiD555x
06-10-2011, 15:44
Так ещё вопрос,как сделать чтобы было в установке обновить DirectX?
valyok666
06-10-2011, 15:54
GRiD555x,
[Setup]
ShowTasksTreeLines=true
[Tasks]
Name: Redist; Description: Дополнительное программное обеспечение:;
Name: Redist\directx; Description: Обновить Microsoft DirectX; Flags: unchecked;
[Run]
Filename: {src}\Redist\DirectX\DXSETUP.exe; WorkingDir: {src}\Redist\DirectX\; Parameters: /silent; Tasks: Redist\directx; Flags: waituntilterminated;
у кого есть примеры работы с ботвой?кроме стандартных
GRiD555x
06-10-2011, 16:25
А вот можно скрипт примерно на токо установочник http://lostpic.net/images/20765b55d24c60676c1116004d6ee18e.jpg ?
Доброго времени суток!
При попытке обратиться к dll
[*CODE]
function getListDevices(size: Integer):integer;
external 'getListDevices@MyPcapDLL.dll stdcall';
выдает такую ошибку:
Runtime Error (at -1:0):
Сannot Import dll:MyPcapDLL.dll.
Из за чего это может быть?
valyok666
06-10-2011, 17:03
Gugle,
[*CODE]
function getListDevices(size: Integer):integer;
external 'getListDevices@MyPcapDLL.dll stdcall';
ты со звёздочкой пишешь?
Raf-9600
06-10-2011, 17:23
Ктонить может объединить эти коды?
Отображение информации о винчестерах: var
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;
procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;
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;
Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(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
NeedSize := 78; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
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:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;
Установка в D:\Games function GetLogicalDrives: DWORD; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(lpRootPathName: PChar): Cardinal; external 'GetDriveTypeA@kernel32.dll stdcall';
const
DRIVE_FIXED = 3;
function NoSD(s: string): string;
var
x, bit, i: Integer;
tp: Cardinal;
sd: string;
begin
sd:= ExpandConstant('{sd}');
Result:= sd;
// Вызываем функцию WinAPI
// Функция возвращает битовую маску установленных логических дисков.
// Бит 0 определяет наличие диска А:, бит 1 - диска B и т.д.
x:= GetLogicalDrives;
if x <> 0 then
// цикл по полученным битам переменной X
for i:= 1 to 64 do
begin
// Накладываем битовую маску для выделения бита с поряковым номером 0
bit:= x and 1;
// нашли логический диск...
if bit = 1 then
begin
// определяем тип логического диска
tp:= GetDriveType(PChar(Chr(64 + i) + ':'));
if tp = DRIVE_FIXED then
// если диск не является системным
if Chr(64 + i) <> Copy(sd, 1, 1) then
begin
Result:= Chr(64 + i) + ':';
Break;
end;
end;
// побитовый сдвиг вправо
x:= x shr 1;
end;
end;
valyok666
06-10-2011, 17:38
Raf-9600,
const
DRIVE_FIXED = 3;
var
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;
procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Òðåáóåòñÿ êàê ìèíèìóì '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Ãá ñâîáîäíîãî äèñêîâîãî ïðîñòðàíñòâà.' else
NeedSpaceLabel.Caption := 'Òðåáóåòñÿ êàê ìèíèìóì '+ IntToStr(NeedSize)+ ' Ìá ñâîáîäíîãî äèñêîâîãî ïðîñòðàíñòâà.';end;
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;
Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(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
NeedSize := 78; //Çäåñü óêàçûâàåòñÿ ìåñòî äëÿ ïðèëîæåíèÿ
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
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:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;
function NoSD(s: string): string;
var
x, bit, i: Integer;
tp: Cardinal;
sd: string;
begin
sd:= ExpandConstant('{sd}');
Result:= sd;
// Âûçûâàåì ôóíêöèþ WinAPI
// Ôóíêöèÿ âîçâðàùàåò áèòîâóþ ìàñêó óñòàíîâëåííûõ ëîãè÷åñêèõ äèñêîâ.
// Áèò 0 îïðåäåëÿåò íàëè÷èå äèñêà À:, áèò 1 - äèñêà B è ò.ä.
x:= GetLogicalDrives;
if x <> 0 then
// öèêë ïî ïîëó÷åííûì áèòàì ïåðåìåííîé X
for i:= 1 to 64 do
begin
// Íàêëàäûâàåì áèòîâóþ ìàñêó äëÿ âûäåëåíèÿ áèòà ñ ïîðÿêîâûì íîìåðîì 0
bit:= x and 1;
// íàøëè ëîãè÷åñêèé äèñê...
if bit = 1 then
begin
// îïðåäåëÿåì òèï ëîãè÷åñêîãî äèñêà
tp:= GetDriveType(PChar(Chr(64 + i) + ':'));
if tp = DRIVE_FIXED then
// åñëè äèñê íå ÿâëÿåòñÿ ñèñòåìíûì
if Chr(64 + i) <> Copy(sd, 1, 1) then
begin
Result:= Chr(64 + i) + ':';
Break;
end;
end;
// ïîáèòîâûé ñäâèã âïðàâî
x:= x shr 1;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;
вроде бы так сорри за крякобразы=)
Raf-9600, получилось? всё? а что за код 2?
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.