SotM Спасибки
Aion13 3) Вот кнопки для проигрования музыки, тока там их 3-и: play, pause, stop.
[more]
[Setup]
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
DefaultDirName=C:\example
[Files]
Source: BASS.dll; DestDir: " {tmp} "; Flags: dontcopy noencryption
Source: sound.mp3; DestDir: "{tmp}"; Flags: dontcopy noencryption nocompression
[Code]
const
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_SAMPLE_LOOP = 4;
var
mp3Handle: HWND;
mp3Name: string;
function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean;
external 'BASS_Init@files:BASS.dll stdcall delayload';
function BASS_StreamCreateFile(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): DWORD;
external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
function BASS_Start(): Boolean;
external 'BASS_Start@files:BASS.dll stdcall delayload';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean;
external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
function BASS_ChannelIsActive(handle: DWORD): Integer;
external 'BASS_ChannelIsActive@files:BASS.dll stdcall delayload';
function BASS_ChannelPause(handle: DWORD): Boolean;
external 'BASS_ChannelPause@files:BASS.dll stdcall delayload';
function BASS_Stop(): Boolean;
external 'BASS_Stop@files:BASS.dll stdcall delayload';
function BASS_Pause(): Boolean;
external 'BASS_Pause@files:BASS.dll stdcall delayload';
function BASS_Free(): Boolean;
external 'BASS_Free@files:BASS.dll stdcall delayload';
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('BASS.dll');
ExtractTemporaryFile('sound.mp3');
mp3Name := ExpandConstant('{tmp}\sound.mp3');
mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP);
Result := True;
end;
procedure PlayButtonOnClick(Sender: TObject);
begin
case BASS_ChannelIsActive(mp3Handle) of
BASS_ACTIVE_PAUSED:
begin
BASS_ChannelPlay(mp3Handle, False);
end;
BASS_ACTIVE_STOPPED:
begin
BASS_Init(-1, 44100, 0, 0, 0);
mp3Handle := BASS_StreamCreateFile(FALSE, PChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP);
BASS_Start();
BASS_ChannelPlay(mp3Handle, False);
end;
end;
end;
procedure PauseButtonOnClick(Sender: TObject);
begin
BASS_ChannelPause(mp3Handle);
end;
procedure StopButtonOnClick(Sender: TObject);
begin
BASS_Stop();
BASS_Free();
end;
procedure InitializeWizard();
var
Name1: string;
PlayButton, PauseButton, StopButton: TButton;
Text: TNewStaticText;
Panel1: TPanel;
begin
WizardForm.Position := poScreenCenter;
WizardForm.CancelButton.BringToFront;
begin
Panel1 := TPanel.Create(WizardForm);
with Panel1 do
begin
Panel1.Parent := WizardForm;
Panel1.Left := ScaleX(1);
Panel1.Top := ScaleY(315);
Panel1.Width := ScaleX(165);
Panel1.Height := ScaleY(46);
Panel1.TabOrder := 0;
Panel1.Color := clWhite;
Panel1.BevelInner := bvLowered;
Panel1.BevelOuter := bvRaised;
Panel1.BorderStyle := bsSingle;
PlayButton := TButton.Create(WizardForm);
PlayButton.Left := 5;
PlayButton.Top := 335;
PlayButton.Width := 50;
PlayButton.Height := 20;
PlayButton.Caption := 'play';
PlayButton.OnClick := @PlayButtonOnClick;
PlayButton.Parent := WizardForm;
PlayButton.Cursor := crHand;
PauseButton := TButton.Create(WizardForm);
PauseButton.Left := 58;
PauseButton.Top := 335;
PauseButton.Width := 50;
PauseButton.Height := 20;
PauseButton.Caption := 'pause';
PauseButton.OnClick := @PauseButtonOnClick;
PauseButton.Parent := WizardForm;
PauseButton.Cursor := crHand;
StopButton := TButton.Create(WizardForm);
StopButton.Left := 111;
StopButton.Top := 335;
StopButton.Width := 50;
StopButton.Height := 20;
StopButton.Caption := 'stop';
StopButton.OnClick := @StopButtonOnClick;
StopButton.Parent := WizardForm;
StopButton.Cursor := crHand;
Text := TNewStaticText.Create(WizardForm);
Text.Caption := 'music';
Text.Parent := WizardForm;
Text.Font.Style := Text.Font.Style + [fsUnderline];
Text.Font.Color := clNavy;
Text.Top := 319;
Text.Left := 71;
Text.Color := clWhite;
end;
end;
end;
procedure DeinitializeSetup();
begin
BASS_Stop();
BASS_Free();
end;
[/more], это я дал тебе скрипт из
"Сборника вопросов" с этого сайта, там много всего полезного, почитай.