2016-11-09 2 views
1

지금 원하는 스크립트를 결합하고 있지만 오류가 있습니다.다른 소스의 이벤트 함수 (InitializeWizard) 병합 구현

Screenshot

내가 기간을 넣을 때, 실행되지만 다른 기능이없는 것입니다.

procedure InitializeWizard; 
begin 
    MessageBoxTimeout(WizardForm.Handle, 'MsgBox ' + 
    Timeout 'Setup', MB_OK or MB_ICONINFORMATION, 0, 2000); 
end; 

var 
    TuneLabel: TLabel; 

begin 
    ExtractTemporaryFile('tune.xm'); 
    if BASS_Init(-1, 44100, 0, 0, 0) then 
    begin 
    SoundCtrlButton := TNewButton.Create(WizardForm); 
    Music := BASS_MusicLoad(False, 
     ExpandConstant('{tmp}\tune.xm'), 0, 0, 
     EncodingFlag or BASS_SAMPLE_LOOP, 0); 
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 10000); 
    BASS_ChannelPlay(Music, False); 

    SoundCtrlButton := TNewButton.Create(WizardForm); 
    SoundCtrlButton.Parent := WizardForm; 
    SoundCtrlButton.Left := 10; 
    SoundCtrlButton.TabStop := False; 
    SoundCtrlButton.Top := WizardForm.ClientHeight - 
     SoundCtrlButton.Height - 9; 
    SoundCtrlButton.Width := 40; 
    SoundCtrlButton.Caption := 
     ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}'); 
    SoundCtrlButton.OnClick := @SoundCtrlButtonClick; 
    TuneLabel := TLabel.Create(WizardForm); 
    TuneLabel.Parent := WizardForm; 
    TuneLabel.Caption := 'Tune'; 
    TuneLabel.Left := SoundCtrlButton.Left + SoundCtrlButton.Width + ScaleX(5); 
    TuneLabel.Top := 
     SoundCtrlButton.Top + ((SoundCtrlButton.Height - TuneLabel.Height) div 2); 
    end; 
end; 

오류가 마지막 end; 후에 라인을 참조 :

여기 내 코드입니다.

도와주세요.

답변

1

다른 소스의 다양한 기능 구현을 재사용하는 경우 일반적으로 동일한 Inno Setup event functions (예 : InitializeWizard)을 구현합니다.

하나의 함수 구현 만있을 수 있으므로 이러한 이벤트 함수를 병합해야합니다.

고유 한 접미어를 다른 구현에 추가하고 기본 구현에서이를 호출하여 수행 할 수 있습니다.

주요 구현은 다른 구현보다 낮아야합니다. 하나의 소스 InitializeWizard 이벤트 기능을 갖는 경우, 예를 들어

로서 구현 :

var 
    GlobalVariable1: Integer; 

procedure SubProcedure1; 
begin 
    { blah } 
end; 

procedure InitializeWizard; 
var 
    Variable1: Integer; 
    Variable2: Integer; 
begin 
    Variable1 := GlobalVariable1; 
    SubProcedure1; 
end; 

다른 소스로서 : 다음 병합

var 
    GlobalVariableA: Integer; 

procedure SubProcedureA; 
begin 
    { blah } 
end; 

procedure InitializeWizard; 
var 
    VariableA: Integer; 
begin 
    VariableA := GlobalVariableA; 
    SubProcedureA; 
end; 

코드 같아야

var 
    GlobalVariable1: Integer; 

procedure SubProcedure1; 
begin 
    { blah } 
end; 

procedure InitializeWizard1; 
var 
    Variable1: Integer; 
    Variable2: Integer; 
begin 
    Variable1 := GlobalVariable1; 
    SubProcedure1; 
end; 

var 
    GlobalVariableA: Integer; 

procedure SubProcedureA; 
begin 
    { blah } 
end; 

procedure InitializeWizard2; 
var 
    VariableA: Integer; 
begin 
    VariableA := GlobalVariableA; 
    SubProcedureA; 
end; 

procedure InitializeWizard; 
begin 
    InitializeWizard1; 
    InitializeWizard2; 
end; 

도 참조하십시오. Inno Setup - Merging implementations of event functions that return boolean (like InitializeSetup).


그래서, 특정 경우에 코드가 있어야한다 :

procedure InitializeWizard1; 
begin 
    MessageBoxTimeout(WizardForm.Handle, 'MsgBox ' + 
    Timeout 'Setup', MB_OK or MB_ICONINFORMATION, 0, 2000); 
end; 

procedure InitializeWizard2; 
var 
    TuneLabel: TLabel; 
begin 
    ExtractTemporaryFile('tune.xm'); 
    if BASS_Init(-1, 44100, 0, 0, 0) then 
    begin 
    SoundCtrlButton := TNewButton.Create(WizardForm); 
    Music := BASS_MusicLoad(False, 
     ExpandConstant('{tmp}\tune.xm'), 0, 0, 
     EncodingFlag or BASS_SAMPLE_LOOP, 0); 
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 10000); 
    BASS_ChannelPlay(Music, False); 

    SoundCtrlButton := TNewButton.Create(WizardForm); 
    SoundCtrlButton.Parent := WizardForm; 
    SoundCtrlButton.Left := 10; 
    SoundCtrlButton.TabStop := False; 
    SoundCtrlButton.Top := WizardForm.ClientHeight - 
     SoundCtrlButton.Height - 9; 
    SoundCtrlButton.Width := 40; 
    SoundCtrlButton.Caption := 
     ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}'); 
    SoundCtrlButton.OnClick := @SoundCtrlButtonClick; 
    TuneLabel := TLabel.Create(WizardForm); 
    TuneLabel.Parent := WizardForm; 
    TuneLabel.Caption := 'Tune'; 
    TuneLabel.Left := SoundCtrlButton.Left + SoundCtrlButton.Width + ScaleX(5); 
    TuneLabel.Top := 
     SoundCtrlButton.Top + ((SoundCtrlButton.Height - TuneLabel.Height) div 2); 
    end; 
end; 

procedure InitializeWizard; 
begin 
    InitializeWizard1; 
    InitializeWizard2; 
end;