Цитата: PAnsiChar
Цитата: viktor9
Если перешел на юникод, то замени PChar на PAnsiChar. В анси PChar все так-же работает.
Цитата: Inno не обновлял
Однозначно, если не обновлял, то переустановливал с Анси на Юникод.
перешел на юникод и вот еще ругается
Compile Error!
File: D:\Диск\Докукменты\Files\MP3.iss
Line: 106
Error: Column 5:
Semicolon (';') expected.
[more][Files]
Source: D:\Диск\Докукменты\Files\BASS.dll; DestDir: {tmp}; Flags: dontcopy noencryption
Source: D:\Диск\Докукменты\Files\Music.mp3; DestDir: {tmp}; Flags: dontcopy noencryption nocompression
Source: D:\Диск\Докукменты\Files\MusicButtons.bmp; DestDir: {tmp}; Flags: dontcopy noencryption
[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;
PlayButton, PauseButton, StopButton: TPanel;
PlayImage, PauseImage, StopImage: TBitmapImage;
PlayLabel, PauseLabel, StopLabel: TLabel;
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): 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';
procedure PlayMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if PlayLabel.Enabled then PlayImage.Left := -90
end;
procedure PlayMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PlayImage.Left := 0
end;
procedure PauseMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if PauseLabel.Enabled then PauseImage.Left := -120
end;
procedure PauseMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PauseImage.Left := -30
end;
procedure StopMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if StopLabel.Enabled then StopImage.Left := -150
end;
procedure StopMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
StopImage.Left := -60
end;
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('BASS.dll')
ExtractTemporaryFile('Music.mp3')
mp3Name := ExpandConstant('{tmp}\Music.mp3')
BASS_Init(-1, 44100, 0, 0, 0)
// Музыка начинает проигрываться при запуске инсталла:
mp3Handle := BASS_StreamCreateFile(FALSE, PAnsiChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP)
// Музыка начинает проигрываться только после нажатия кнопки "Play" ("Воспроизведение"):
// mp3Handle := BASS_StreamCreateFile(TRUE, PAnsiChar(mp3Name), 0, 0, BASS_SAMPLE_LOOP)
BASS_Start()
BASS_ChannelPlay(mp3Handle, False)
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, PAnsiChar(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 InitializeMusic();
begin
ExtractTemporaryFile('MusicButtons.bmp')
PlayButton := TPanel.Create(WizardForm)
PlayButton.Left := 33
PlayButton.Top := 284
PlayButton.Width := 30
PlayButton.Height := 20
PlayButton.Cursor := crHand
PlayButton.ShowHint := True
PlayButton.Hint := 'Воспроизведение музыки'
PlayButton.OnClick := @PlayButtonOnClick
PlayButton.Parent := WizardForm
PlayImage := TBitmapImage.Create(WizardForm)
PlayImage.Left := 0
PlayImage.Top := 0
PlayImage.Width := 180
PlayImage.Height := 20
PlayImage.Enabled := False
PlayImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MusicButtons.bmp'))
PlayImage.Parent := PlayButton
PlayLabel := TLabel.Create(WizardForm)
PlayLabel.Width := PlayButton.Width
PlayLabel.Height := PlayButton.Height
PlayLabel.Autosize := False
PlayLabel.Transparent := True
PlayLabel.OnClick := @PlayButtonOnClick
PlayLabel.OnMouseDown := @PlayMouseDown
PlayLabel.OnMouseUp := @PlayMouseUp
PlayLabel.Parent := PlayButton
PauseButton := TPanel.Create(WizardForm)
PauseButton.Left := 66
PauseButton.Top := 284
PauseButton.Width := 30
PauseButton.Height := 20
PauseButton.Cursor := crHand
PauseButton.ShowHint := True
PauseButton.Hint := 'Приостановить музыку'
PauseButton.OnClick := @PauseButtonOnClick
PauseButton.Parent := WizardForm
PauseImage := TBitmapImage.Create(WizardForm)
PauseImage.Left := -30
PauseImage.Top := 0
PauseImage.Width := 180
PauseImage.Height := 20
PauseImage.Enabled := False
PauseImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MusicButtons.bmp'))
PauseImage.Parent := PauseButton
PauseLabel := TLabel.Create(WizardForm)
PauseLabel.Width := PauseButton.Width
PauseLabel.Height := PauseButton.Height
PauseLabel.Autosize := False
PauseLabel.Transparent := True
PauseLabel.OnClick := @PauseButtonOnClick
PauseLabel.OnMouseDown := @PauseMouseDown
PauseLabel.OnMouseUp := @PauseMouseUp
PauseLabel.Parent := PauseButton
StopButton := TPanel.Create(WizardForm)
StopButton.Left := 99
StopButton.Top := 284
StopButton.Width := 30
StopButton.Height := 20
StopButton.Cursor := crHand
StopButton.ShowHint := True
StopButton.Hint := 'Остановить музыку'
StopButton.OnClick := @StopButtonOnClick
StopButton.Parent := WizardForm
StopImage := TBitmapImage.Create(WizardForm)
StopImage.Left := -60
StopImage.Top := 0
StopImage.Width := 180
StopImage.Height := 20
StopImage.Enabled := False
StopImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MusicButtons.bmp'))
StopImage.Parent := StopButton
StopLabel := TLabel.Create(WizardForm)
StopLabel.Width := StopButton.Width
StopLabel.Height := StopButton.Height
StopLabel.Autosize := False
StopLabel.Transparent := True
StopLabel.OnClick := @StopButtonOnClick
StopLabel.OnMouseDown := @StopMouseDown
StopLabel.OnMouseUp := @StopMouseUp
StopLabel.Parent := StopButton
end;
procedure DeinitializeSetup();
begin
BASS_Stop()
BASS_Free()
end;
[/more]