Ветеран
Сообщения: 649
Благодарности: 444
|
Профиль
|
Отправить PM
| Цитировать
El Sanchez,
в твоём примере мутекс освобождается по завершении работы инсталла и форма деинсталятора создаётся в procedure CurUninstallStepChanged
этот вариант отличный
для него хватило бы и родного (уже делал так)
Setup
AppMutex=ggghhhgggfxgxdfgzdfg
...
CreateMutex('ggghhhgggfxgxdfgzdfg');
у меня была задумка перенести деинсталятор в основной скрипт, но с этим я обломался,
вот наработка
читать дальше »
Код:
procedure LoadSkinU(lpszPath: String; lpszIniFileName: String); external 'LoadSkin@{tmp}\isskin.dll stdcall delayload';
procedure UnloadSkinU(); external 'UnloadSkin@{tmp}\isskin.dll stdcall delayload';
var
Delete_Form: TSetupForm;
function InitializeUninstall(): Boolean;
var
hl2_Checkbox, ep1_Checkbox, ep2_Checkbox, portal_Checkbox: TCheckBox;
begin
FileCopy(ExpandConstant('{app}\isskin.dll'), ExpandConstant('{tmp}\isskin.dll'), False);
FileCopy(ExpandConstant('{app}\steam.cjstyles'), ExpandConstant('{tmp}\steam.cjstyles'), False);
begin
LoadSkinU(ExpandConstant('{tmp}\steam.cjstyles'), '');
Delete_Form := CreateCustomForm();
with Delete_Form do
begin
Position := poScreenCenter;
ClientWidth := ScaleX(500);
ClientHeight := ScaleY(500);
Color := clBtnFace;
DeleteMenu(GetSystemMenu(Delete_Form.Handle,False), $F060,0); /// ñäåëàòü êíîïêó "çàêðûòü" íåàêòèâíîé
SetClassLong(Delete_Form.Handle, -26, GetClassLong(Delete_Form.Handle, -26) or $200); /// áëîêèðîâêà êîìáèíàöèè alt + f4
SendMessage(Delete_Form.Handle, $0080, 0, LoadImage(0,ExpandConstant('{tmp}')+'\LIcon.ico',1,16,16,$1010)); /// èêîíêà â óãëó
end;
with TButton.Create(Delete_Form) do
begin
Parent := Delete_Form;
Caption := ExpandConstant(SetupMessage(msgButtonNo));
SetBounds(ScaleX(3), ScaleY(100), ScaleX(71), ScaleY(25));
ModalResult:= mrCancel;
end;
with TButton.Create(Delete_Form) do
begin
Caption := ExpandConstant(SetupMessage(msgButtonYes));
Parent := Delete_Form;
SetBounds(ScaleX(80), ScaleY(100), ScaleX(71), ScaleY(25));
ModalResult := mrYes;
end;
hl2_Checkbox := TCheckBox.Create(Delete_Form);
with hl2_Checkbox do
begin
Parent := Delete_Form;
Caption := 'hl2';
SetBounds(ScaleX(80), ScaleY(127), ScaleX(80), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{app}\common\half-life 2\hl2.exe'));
end;
ep1_Checkbox := TCheckBox.Create(Delete_Form);
with ep1_Checkbox do
begin
Parent := Delete_Form;
Caption := 'ep1';
SetBounds(ScaleX(80), hl2_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{app}\common\half-life 2 episode one\hl2.exe'));
end;
ep2_Checkbox := TCheckBox.Create(Delete_Form);
with ep2_Checkbox do
begin
Parent := Delete_Form;
Caption := 'ep2';
SetBounds(ScaleX(80), ep1_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{app}\common\half-life 2 episode two\hl2.exe'));
end;
portal_Checkbox := TCheckBox.Create(Delete_Form);
with portal_Checkbox do
begin
Parent := Delete_Form;
Caption := 'portal';
SetBounds(ScaleX(80), ep2_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{app}\common\portal\hl2.exe'));
end;
end;
case
Delete_Form.ShowModal() of
mrNo :
begin
UnloadSkinU();
Delete_Form.Free;
end;
mrYes :
begin
if hl2_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{app}\common\half-life 2'), True, True, True)
DeleteFile(ExpandConstant('{app}\half-life 2 buka russian.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 2007 base content.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 content.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 game dialog.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2.lnk'));
SetIniString('Installed', 'hl2', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'AuroraB', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'hl2_ru', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'hl2_ru_buka', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'hl2_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'hl2_ru_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
end;
if ep1_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{app}\common\half-life 2 episode one'), True, True, True)
DeleteFile(ExpandConstant('{app}\episode one 2007 content.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 episode one.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2 Episode One.lnk'));
SetIniString('Installed', 'ep1', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_ru', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_ru_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
end;
if ep2_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{app}\common\half-life 2 episode two'), True, True, True)
DeleteFile(ExpandConstant('{app}\episode two content.gcf'));
DeleteFile(ExpandConstant('{app}\episode two maps.gcf'));
DeleteFile(ExpandConstant('{app}\episode two materials.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 episode two english.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 episode two russian.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2 Episode Two.lnk'));
SetIniString('Installed', 'ep2', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_ru', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_ru_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
end;
if portal_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{app}\common\portal'), True, True, True);
DeleteFile(ExpandConstant('{app}\portal content.gcf'));
DeleteFile(ExpandConstant('{app}\portal english.gcf'));
DeleteFile(ExpandConstant('{app}\portal russian.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Portal.lnk'));
SetIniString('Installed', 'portal', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_ru', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_ru_en', '', ExpandConstant('{app}\uninstall\parameters.ini'));
end;
//
if not(FileExists(ExpandConstant('{app}\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\half-life 2 episode two\hl2.exe'))) then
begin
DeleteFile(ExpandConstant('{app}\episode 1 shared.gcf'));
DeleteFile(ExpandConstant('{app}\episodic 2007 shared.gcf'));
DeleteFile(ExpandConstant('{app}\half-life 2 episode one russian.gcf'));
end;
if not(FileExists(ExpandConstant('{app}\common\half-life 2\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\half-life 2 episode two\hl2.exe'))) then
DeleteFile(ExpandConstant('{app}\half-life 2_russian.gcf'));
//
if not(FileExists(ExpandConstant('{app}\common\half-life 2\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\half-life 2 episode two\hl2.exe'))) and
not(FileExists(ExpandConstant('{app}\common\portal\hl2.exe'))) then
begin
DelTree(ExpandConstant('{userprograms}\Source Engine 15'), True, True, True);
UnloadSkinU();
Delete_Form.Free;
Result := True;
end;
end;
end;
end;
не смог в конце Case Yes, если нет всех четырёх экзешников не дать появиться стандартным:
1 месседжбокс "Вы уверены, что хотите удалить "да/Нет""
2 Создание UninstallProgressForm
короче как в параметре VERYSILIENT для деинсталятора, хотя месседж бокс в самом конце с текстом "Приложение полностью удалено" не помешал бы
поэтому, как изначально задумывалось
деинсталятор это отдельно скомпилированная программа (отдельный скрипт),
которая копируется вместе с остальными файлами во время установки в app\uninstall
вот так в основном инсталле
читать дальше »
Код:
Files
Source: uninstall\Setup\Uninstall.exe; DestDir: {app}\uninstall; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension solidbreak;
Code
procedure CurStepChanged(CurStep: TSetupStep);
begin
case CurStep of
ssInstall :
begin
...
if FileExists(ExpandConstant('{app}\uninstall\unins000.exe')) then DeleteFile(ExpandConstant('{app}\uninstall\unins000.exe'));
if FileExists(ExpandConstant('{app}\uninstall\unins007.dat')) then DeleteFile(ExpandConstant('{app}\uninstall\unins007.dat'));
if FileExists(ExpandConstant('{app}\uninstall\unins007.exe')) then DeleteFile(ExpandConstant('{app}\uninstall\unins007.exe'));
...
ssDone :
begin
if FileExists(ExpandConstant('{app}\uninstall\unins000.exe')) then RenameFile(ExpandConstant('{app}\uninstall\unins000.exe'), ExpandConstant('{app}\uninstall\unins007.exe'));
if FileExists(ExpandConstant('{app}\uninstall\unins000.dat')) then RenameFile(ExpandConstant('{app}\uninstall\unins000.dat'), ExpandConstant('{app}\uninstall\unins007.dat'));
if FileExists(ExpandConstant('{app}\uninstall\Uninstall.exe')) then RenameFile(ExpandConstant('{app}\uninstall\Uninstall.exe'), ExpandConstant('{app}\uninstall\unins000.exe'));
SetFileAttributes(PChar(ExpandConstant('{app}\uninstall\unins007.exe')), FILE_ATTRIBUTE_HIDDEN or FILE_ATTRIBUTE_SYSTEM);
SetFileAttributes(PChar(ExpandConstant('{app}\uninstall\unins007.dat')), FILE_ATTRIBUTE_HIDDEN or FILE_ATTRIBUTE_SYSTEM);
те подменяю созданный автоматом родной инсталл, на свой, который = форма , а родной запускается так (в конце процедуры Uninstall переменная типа Boolean, которая, если Тру даёт команду на запуск родного в очень тихом режиме, в конце деинициализации )
Цитата El Sanchez:
не знаю, что ты там сделал, по коду этого не видно »
|
вот код самой последней версии деинсталятора (вариант на форме)
читать дальше »
Код:
#define MyAppName "Uninstall"
[Setup]
AppId=proto15
SourceDir=.
OutputDir=C:\Program Files (x86)\Source Engine 15\uninstall
AppName={#MyAppName}
AppVerName={#MyAppName}
AppVersion={#MyAppName}
CreateAppDir=false
OutputBaseFilename={#MyAppName}
Uninstallable=false
//SetupIconFile=hl2.ico
//BitmapResource=bgnd:orangebox.bmp
ShowLanguageDialog=auto
LanguageDetectionMethod=uilanguage
UsePreviousLanguage=no
BitmapResource=bgnd:Cremator2.bmp
AppMutex=Mutex_proto15
[CustomMessages]
ru.Cremator=дворник Альянса
en.Cremator=A Combine janitor of sorts
ru.remove=ему подмести?
en.remove=should he sweep?
ru.Save=или сначала
en.Save=would you like to
ru.Save_Btn=сохранишь ?
en.Save_Btn=save ?
en.rem=sweep
ru.rem=смести
[Languages]
Name: ru; MessagesFile: compiler:Languages\Russian.isl
Name: en; MessagesFile: compiler:Languages\English.isl
[Files]
Source: ISSkin.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: steam.cjstyles; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: icon.ico; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
[ Code]
////////////////////////////////////////////////////////////////////////
var
AutoRun: TForm;
ResultCode: Integer;
hl2_Checkbox, ep1_Checkbox, ep2_Checkbox, portal_Checkbox: TCheckBox;
ExitButton, UninstallButton: TButton;
SaveBtn: TNewSpeedButton;
Delete_All: Boolean;
/// мутекс /// часть 1 из 3 /// начало
var
hMutex: THandle;
function WINAPI_CreateMutex(lpMutexAttributes: Longint; bInitialOwner: BOOL; lpName: String): THandle; external 'CreateMutexA@kernel32.dll stdcall';
function ReleaseMutex(hMutex: THandle): BOOL; external 'ReleaseMutex@kernel32.dll stdcall';
function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';
/// конец
/// тень окна /// начало
function GetWindowLong(Wnd: HWnd; Index: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall';
function SetClassLong(hWnd: HWND; Index, NewLong: Longint): Longint; external 'SetClassLongA@user32 stdcall';
/// конец
function LoadImage(hInst: THandle; ImageName: PChar; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; external 'LoadImageA@user32.dll stdcall delayload'; /// иконка на папку часть 1
////////// скин /// часть 1 из 2 /// начало
procedure LoadSkin(lpszPath: String; lpszIniFileName: String); external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin(); external 'UnloadSkin@files:isskin.dll stdcall';
function ShowWindow(hWnd: Integer; uType: Integer): Integer; external 'ShowWindow@user32.dll stdcall';
/////////// таскать окно за любую область /// начало
type
TANewStatic = record
Static : TNewStaticText;
end;
var
ANewStatic : array of TANewStatic;
function ReleaseCapture(): Longint; external 'ReleaseCapture@user32.dll stdcall';
procedure MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(AutoRun.Handle,$0112,$F012,0)
end;
procedure AddStaticToArray(st:TNewStaticText);
var
i:integer;
begin
i:=GetArrayLength(ANewStatic);
SetArrayLength(ANewStatic,i+1);
ANewStatic[i].Static:=st;
ANewStatic[i].Static.OnMouseDown:=@MouseDown;
end;
procedure StaticChange(c:TWinControl);
var
i:integer;
begin
for i:=0 to c.ControlCount-1 do
if c.Controls[i] is TWinControl then
begin
if c.Controls[i] is TNewStaticText then AddStaticToArray(TNewStaticText(c.Controls[i]));
if TWinControl(c.Controls[i]).ControlCount>0 then StaticChange(TWinControl(c.Controls[i]));
end;
end;
/// конец
//////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
procedure Unstall(Sender: TObject);
begin
Delete_All := False;
if hl2_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{src}\..\common\half-life 2'), True, True, True)
DeleteFile(ExpandConstant('{src}\..\half-life 2 buka russian.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 2007 base content.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 content.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 game dialog.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2.lnk'));
SetIniString('Installed', 'hl2', '', ExpandConstant('{src}\parameters.ini'));
SetIniString('Installed', 'AuroraB', '', ExpandConstant('{src}\parameters.ini'));
SetIniString('Installed', 'hl2_ru', '', ExpandConstant('{src}\parameters.ini'));
SetIniString('Installed', 'hl2_ru_buka', '', ExpandConstant('{src}\parameters.ini'));
SetIniString('Installed', 'hl2_en', '', ExpandConstant('{src}\parameters.ini'));
SetIniString('Installed', 'hl2_ru_en', '', ExpandConstant('{src}\parameters.ini'));
end;
if ep1_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{src}\..\common\half-life 2 episode one'), True, True, True)
DeleteFile(ExpandConstant('{src}\..\episode one 2007 content.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 episode one.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2 Episode One.lnk'));
SetIniString('Installed', 'ep1', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_ru', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep1_ru_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
end;
if ep2_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{src}\..\common\half-life 2 episode two'), True, True, True)
DeleteFile(ExpandConstant('{src}\..\episode two content.gcf'));
DeleteFile(ExpandConstant('{src}\..\episode two maps.gcf'));
DeleteFile(ExpandConstant('{src}\..\episode two materials.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 episode two english.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 episode two russian.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Half-Life 2 Episode Two.lnk'));
SetIniString('Installed', 'ep2', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_ru', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'ep2_ru_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
end;
if portal_Checkbox.Checked = true then
begin
DelTree(ExpandConstant('{src}\..\common\portal'), True, True, True);
DeleteFile(ExpandConstant('{src}\..\portal content.gcf'));
DeleteFile(ExpandConstant('{src}\..\portal english.gcf'));
DeleteFile(ExpandConstant('{src}\..\portal russian.gcf'));
DeleteFile(ExpandConstant('{userdesktop}\Portal.lnk'));
SetIniString('Installed', 'portal', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_ru', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
SetIniString('Installed', 'portal_ru_en', '', ExpandConstant('{src}\uninstall\parameters.ini'));
end;
if not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode two\hl2.exe'))) then
begin
DeleteFile(ExpandConstant('{src}\..\episode 1 shared.gcf'));
DeleteFile(ExpandConstant('{src}\..\episodic 2007 shared.gcf'));
DeleteFile(ExpandConstant('{src}\..\half-life 2 episode one russian.gcf'));
end;
if not(FileExists(ExpandConstant('{src}\..\common\half-life 2\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode two\hl2.exe'))) then
DeleteFile(ExpandConstant('{src}\..\half-life 2_russian.gcf'));
if not(FileExists(ExpandConstant('{src}\..\common\half-life 2\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode one\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\half-life 2 episode two\hl2.exe'))) and
not(FileExists(ExpandConstant('{src}\..\common\portal\hl2.exe'))) then
begin
DelTree(ExpandConstant('{userprograms}\Source Engine 15'), True, True, True);
Delete_All := True;
end;
AutoRun.Close;
end;
procedure Run_SAVE(Sender: TObject);
begin
if ActiveLanguage = 'en' then Exec(ExpandConstant('{src}\SAVE.exe'), '/LANG=English', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
if ActiveLanguage = 'ru' then Exec(ExpandConstant('{src}\SAVE.exe'), '/LANG=Russian', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
///////////////////////////////////////////////////////////
procedure CreateAutoRun();
var
Save_Label: TLabel;
begin
hMutex := WINAPI_CreateMutex(0, False, '{#SetupSetting("AppMutex")}'); /// мутекс /// часть 2 из 3 /// начало
AutoRun := TForm.Create(nil);
with AutoRun do
begin
BorderStyle := bsDialog;
SetClassLong(AutoRun.Handle, (-26), GetWindowLong(AutoRun.Handle, (-26)) or $00020000); //тень окна
Position := poScreenCenter;
Caption := 'Uninstall';
ClientWidth := ScaleX(634);
ClientHeight := ScaleY(586);
with TBitmapImage.Create(AutoRun) do
begin
Parent := AutoRun;
Bitmap.LoadFromResourceName(HInstance, '_IS_BGND');
SetBounds(ScaleX(0), ScaleY(0), ScaleX(640), ScaleY(586));
Hint := ExpandConstant('{cm:Cremator}');
ShowHint := True
ParentShowHint := False;
OnMouseDown := @MouseDown;
end;
Save_Label := Tlabel.Create(AutoRun)
with Save_Label do
begin
Left := ScaleX(400);
Top := ScaleY(27);
AutoSize := True;
Caption := ExpandConstant('{cm:remove}');
Font.Color := clWindowText;
Font.Height := -16;
Font.Name := 'Tahoma';
ParentFont := False;
Transparent := False;
Parent := AutoRun;
Font.Color := $48c1ca;
end;
with Tlabel.Create(AutoRun) do
begin
SetBounds(ScaleX(460), ScaleY(50), ScaleX(270), ScaleY(16));
AutoSize := False;
Caption := ExpandConstant('{cm:Save}');
Transparent := True;
WordWrap := True;
Parent := AutoRun;
Font.Color := $48c1ca;
Font.Size := 8;
end;
with Tlabel.Create(AutoRun) do
begin
SetBounds(ScaleX(343), ScaleY(0), ScaleX(297), ScaleY(586));
AutoSize := False;
Caption := '';
Transparent := True;
Parent := AutoRun;
OnMouseDown := @MouseDown;
end;
end;
///
ExtractTemporaryFile('icon.ico');
SendMessage(AutoRun.Handle, $0080, 0, LoadImage(0,ExpandConstant('{tmp}')+'\icon.ico',1,16,16,$1010));
///
UninstallButton := TButton.Create(AutoRun);
with UninstallButton do
begin
Parent := AutoRun;
SetBounds(ScaleX(500), ScaleY(527), ScaleX(69), ScaleY(23));
Cursor := crHand;
Caption := ExpandConstant(SetupMessage(msgButtonYes));
OnClick := @Unstall;
end;
ExitButton := TButton.Create(AutoRun);
with ExitButton do
begin
Parent := AutoRun;
SetBounds(UninstallButton.Left - UninstallButton.Width - ScaleX(16), UninstallButton.Top, UninstallButton.Width, UninstallButton.Height);
Caption := ExpandConstant(SetupMessage(msgButtonNo));;
Cursor := crHand;
ModalResult := mrCancel;
end;
SaveBtn := TNewSpeedButton.Create(AutoRun);
with SaveBtn do
begin
Parent := AutoRun;
if ActiveLanguage = 'ru' then SetBounds(Save_Label.Left + Save_Label.Width + ScaleX(20), Save_Label.Top + ScaleY(19), ScaleX(73), ScaleY(20));
if ActiveLanguage = 'en' then SetBounds(Save_Label.Left + Save_Label.Width + ScaleX(20), Save_Label.Top + ScaleY(19), ScaleX(40), ScaleY(20));
Caption := ExpandConstant('{cm:Save_Btn}');
OnClick := @Run_SAVE;
Enabled := FileExists(ExpandConstant('{src}\SAVE.exe'));
ThemeEnabled := False;
Style := nsbButton;
Font.Size := 8;
Font.Color := $48c1ca;
end;
hl2_Checkbox := TCheckBox.Create(AutoRun);
with hl2_Checkbox do
begin
Parent := AutoRun;
Caption := ExpandConstant('{cm:rem}');
SetBounds(UninstallButton.Left, ScaleY(127), ScaleX(80), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{src}\..\common\half-life 2\hl2.exe'));
end;
ep1_Checkbox := TCheckBox.Create(AutoRun);
with ep1_Checkbox do
begin
Parent := AutoRun;
Caption := ExpandConstant('{cm:rem}');
SetBounds(UninstallButton.Left, hl2_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{src}\..\common\half-life 2 episode one\hl2.exe'));
end;
ep2_Checkbox := TCheckBox.Create(AutoRun);
with ep2_Checkbox do
begin
Parent := AutoRun;
Caption := ExpandConstant('{cm:rem}');
SetBounds(UninstallButton.Left, ep1_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{src}\..\common\half-life 2 episode two\hl2.exe'));
end;
portal_Checkbox := TCheckBox.Create(AutoRun);
with portal_Checkbox do
begin
Parent := AutoRun;
Caption := ExpandConstant('{cm:rem}');
SetBounds(UninstallButton.Left, ep2_Checkbox.Top + ScaleY(116), ScaleX(70), ScaleY(15));
Checked := False;
Enabled := FileExists(ExpandConstant('{src}\..\common\portal\hl2.exe'));
end;
AutoRun.Repaint;
AutoRun.ShowModal;
end;
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('steam.cjstyles');
LoadSkin(ExpandConstant('{tmp}\steam.cjstyles'), '');
CreateAutoRun();
Result := False;
end;
procedure DeinitializeSetup;
begin
AutoRun.Hide;
Sleep(200);
UnloadSkin();
/// мутекс /// часть 3 из 3 /// начало
ReleaseMutex(hMutex);
CloseHandle(hMutex);
/// конец
if Delete_All = True then Exec(ExpandConstant('{src}\unins007.exe'),'/VERYSILENT','', SW_SHOW, ewNoWait, ResultCode);
end;
если нужно с файлам, то выложу
с этим удалением (у этого кода) и отсутствует месседжбокс при конфликте мутекса,
те код который у тебя в примере выполняется у меня в деинсталяторе, но без месседжбокса не дающего ему, деинсталятору, запуститься
в основном скрипте я товй код пока не использую
там стоит просто
Setup
AppMutex=ggghhhgggfxgxdfgzdfg
...
CreateMutex('ggghhhgggfxgxdfgzdfg');
================================================== нашёл
procedure CreateAutoRun();
begin
if CheckForMutexes('{#SetupSetting("AppMutex")}') then MsgBox('Мутекс', mbError, MB_ICONINFORMATION ); /// мутекса ещё нет и месседжбокса не будет
hMutex := WINAPI_CreateMutex(0, False, '{#SetupSetting("AppMutex")}'); создаём мутекс
if CheckForMutexes('{#SetupSetting("AppMutex")}') then MsgBox('Мутекс', mbError, MB_ICONINFORMATION ); /// появляется месседж бокс
думаю мутекс так и надо создавать в InitializeWizard, а проверку делать в InitializeSetup
буду разбирать!
|