Installation 我在INNO设置中复制了InitializeSetup如何解决它?

Installation 我在INNO设置中复制了InitializeSetup如何解决它?,installation,inno-setup,pascal,Installation,Inno Setup,Pascal,您好,我正在尝试使用INNO安装程序进行安装,当我开始使用ISSkin代码INNO安装程序时,向我发送一个错误消息:重复标识符'INITIALIZESETUP',我想知道我必须对代码进行哪些更改才能使其正常工作 我在互联网上阅读,发现了一个名为IS Script Joiner的程序,我用过它,但它不起作用 这是我的Inno代码: ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETA

您好,我正在尝试使用INNO安装程序进行安装,当我开始使用ISSkin代码INNO安装程序时,向我发送一个错误消息:重复标识符'INITIALIZESETUP',我想知道我必须对代码进行哪些更改才能使其正常工作

我在互联网上阅读,发现了一个名为IS Script Joiner的程序,我用过它,但它不起作用

这是我的Inno代码:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Myprogram"
#define MyAppVersion "2.8"
#define MyAppPublisher "Myprogram"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "program.exe"
#define ISSI_WizardSmallBitmapImage "wpBanner.bmp"
#define ISSI_WizardSmallBitmapImage_x 495
#define ISSI_WizardSmallBitmapImage_Align
#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{2A8CE1DB-2FDB-4CAA-8A2C-0FE3DB8A500D}
AppName=Myprogram
AppVersion=2.8
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher=Myprogram
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\Myprogram
DefaultGroupName={#MyAppName}
LicenseFile=C:\Libraries\EULA.rtf
OutputDir=C:\Users\Hans Lopez\INNO SETUPS
OutputBaseFilename=programoutput
SetupIconFile=C:\Libraries\Icon.ico
Compression=lzma/Max
SolidCompression=true
WizardImageFile=C:\InstallMlockPackage\Setupbanner.bmp
AppVerName=2.8
DirExistsWarning=yes
VersionInfoProductName=Myprogram
VersionInfoProductVersion=2.8



[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"

[Dirs]
Name: "{app}" ; Permissions: everyone-full
Name: {sd}\myprogramfolder; Permissions: everyone-full; 


[Code]
//===================================================================Verify if                     Installed===============================================================================
function GetUninstallString: string;
var
sUnInstPath: string;
sUnInstallString: String;
begin
Result := '';

   sUnInstallString := '';
   if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
   Result := sUnInstallString;
   end;

   function IsUpgrade: Boolean;
begin
Result := (GetUninstallString() <> '');
end;

function InitializeSetup: Boolean;
var
  V: Integer;
  iResultCode: Integer;
  sUnInstallString: string;
begin
  Result := True; // in case when no previous version is found
  if                    RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\ {2A8CE1DB-2FDB-4CAA-8A2C-0FE2DB8A500D}_is1', 'UninstallString') then  //Your App GUID/ID
  begin
    V := MsgBox(ExpandConstant('Myprogram is Already installed, Do you want to         continue?'), mbInformation, MB_YESNO); //Custom Message if App installed
    if V = IDYES then
    begin
      sUnInstallString := GetUninstallString();
      sUnInstallString :=  RemoveQuotes(sUnInstallString);
      Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated,     iResultCode);
      Result := True; //if you want to proceed after uninstall
                //Exit; //if you want to quit after uninstall
    end
    else
      Result := False; //when older version present and not uninstalled
  end;
end;

//====================================================================Unistall and Delete Everything==================================================================

procedure DeleteBitmaps(ADirName: string);
var
  FindRec: TFindRec;
begin
  if FindFirst(ADirName + '\*.*', FindRec) then begin
    try
      repeat
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then begin
          if (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
            DeleteBitmaps(ADirName + '\' + FindRec.Name);
            RemoveDir(ADirName + '\' + FindRec.Name);
          end;
        end else if Pos('.bmp', AnsiLowerCase(FindRec.Name)) > 0 then
          DeleteFile(ADirName + '\' + FindRec.Name);
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then begin
    if MsgBox('Do you want to delete all data files?', mbConfirmation,
        MB_YESNO) = IDYES 
    then begin
      DeleteBitmaps(ExpandConstant('{app}'));
    end;
  end;
end;


//===========================================================ISSKinCODE=============================================================================



// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';

// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';

// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';


function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('iTunesB.msstyles');
  LoadSkin(ExpandConstant('{tmp}\iTunesB.msstyles'), '');
  Result := True;
end;

procedure DeinitializeSetup();
begin
  // Hide Window before unloading skin so user does not get
  // a glimpse of an unskinned window before it is closed.
  ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
  UnloadSkin();
end;



/////////////////////////////////////////////////////////////ENDCODE/////////////////////////////////////////////////////////////////////////////////////////////////




[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "                  {cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "    {cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\My program\program.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Program Files\C:\My program\*"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\programfolder\*"; DestDir: "{sd}\Myprogramfolder"; Flags: ignoreversion             recursesubdirs createallsubdirs
Source: ISSkin.dll; DestDir: {app}; Flags: dontcopy
Source: "C:\InstallMlockPackage\ISSkin\iTunesB\iTunesB\iTunesB.msstyles"; DestDir: "    {tmp}"; Flags: dontcopy



; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";  IconFilename: "    {app}\icon.ico" ;
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}";  IconFilename: "{app}\icon.ico" ;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}";      IconFilename: "{app}\icon.ico" ;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks:     desktopicon;  IconFilename: "{app}\icon.ico" ;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon;  IconFilename: "{app}\icon.ico" ;
Name: {group}\Uninstall =ISSkin; Filename: {app}\unins000.exe
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,         {#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
;由Inno安装脚本向导生成的脚本。
; 有关创建INNO安装脚本文件的详细信息,请参阅文档!
#定义MyAppName“Myprogram”
#定义MyAppVersion“2.8”
#定义MyAppPublisher“Myprogram”
#定义MyAppURL“http://www.example.com/"
#定义MyAppExeName“program.exe”
#定义ISSI_向导SmallBitMapImage“wpBanner.bmp”
#定义ISSI_向导SmallBitMapImage_x 495
#定义ISSI_向导SmallBitMapImage_对齐
#定义ISSI_IncludePath“C:\ISSI”
#include ISSI\u IncludePath+“\\u ISSI.isi”
[设置]
; 注意:AppId的值唯一标识此应用程序。
; 不要在其他应用程序的安装程序中使用相同的AppId值。
; (要生成新的GUID,请单击工具|在IDE中生成GUID。)
AppId={2A8CE1DB-2FDB-4CAA-8A2C-0FE3DB8A500D}
AppName=Myprogram
AppVersion=2.8
;AppVerName={{#MyAppName}{#MyAppVersion}
AppPublisher=Myprogram
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\Myprogram
DefaultGroupName={#MyAppName}
LicenseFile=C:\Libraries\EULA.rtf
OutputDir=C:\Users\Hans Lopez\INNO设置
OutputBaseFilename=程序输出
SetupIconFile=C:\Libraries\Icon.ico
压缩=lzma/Max
SolidCompression=true
WizardImageFile=C:\InstallMlockPackage\Setupbanner.bmp
AppVerName=2.8
direxistswaning=是
VersionInfoProductName=Myprogram
VersionInfo产品版本=2.8
[语文]
名称:“英语”消息文件:“编译器:Default.isl”
名称:“西班牙语”消息文件:“编译器:Languages\spanish.isl”
[目录]
名称:“{app}”权限:所有人已满
名称:{sd}\myprogramfolder;权限:所有人已满;
[守则]
//================================================================================================================验证是否已安装===============================================================================
函数GetUninstallString:string;
变量
sunistpath:string;
sunstallstring:String;
开始
结果:='';
sUnInstallString:='';
如果不是RegQueryStringValue(HKLM、sUnInstPath、“卸载字符串”、sUnInstallString),则
RegQueryStringValue(HKCU、sUnInstPath、“卸载字符串”、sUnInstallString);
结果:=sunstallString;
结束;
函数为:布尔型;
开始
结果:=(GetUninstallString()“”);
结束;
函数初始化设置:布尔;
变量
V:整数;
iResultCode:整数;
sunstallstring:string;
开始
结果:=True;//如果找不到以前的版本
如果存在regvalues(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\{2A8CE1DB-2FDB-4CAA-8A2C-0FE2DB8A500D}是1','UninstallString'),则//您的应用程序GUID/ID
开始
V:=MsgBox(ExpandConstant('Myprogram已安装,是否继续?')),mbInformation,MB_YESNO);//如果安装了应用程序,则自定义消息
如果V=田园诗,那么
开始
sUnInstallString:=GetUninstallString();
sUnInstallString:=RemoveQuotes(sUnInstallString);
Exec(ExpandConstant(sUnInstallString)、“”、“”和SW_SHOW、EWWaitUnFilterminated、iResultCode);
结果:=True;//如果要在卸载后继续
//退出;//如果要在卸载后退出
结束
其他的
结果:=False;//存在旧版本且未卸载时
结束;
结束;
//==============================================================================================================================取消安装并删除所有内容==================================================================
过程删除位图(ADirName:string);
变量
FindRec:TFindRec;
开始
如果FindFirst(ADirName+'\*.*',FindRec),则开始
尝试
重复
如果FindRec.Attributes和文件属性目录0,则开始
如果(FindRec.Name'.'和(FindRec.Name'.'),则开始
删除位图(ADirName+'\'+FindRec.Name);
RemoveDir(ADirName+'\'+FindRec.Name);
结束;
如果Pos('.bmp',AnsiLowerCase(FindRec.Name))>0,则结束else
DeleteFile(ADirName+'\'+FindRec.Name);
直到没有FindNext(FindRec);
最后
FindClose(FindRec);
结束;
结束;
结束;
过程CurUninstallStep已更改(CurUninstallStep:TUninstallStep);
开始
如果CurUninstallStep=usUninstall,则开始
如果MsgBox('是否要删除所有数据文件?'),mbConfirmation,
MB_YESNO)=田园诗
然后开始
删除位图(ExpandConstant({app}');
结束;
结束;
结束;
//==========================================================================================================ISSKinCODE=============================================================================
//从ISSkin.DLL导入LoadSkin API
过程LoadSkin(lpszPath:String;lpszIniFileName:String);
外部的LoadSkin@files:isskin.dll stdcall';
//从ISSkin.DLL导入UnloadSkin API
程序代码:adskin();
外部的UnloadSkin@files:isskin.dll stdcall';
//从User32.DLL导入ShowWindow Windows API
函数ShowWindow(hWnd:Integer;uType:Integer):整数;
外部的ShowWindow@user32.dllstdcall';
函数InitializeSetup():Boolean;
开始
提取临时文件('iTunesB.msstyles');
LoadSkin(ExpandConstant('{tmp}\iTunesB.msstyles'),'';
结果:=真;
结束;
过程去初始化设置();
开始
//在卸载蒙皮之前隐藏窗口,以便用户不会
//在窗户关上之前瞥见一扇未开窗的窗户。
ShowWindow(stroint(ExpandConstant({wizardhwnd}')),0;
解开皮肤();
结束;
/////////////////////////////////////////////////////////////端码/////////////////////////////////////////////////////////////////////////////////////////////////
[任务]
名称:“desktopicon”说明:“{cm:CreateDesktopIcon}”;组说明:“{cm:AdditionalIcons}”;标志:un
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskin.dll stdcall';

// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin@files:isskin.dll stdcall';
function InitializeSetup: Boolean;
var
  V: Integer;
  iResultCode: Integer;
  sUnInstallString: string;
begin
  // These two lines moved from second InitializeSetup declaration before it
  // was removed.
  ExtractTemporaryFile('iTunesB.msstyles');
  LoadSkin(ExpandConstant('{tmp}\iTunesB.msstyles'), '');
  Result := True; // in case when no previous version is found
  if                    RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\ {2A8CE1DB-2FDB-4CAA-8A2C-0FE2DB8A500D}_is1', 'UninstallString') then  //Your App GUID/ID
  begin
    V := MsgBox(ExpandConstant('Myprogram is Already installed, Do you want to         continue?'), mbInformation, MB_YESNO); //Custom Message if App installed
    if V = IDYES then
    begin
      sUnInstallString := GetUninstallString();
      sUnInstallString :=  RemoveQuotes(sUnInstallString);
      Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated,     iResultCode);
      Result := True; //if you want to proceed after uninstall
                //Exit; //if you want to quit after uninstall
    end
    else
      Result := False; //when older version present and not uninstalled
  end;
end;