View Single Post
  #76  
Old 05-11-2014, 00:47
Dante1995 Dante1995 is offline
Banned
 
Join Date: Feb 2014
Location: Black Hole
Posts: 297
Thanks: 116
Thanked 481 Times in 162 Posts
Dante1995 is on a distinguished road
Quote:
Originally Posted by minh_k43sj View Post
great
you can add music background to scrip ?
Code:
[Files]
Source: File\Bass.dll; DestDir: {tmp}; Flags: dontcopy deleteafterinstall noencryption nocompression
Source: File\music.mp3; DestDir: {tmp}; Flags: dontcopy deleteafterinstall noencryption nocompression

[ Code]
type
HSTREAM = DWORD;

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: PAnsiChar; offset: DWORD; length: DWORD; flags: DWORD): HSTREAM;
external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
function BASS_Start(): Boolean;
external 'BASS_Start@files:BASS.dll stdcall delayload';
function BASS_Pause(): Boolean;
external 'BASS_Pause@files:BASS.dll stdcall delayload';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean;
external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
function BASS_Stop(): Boolean;
external 'BASS_Stop@files:BASS.dll stdcall delayload';
function BASS_Free(): Boolean;
external 'BASS_Free@files:BASS.dll stdcall delayload';


const
BASS_SAMPLE_LOOP = 4;

var
MusicButton: TButton;
Name: string;
i : Integer;

procedure MusicButtonOnClick(Sender: TObject);
begin
if MusicButton.Caption = 'Music On' then
begin
MusicButton.Caption := 'Music Off';
BASS_Pause;
end else 
begin                                                
MusicButton.Caption := 'Music On';
BASS_Start;
end;
end;

procedure InitializeWizard();
begin
ExtractTemporaryFile('BASS.dll');
ExtractTemporaryFile('music.mp3');
if BASS_Init(-1, 44100, 0, 0, 0) then
begin
BASS_Start;
Name:=ExpandConstant('{tmp}\music.mp3');
i:=BASS_StreamCreateFile(FALSE, PAnsiChar(Name), 0, 0, 4);
if i <> 0 then
begin
BASS_ChannelPlay(i, True);
end;

MusicButton := TNewButton.Create(WizardForm);
MusicButton.Parent := WizardForm;
MusicButton.SetBounds(4,337,131,20);
MusicButton.Caption := 'Music On';
MusicButton.OnClick:=@MusicButtonOnClick;
end;
end;

procedure DeinitializeSetup();
begin
BASS_Stop;
BASS_Free;
end;
Reply With Quote
The Following 2 Users Say Thank You to Dante1995 For This Useful Post:
Andrey167 (05-11-2014), minh_k43sj (05-11-2014)
Sponsored Links