Nekt
Цитата:
Примерно так
if IsComponentSelected('имя компоненты') then , Т.Е. если компонента отмечена,
то переходит к выполнению кода.
тут [more]
procedure CurStepChanged(CurStep: TSetupStep);
var
S: String;
begin
If CurStep=ssPostInstall then
begin
if IsComponentSelected('имя компоненты') then
S := ExpandConstant('{commondocs}\STALKER-SHOC\')
StringChangeEx(S, ':\', ':\|', True);
SaveStringToFile(ExpandConstant('{app}')+'\readme.txt', 'max_belt = 24\' + #13, true);
end;
end;
[/more]
Добавлено:
boss911
Цитата:
[more]
procedure CurStepChanged(CurStep: TSetupStep);
var
FreeMB, TotalMB: Cardinal;
begin
if (CurStep = ssInstall) and GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')) + '\', True, FreeMB, TotalMB) and
(FreeMB < 300) then
begin
MsgBox('Текст сообщения.', mbInformation, mb_Ok);
Abort;
end;
if CurStep = ssPostInstall then
begin
WizardForm.StatusLabel.Caption := 'Текст сообщения.';
DelTree(ExpandConstant('{app}') + '\PackFiles', True, True, True);
DelTree(ExpandConstant('{app}') + '\ResFiles', True, True, True);
DelTree(ExpandConstant('{app}') + '\ResHacker', True, True, True);
DelTree(ExpandConstant('{app}') + '\TempFiles\*.log', False, True, False);
end;
end;
[/more]
Добавлено:
putes
Цитата:
[more]
[_Code]
type
TSHFileOpStruct = record
Wnd: HWND;
wFunc: UINT;
pFrom: PChar;
pTo: PChar;
fFlags: Word;
fAnyOperationsAborted: BOOL;
hNameMappings: HWND;
end;
const
FO_RENAME = $0004;
FOF_FILESONLY = $0080;
FOF_ALLOWUNDO = $0040;
FOF_SILENT = $0004;
FOF_NOCONFIRMATION = $0010;
function SHFileOperation(const lpFileOp: TSHFileOpStruct):Integer;
external 'SHFileOperation@shell32.dll stdcall';
function RenameDir(const fromDir, toDir: string): Boolean;
var
fos: TSHFileOpStruct;
_fromDir, _toDir: string;
begin
_fromDir:= RemoveBackslashUnlessRoot(fromDir) + #0#0;
_toDir := RemoveBackslashUnlessRoot(toDir) + #0#0;
fos.wFunc := FO_RENAME;
fos.fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or
FOF_SILENT or FOF_NOCONFIRMATION;
fos.pFrom := PChar(_fromDir);
fos.pTo := PChar(_toDir);
Result := (0 = ShFileOperation(fos));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssInstall then
begin
RenameDir(ExpandConstant('{userdocs}'), ExpandConstant('{%userprofile}\My Documents\'));
end;
end;
[/more]
Цитата:
А как, использовать, этот код, связать при определенном выборе, компонента.
Примерно так
if IsComponentSelected('имя компоненты') then , Т.Е. если компонента отмечена,
то переходит к выполнению кода.
тут [more]
procedure CurStepChanged(CurStep: TSetupStep);
var
S: String;
begin
If CurStep=ssPostInstall then
begin
if IsComponentSelected('имя компоненты') then
S := ExpandConstant('{commondocs}\STALKER-SHOC\')
StringChangeEx(S, ':\', ':\|', True);
SaveStringToFile(ExpandConstant('{app}')+'\readme.txt', 'max_belt = 24\' + #13, true);
end;
end;
[/more]
Добавлено:
boss911
Цитата:
Помогите "склеить" два кода
[more]
procedure CurStepChanged(CurStep: TSetupStep);
var
FreeMB, TotalMB: Cardinal;
begin
if (CurStep = ssInstall) and GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')) + '\', True, FreeMB, TotalMB) and
(FreeMB < 300) then
begin
MsgBox('Текст сообщения.', mbInformation, mb_Ok);
Abort;
end;
if CurStep = ssPostInstall then
begin
WizardForm.StatusLabel.Caption := 'Текст сообщения.';
DelTree(ExpandConstant('{app}') + '\PackFiles', True, True, True);
DelTree(ExpandConstant('{app}') + '\ResFiles', True, True, True);
DelTree(ExpandConstant('{app}') + '\ResHacker', True, True, True);
DelTree(ExpandConstant('{app}') + '\TempFiles\*.log', False, True, False);
end;
end;
[/more]
Добавлено:
putes
Цитата:
я свободно ручками переименовываю папку Мои документы
[more]
[_Code]
type
TSHFileOpStruct = record
Wnd: HWND;
wFunc: UINT;
pFrom: PChar;
pTo: PChar;
fFlags: Word;
fAnyOperationsAborted: BOOL;
hNameMappings: HWND;
end;
const
FO_RENAME = $0004;
FOF_FILESONLY = $0080;
FOF_ALLOWUNDO = $0040;
FOF_SILENT = $0004;
FOF_NOCONFIRMATION = $0010;
function SHFileOperation(const lpFileOp: TSHFileOpStruct):Integer;
external 'SHFileOperation@shell32.dll stdcall';
function RenameDir(const fromDir, toDir: string): Boolean;
var
fos: TSHFileOpStruct;
_fromDir, _toDir: string;
begin
_fromDir:= RemoveBackslashUnlessRoot(fromDir) + #0#0;
_toDir := RemoveBackslashUnlessRoot(toDir) + #0#0;
fos.wFunc := FO_RENAME;
fos.fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or
FOF_SILENT or FOF_NOCONFIRMATION;
fos.pFrom := PChar(_fromDir);
fos.pTo := PChar(_toDir);
Result := (0 = ShFileOperation(fos));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssInstall then
begin
RenameDir(ExpandConstant('{userdocs}'), ExpandConstant('{%userprofile}\My Documents\'));
end;
end;
[/more]