在Inno设置中使用ISSI(添加背景图像)时实现事件函数InitializeWizard:重复标识符"INITIALIZEWIZARD" [英] Implementing event functions InitializeWizard while using ISSI (to add background image) in Inno Setup: Duplicate identifier 'INITIALIZEWIZARD'

查看:172
本文介绍了在Inno设置中使用ISSI(添加背景图像)时实现事件函数InitializeWizard:重复标识符"INITIALIZEWIZARD"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to put a background image to Inno Setup installer using ISSI along with a song using the "BASS audio library", but I can only keep one of them active since I get this compiler error:

重复的标识符"INITIALIZEWIZARD"

Duplicate identifier 'INITIALIZEWIZARD'

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

Would I have another way to get a full-screen background image so I can use the BASS audio library?

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;

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

Who can help me, I'm really grateful.

推荐答案

在Inno Setup 6中,它支持事件属性,请参见合并来自不同来源的事件函数(InitializeWizard)的实现.

In Inno Setup 6, with its support for event attributes, see Merging event function (InitializeWizard) implementations from different sources.

[Code]

<event('InitializeWizard')>
procedure InitializeWizard2;
begin
  { Your BASS code goes here }
end;


对于较早版本的Inno Setup:


For older versions of Inno Setup:

Inno设置脚本#Includes(ISSI)可能会实现某些 Inno Setup事件函数,例如InitializeWizardInitializeSetupCurPageChangedBackButtonClickNextButtonClickDeinitializeSetup用于其自身目的.并非必须定义所有事件功能,这取决于您使用的ISSI功能.在您的情况下,是ISSI_BackgroundImage导致实现了InitializeWizard事件函数.

Inno Setup Script #Includes (ISSI) may implement some Inno Setup event functions, like InitializeWizard, InitializeSetup, CurPageChanged, BackButtonClick, NextButtonClick and DeinitializeSetup for its own purposes. Not all event functions are necessarily defined, it depends on ISSI features you are using. In your case, it's the ISSI_BackgroundImage that causes implementation of InitializeWizard event function.

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

If you need to run your own code in some of these event functions, ISSI implementation of event function can call your user defined function, when you define an appropriate preprocessor symbol. The symbol name is like ISSI_EventFunctionName and the user defined function must have the same name. The function/procedure also must have the same signature as the original Inno Setup event function.

在包含_issi.isi之前,必须同时定义符号和用户功能.

Both the symbol and the user function must be defined before you include _issi.isi.

InitializeWizard的示例:

[Code]

procedure ISSI_InitializeWizard;
begin
  { Your BASS code goes here }
end;

#define ISSI_InitializeWizard

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

这篇关于在Inno设置中使用ISSI(添加背景图像)时实现事件函数InitializeWizard:重复标识符"INITIALIZEWIZARD"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