在Inno设置中使用ISSI(添加背景图像)时实现事件函数InitializeWizard:重复标识符“ INITIALIZEWIZARD”

时间:2018-11-22 02:27:15

标签: inno-setup pascalscript bass

我正在尝试使用ISSI将背景图片和一首使用“ BASS音频库”的歌曲放到Inno Setup安装程序中,但是由于出现此编译器错误,我只能保持其中一个处于活动状态:

  

重复的标识符“ INITIALIZEWIZARD”

我还有另一种获取全屏背景图像的方法,以便可以使用BASS音频库吗?

Inno设置代码:

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

#define ISSI_BackgroundImage "E:\Instalador\file.bmp"

#define ISSI_BackgroundImage_BGColor "clWhite"

#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"

[Files]
Source: "Bass.dll"; Flags: dontcopy
Source: "AudioFile.mp3"; Flags: dontcopy

[Code]
const
  BASS_SAMPLE_LOOP = 4;
  BASS_UNICODE = $80000000;
  BASS_CONFIG_GVOL_STREAM = 5;
const
  #ifndef UNICODE
    EncodingFlag = 0;
  #else
    EncodingFlag = BASS_UNICODE;
  #endif
type
  HSTREAM = DWORD;

function BASS_Init(device: LongInt; freq, flags: DWORD;
  win: HWND; clsid: Cardinal): BOOL;
  external 'BASS_Init@files:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD;
  offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
  external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
  external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
  external 'BASS_SetConfig@files:bass.dll stdcall';
function BASS_Free: BOOL;
  external 'BASS_Free@files:bass.dll stdcall';

procedure InitializeWizard;
var
  StreamHandle: HSTREAM;
begin
  ExtractTemporaryFile('AudioFile.mp3');
  if BASS_Init(-1, 44100, 0, 0, 0) then
  begin
    StreamHandle := BASS_StreamCreateFile(False,
      ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0,
      EncodingFlag or BASS_SAMPLE_LOOP);
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
    BASS_ChannelPlay(StreamHandle, False);
  end;
end;

procedure DeinitializeSetup;
begin
  BASS_Free;
end;

谁能帮助我,我真的很感激。

1 个答案:

答案 0 :(得分:0)

Inno Setup Script #Includes (ISSI)可以实现一些Inno Setup event functions,例如InitializeWizardInitializeSetupCurPageChangedBackButtonClickNextButtonClick和{{ 1}}。并非所有事件功能都必须定义,这取决于您使用的ISSI功能。对于您而言,是DeinitializeSetup导致实现ISSI_BackgroundImage事件函数。

如果需要在其中一些事件函数中运行自己的代码,则在定义适当的预处理器符号时,事件函数的ISSI实现可以调用用户定义的函数。符号名称类似于InitializeWizard,并且用户定义的函数必须具有相同的名称。该功能/过程还必须具有与原始Inno Setup事件功能相同的签名。

在包含ISSI_EventFunctionName之前,必须先定义符号和用户功能。

_issi.isi的示例:

InitializeWizard