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

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

Аватара для habib2302

Ветеран


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

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


доброе время суток. если отказаться от удаления программы нажав "нет", то появляется ошибка

Скрипт
Код: Выделить весь код
; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!

#define MyAppName "Display Driver Uninstaller"
#define MyAppVersion "12.6.3"
#define MyAppURL "http://anonym.to/?http://www.wagnardmobile.com/DDU/"
#define MyAppExeName "Display Driver Uninstaller.exe"
#include "WinTB.iss"
#include "botva2.iss"

[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} RePack (& Portable) by Xabib
SetupIconFile=ico.ico
Compression=lzma/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
DiskSpanning=false
DiskSliceSize=736000000
ShowLanguageDialog=yes
SlicesPerDisk=4
UninstallDisplayIcon={app}\ico.ico
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|bPic:bPic.png|LiPic:LiPic.png|aPic:aPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
AppendDefaultDirName=false
AppendDefaultGroupName=false
DisableReadyPage=true
AppID={#MyAppName}
VersionInfoDescription={#MyAppName} RePack by Xabib
AppCopyright=Xabib © 2014
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Xabib © 2014
DisableFinishedPage=false
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
Uninstallable=not IsComponentSelected('DDU\Portable')
DisableProgramGroupPage=yes
CreateUninstallRegKey=not IsComponentSelected('DDU\Portable')

[Languages]
Name: "Russian"; MessagesFile: "Russian.isl"

[Types]
Name: full; Description: Полная установка; Flags: iscustom

[Tasks]
Name: icons; Description: {cm:AdditionalIcons}; Components: DDU\instal;
Name: icons\desktop; Description: {cm:CreateDesktopIcon}; Components: DDU\instal;
Name: icons\group; Description: {cm:CreateGroupIcon}; Components: DDU\instal;
Name: icons\quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; OnlyBelowVersion: 0,6.1; Components: DDU\instal;
Name: icons\taskbaricon; Description: {cm:CreateQuickLaunchIcon}; MinVersion: 0.0,6.1.7600; Components: DDU\instal; Flags: unchecked;

[Components]
Name: DDU; Description: {#MyAppName}; Flags: fixed disablenouninstallwarning; Types: full;
Name: DDU\instal; Description: Установить {#MyAppName}; Flags: exclusive disablenouninstallwarning
Name: DDU\Portable; Description: Распаковать {#MyAppName}; Flags: exclusive disablenouninstallwarning

[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
Source: ico.ico; DestDir: {app}; Flags: ignoreversion
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов
Source: {app}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs;

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: DDU\instal; Tasks: icons\group; IconFilename: {app}\ico.ico;
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; Components: DDU\instal; Tasks: icons\group; IconFilename: {app}\ico.ico;
Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL}; Components: DDU\instal; Tasks: icons\group;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Components: DDU\instal; Tasks: icons\desktop; IconFilename: {app}\ico.ico;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: {app}\{#MyAppExeName}; Components: DDU\instal; Tasks: icons\quicklaunchicon; IconFilename: {app}\ico.ico;

[Run]
Filename: {app}\{#MyAppExeName}; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait skipifsilent PostInstall Unchecked;

[  Code]
#ifdef UNICODE
    #define A "W"
#else
    #define A "A"
#endif

const
///////////////////////////////////Относится к лого и изображениям мастера
  RT_RCDATA             = 10;
LOAD_LIBRARY_AS_DATAFILE = $2;

var
///////////////////////////////////Лого и изображения
 lPLogo, bPicHandle, bPicHandle2, lPicHandle: THandle;
 BtnImage: TBitmapImage;
///////////////////////////////////////////
 iInitialize: Boolean;


///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
  lResStream: TResourceStream;
begin
  lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
  try
    lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
  finally
  lResStream.Free;
  Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
  end;
end;

function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
    if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;

procedure InitializeWizard;
begin
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage
  with WizardForm do
  begin

///////////////////////////////////Логотип и изображения мастера
    iInitialize := True;
    if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_BPIC', 'bPic.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') and GetFromRes('_IS_APIC', 'aPic.png') then
    begin
///////////////////////////////////Изображения
      bPicHandle := ImgLoad(WelcomePage.Handle, ExpandConstant('{tmp}\aPic.png'), WizardBitmapImage.Left, WizardBitmapImage.Top, WizardBitmapImage.Width, WizardBitmapImage.Height, True, True);
      WizardBitmapImage.Hide;
      ImgSetVisibility(bPicHandle, True);
      ImgApplyChanges(WelcomePage.Handle);

      bPicHandle := ImgLoad(FinishedPage.Handle, ExpandConstant('{tmp}\bPic.png'), WizardBitmapImage2.Left, WizardBitmapImage2.Top, WizardBitmapImage2.Width, WizardBitmapImage2.Height, True, True);
      WizardBitmapImage2.Hide;
      ImgSetVisibility(bPicHandle, True);
      ImgApplyChanges(FinishedPage.Handle);

      lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
      WizardSmallBitmapImage.Hide;
      DiskSpaceLabel.Hide;
      ComponentsDiskSpaceLabel.Hide;
      ImgSetVisibility(lPicHandle, True);
      ImgApplyChanges(MainPanel.Handle);
////////////////////////////////////////////

///////////////////////////////////Логотип

      lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40), True, True);
      ImgApplyChanges(WizardForm.Handle);
    end;

///////////////////////////////////WinTB
    ExtractTemporaryFile('WinTB.dll');
    SetTaskBarProgressValue(0, 60);
    SetTaskBarProgressState(0, TBPF_ERROR);
    TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);
//////////////////////////////////////

    with TLabel.Create(WizardForm) do
    begin
      Parent:=WizardForm;
      AutoSize:=False;
      Transparent:= true;
      SetBounds(ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40));
    end;
  end;
end;

function LoadLibraryEx(lpFileName: String; hFile: THandle; dwFlags: DWORD): THandle; external 'LoadLibraryExA@kernel32.dll stdcall';
function LoadString(hInstance: THandle; uID: SmallInt; var lpBuffer: Byte; nBufferMax: Integer): Integer; external 'LoadStringA@user32.dll stdcall';
function PinToTaskbarWin7(Filename: String): Boolean;
var
hInst: THandle;
buf: array [0..255] of byte;
i: byte;
strVerb, s: String;
objShell, colverbs: Variant;
begin
if not FileExists(Filename) then Exit;
if (GetWindowsVersion shr 24 = 6) and ((GetWindowsVersion shr 16) and $FF = 1) then
begin
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
for i := 0 to LoadString(hInst, 5386, buf[0], 255)-1 do strVerb := strVerb + Chr(Buf[i]);
FreeDLL(hInst);
try
objShell := CreateOleObject('Shell.Application');
except
ShowExceptionMessage;
Exit;
end;
colVerbs := objShell.Namespace(ExtractFileDir(Filename)).ParseName(ExtractFileName(Filename)).Verbs;
for i := colVerbs.Count downto 1 do if colVerbs.Item[i].Name = strVerb then
begin
colVerbs.Item[i].DoIt;
Result := True;
end;
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
res:Integer;
s,s1:string;
begin
If CurStep=ssPostInstall
then
begin
s1:=ExpandConstant('{app}');
Exec(s, '-y -o"'+ s1 + '"', '', SW_SHOWNORMAL, ewWaitUntilTerminated, res);

if (CurStep = ssPostInstall) and IsTaskSelected('icons\taskbaricon') then PinToTaskbarWin7(ExpandConstant('{app}\{#MyAppExeName}'))
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
  Case CurPageID of
  wpSelectTasks:
     if IsComponentSelected('DDU\instal') then
  begin
    WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
  end;
  wpSelectDir: if WizardForm.Tag = 1 then

  begin
    WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
    WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents);
    WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption; // запомнить SetupMessage(msgSelectDirDesc)
    WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc);
  end;
  wpSelectComponents: if WizardForm.Tag = 1 then
  begin
    WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
    WizardForm.DiskSpaceLabel.Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption;
    WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir);
    WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint; // иначе вместо названия программы [name]
    if IsComponentSelected('DDU\instal') then
  begin
    WizardForm.DirEdit.Text :=(ExpandConstant('{#SetupSetting("DefaultDirName")}'))
  end else
      if IsComponentSelected('DDU\Portable') then
  begin
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#MyAppName} Portable'
    WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
  end;
  end;
 end;
