function MainDlgFunc(hWnd: hWnd; uMSG: Dword; wParam: wParam; lParam: lParam)
: Bool; stdcall;
begin
Result := True;
case uMSG of
WM_INITDIALOG:
begin
CheckRadioButton(hWnd, 12, 13, 12);
BoxedAppSDK_Init;
hFile := BoxedAppSDK_CreateVirtualFile(PAnsiChar('fox.mp3'),
// MyMP3.mp3 fox
GENERIC_WRITE, FILE_SHARE_READ, nil, CREATE_NEW, 0, 0);
HandleStream := THandleStream.Create(hFile);
ResourceStream := TResourceStream.Create(0, 'intro', RT_RCDATA);
HandleStream.CopyFrom(ResourceStream, ResourceStream.Size);
end;
WM_CLOSE:
EndDialog(hWnd, 0);
WM_DESTROY:
PostQuitMessage(0);
WM_COMMAND:
begin
case wParam of
11:
begin
if IsDlgButtonChecked(hWnd, 12) = BST_CHECKED then
begin
_FreeAll;
if not FSOUND_Init(44100, 32, 0) then
MessageBox(0, 'Error initializing audio!', nil, 0);
hMod := FSOUND_Stream_Open('fox.mp3', 1, 0, 0);
if (hMod = nil) then
MessageBox(0, 'Could not create user stream', nil, 0);
if FSOUND_Stream_Play(0, hMod) < 0 then
MessageBox(0, 'Error playing music!', nil, 0);
end;
if IsDlgButtonChecked(hWnd, 13) = BST_CHECKED then
begin
_FreeAll;
if not BASS_Init(-1, 44100, 0, 0, nil) then
MessageBox(0, 'Error initializing audio!', nil, 0);
mods := BASS_StreamCreateFile(false, Pchar('fox.mp3'), 0, 0,
BASS_MUSIC_RAMP);
if (mods = 0) then
MessageBox(0, 'Could not create user stream', nil, 0);
if not BASS_ChannelPlay(mods, True) then
MessageBox(0, 'Error playing music!', nil, 0);
end;
end;
end;
end
else
Result := false;
end;
end;