Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Gnom_aka_Lexander

Ветеран


Сообщения: 978
Благодарности: 564

Профиль | Сайт | Отправить PM | Цитировать


Цитата Neutron:
[ Code]
................
var
AutoRun: TSetupForm;
.........................................
AppPath,UninsPath: string; »
Сюда-же UninsPath1 : AppPath,UninsPath,UninsPath1: string;
Весь код:
читать дальше »
; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!

[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[code]
const
BM_CLICK = $00F5;

var
AutoRun: TSetupForm;
img1: TBitmapImage;
PlayButton, InstallButton, SupportButton, ReadmeButton, WebButton, ExitButton, UninstallButton: TButton;
AppPath,UninsPath,UninsPath1: string;
ResultCode: Integer;
procedure CurPageChanged(CurPageID: Integer);
begin
If CurPageID=wpWelcome then
SendMessage(WizardForm.NextButton.Handle, BM_CLICK, 0, 0);
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm:=False
Cancel:=True
end;

procedure PlayButtonClick(Sender: TObject);
var
exe: string;
begin
exe:='shift.exe';
if RegQueryStringValue(HKLM, 'SOFTWARE\Electronic Arts\Game','Install Dir', AppPath) then
begin
Exec(AddBackslash(AppPath) + Exe, '', ExtractFilePath(AddBackslash(AppPath) + Exe), SW_SHOWNORMAL,ewNoWait,ResultCode)
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end
end;

procedure InstallButtonClick(Sender: TObject);
var
CurPageID: Integer;
begin
Exec(ExpandConstant('{src}\Setup.exe'),'','',SW_SHOW,ewNoWait,ResultCode)
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end;

procedure SupportButtonClick(Sender: TObject);
begin
shellexec('open', ExpandConstant('{src}\Game.exe'), '', '',SW_SHOWNORMAL, ewnowait, ResultCode)
end;

procedure ReadmeButtonClick(Sender: TObject);
begin
ShellExec('open', ExpandConstant('{src}\readme.txt'),'','', SW_SHOW, ewNoWait, ResultCode)
end;

procedure WebButtonClick(Sender: TObject);
begin
shellexec('open', 'http://localhost', '', '',SW_SHOWNORMAL, ewnowait, ResultCode)
end;

procedure ExitButtonClick(Sender: TObject);
var
CurPageID: Integer;
begin
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end;

//============================================ Код, собственно вставил сюда ===============================================
procedure UninstallButtonClick(Sender: TObject);
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F367827A-CC84-4C46-98FD-4C484F136272}_is1','UninstallString', UninsPath) then
begin
UninsPath:=RemoveQuotes(UninsPath)
Exec(UninsPath,'','',SW_SHOWNORMAL,ewNoWait,ResultCode)
end
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9C84A33-61AA-4B8B-B44B-B04A0923592E}_is1','UninstallString', UninsPath1) then
begin
UninsPath1:=RemoveQuotes(UninsPath1)
Exec(UninsPath1,'','',SW_SHOWNORMAL,ewNoWait,ResultCode)
end
AutoRun.Close;
PostMessage(WizardForm.CancelButton.Handle, BM_CLICK, 0, 0);
end;
//============================================ Код, собственно вставил сюда ===============================================
//end;

// Почти в самом низу скрипта, в конце добавил

procedure CreateAutoRun;
begin
//AutoRun
AutoRun := CreateCustomForm;
with AutoRun do begin
Left := 498;
Top := 75;
// Width := 495;
// Height := 340;
Width := 640;
Height := 480;
BorderIcons := [];
BorderStyle:=bsToolWindow //(bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow, bsSizeToolWin)
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
Position := poScreenCenter;
Caption:='AutoRunName'
end;
//img1
img1 := TBitmapImage.Create(AutoRun);
ExtractTemporaryFile('1.bmp');
with img1 do begin
Parent := AutoRun;
Left := 0;
Stretch:= true;
Top := 0;
Width := Autorun.Width;
Height := Autorun.Height;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\1.bmp'));
end;
//PlayButton
PlayButton:= TButton.Create(AutoRun);
with PlayButton do begin
Parent := AutoRun;
Left := 470;
Top := 280;
Width := 150;
Height := 22;
Caption:= 'Play';
Cursor:= crHand;
// ModalResult:= mrOk;
OnClick := @PlayButtonClick;
if not RegQueryStringValue(HKLM, 'SOFTWARE\Game','Install Dir', AppPath) then
begin
PlayButton.Enabled := False;
end
end;
//InstallButton
InstallButton:= TButton.Create(AutoRun);
with InstallButton do begin
Parent:= AutoRun;
Left := 470;
Top := 250;
Width := 150;
Height := 22;
Caption:= 'Install';
Cursor:= crHand;
OnClick := @InstallButtonClick;
end;
//SupportButton
SupportButton:= TButton.Create(AutoRun);
with SupportButton do begin
Parent:= AutoRun;
Left := 470;
Top := 310;
Width := 150;
Height := 22;
Caption:= 'Support';
Cursor:= crHand;
OnClick := @SupportButtonClick;
end;
//ReadmeButton
ReadmeButton:= TButton.Create(AutoRun);
with ReadmeButton do begin
Parent:= AutoRun;
Left := 470;
Top := 340;
Width := 150;
Height := 22;
Caption:= 'Readme';
Cursor:= crHand;
OnClick := @ReadmeButtonClick;
end;
//WebButton
WebButton:= TButton.Create(AutoRun);
with WebButton do begin
Parent:= AutoRun;
Left := 470;
Top := 370;
Width := 150;
Height := 22;
Caption:= 'Web';
Cursor:= crHand;
OnClick := @WebButtonClick;
end;
//ExitButton
ExitButton:= TButton.Create(AutoRun);
with ExitButton do begin
Parent:= AutoRun;
Left := 470;
Top := 430;
Width := 150;
Height := 22;
Caption:= 'Exit';
Cursor:= crHand;
OnClick := @ExitButtonClick;
// ModalResult:= mrCancel;
end;
//UninstallButton
UninstallButton:= TButton.Create(AutoRun);
with UninstallButton do begin
Parent:= AutoRun;
Left := 470;
Top := 400;
Width := 150;
Height := 22;
Caption:= 'Uninstall';
Cursor:= crHand;
OnClick := @UninstallButtonClick;
end;

//===================================================Здесь в конце======================================================
if not (RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F367827A-CC84-4C46-98FD-4C484F136272}_is1','UninstallString', UninsPath) or
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D9C84A33-61AA-4B8B-B44B-B04A0923592E}_is1','UninstallString', UninsPath1)) then begin
InstallButton.Enabled:=true;
UninstallButton.Enabled:=false;
end else begin
InstallButton.Enabled:=false;
UninstallButton.Enabled:=true;
end;
//===================================================Здесь в конце======================================================


AutoRun.ShowModal;
end;

procedure InitializeWizard;
begin
CreateAutoRun;
end;

-------
Я люблю помогать. Но не путайте: "Помогите мне" и "Сделайте за меня" - это совершенно разные понятия.


Последний раз редактировалось Gnom_aka_Lexander, 05-07-2011 в 18:27.

Это сообщение посчитали полезным следующие участники:

Отправлено: 17:46, 05-07-2011 | #2214