Имя пользователя:
Пароль:
 

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

Забанен


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

Профиль | Цитировать


El Sanchez, Спасибо! Всё получилось как надо , вот что вышло:
читать дальше »
Код: Выделить весь код
// Скрипт 4 кнопки (Запустить|Удалить|Продолжить|Отмена|)
// Частично состоит из авторана El Sanchez (http://forum.oszone.net/member.php?userid=132675) для HL
// Модифицировал скрипт под 4 кнопки: Johny777 (http://forum.oszone.net/member.php?userid=324607)
// Поправил: El Sanchez (http://forum.oszone.net/member.php?userid=132675)

#define AppID "{D8E8ADA9-2E6C-49E7-924B-A32B89C23A24}"
#define AppName "My Program"
#define AppExeName "MyProg.exe"
#define InExe "setup.exe"
#define UnExe "{uninstallexe}"

[Setup]
AppName={#AppName}
AppVerName={#AppName}
DefaultDirName={pf}\{#AppName}
DefaultGroupName={#AppName}
AppId={{#AppID}

[CustomMessages]
english.Uninstall=&Uninstall
english.Run=&Run
english.Proceed=&Proceed
english.Cancel=&Cancel
english.Alreadyinstalled=The program {#AppName} is already installed
Russian.Uninstall=&Удалить
Russian.Run=&Запустить
Russian.Proceed=&Продолжить
Russian.Cancel=&Отмена
Russian.Alreadyinstalled=Программа {#AppName} уже установлена

[Languages]
Name: Russian; MessagesFile: compiler:Languages\Russian.isl
Name: "english"; MessagesFile: "compiler:Languages\English.isl"

[Files]
Source:compiler:Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion sortfilesbyname

[ Code]
var
  Run_Button: TNewButton;
  Del_Button: TNewButton;
  AppPath, UninsPath: string;
  ResultCode: Integer;

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

procedure UninstallButtonClick(Sender: TObject);
begin
  Exec(UninsPath, '', '' , SW_SHOW, ewNoWait, ResultCode);
  SendMessage(WizardForm.CancelButton.Handle, $00F5, 0, 0);
end;

procedure RunButtonClick(Sender: TObject);
begin
  Exec(AppPath + '{#AppExeName}', '', '', SW_SHOW, ewNoWait, ResultCode);
  SendMessage(WizardForm.CancelButton.Handle, $00F5, 0, 0);
end;

procedure InitializeWizard;
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1', 'InstallLocation', AppPath) then
  AppPath := RemoveQuotes(AppPath);
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1', 'UninstallString', UninsPath) then
  UninsPath := RemoveQuotes(UninsPath);
    begin
    { Run_Button }
      Run_Button := TNewButton.Create(WizardForm);
      with Run_Button do
      begin
        Name := 'Run_Button';
        Parent := WizardForm;
        Left := ScaleX(240);
        Top := ScaleY(327);
        Width := ScaleX(75);
        Height := ScaleY(23);
        Caption:= ExpandConstant('{cm:Run}');
        OnClick := @RunButtonClick;
      end;

    { Del_Button }
      Del_Button := TNewButton.Create(WizardForm);
      with Del_Button do
      begin
        Name := 'Del_Button';
        Parent := WizardForm;
        Left := ScaleX(153);
        Top := ScaleY(327);
        Width := ScaleX(75);
        Height := ScaleY(23);
        Caption:= ExpandConstant('{cm:Uninstall}');
        OnClick := @UninstallButtonClick;
      end;

    if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1') then
    MsgBox(ExpandConstant('{cm:Alreadyinstalled}'),mbError,MB_OK);
    
    if FileExists(AppPath + '{#AppExeName}') then
    begin
      Run_Button.Enabled:=true;
    end
    else
      Run_Button.Enabled:=false;
    end;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppID}_is1') and (CurPageId=wpWelcome)
  then
    begin
      Run_Button.Visible := True;
      Del_Button.Visible := True;
      WizardForm.NextButton.Caption:= ExpandConstant('{cm:Proceed}');
    end
  else
    begin
      Run_Button.Visible := false;
      Del_Button.Visible := false;
//      WizardForm.Caption := ExpandConstant(SetupMessage(msgButtonNext));
    end;
end;

Последний раз редактировалось Devils Night, 09-05-2012 в 05:53.


Отправлено: 05:45, 09-05-2012 | #1868