end;



procedure DeinitializeSetup();
begin
  if iInitialize then
  begin
    gdipShutdown;
    TaskBarDestroy;
  end;
end;

procedure InitializeUninstallProgressForm;
begin
  with UninstallProgressForm do
    begin
///////////////////////////////////Логотип и изображения мастера
      if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
      begin
///////////////////////////////////Изображения
        lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
        WizardSmallBitmapImage.Hide;
        ImgSetVisibility(lPicHandle, True);
        ImgApplyChanges(MainPanel.Handle);

///////////////////////////////////Логотип
        lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40), True, True);
        ImgApplyChanges(UninstallProgressForm.Handle);
      end;

    with TLabel.Create(nil) do
    begin
      Parent:=UninstallProgressForm;
      AutoSize:=False;
      Transparent:= true;
      SetBounds(ScaleX(20), ScaleY(318), ScaleX(124), ScaleY(40));
    end;
  end;
end;

procedure DeinitializeUninstall();
begin
  gdipShutdown;
end;




и как сделать установку по пути из реестра т.е
Код: Выделить весь код
DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppID")}_is1,InstallLocation|{pf}\My Program}
потому что у меня этот код не работает т.е вместо пути из реестра показывает др путь {pf}\My Program}

-------
Помог? От "Полезное сообщение" не откажусь!!!


Отправлено: 21:19, 16-04-2014 | #435