- Implement audio selection button

svn path=/trunk/; revision=59220
This commit is contained in:
Johannes Anderwald 2013-06-15 08:23:21 +00:00
parent 24b5b19981
commit ca1b982148
3 changed files with 43 additions and 2 deletions

View file

@ -24,7 +24,8 @@ add_importlibs(mmsys
setupapi
shlwapi
ntdll
kernel32)
kernel32
comdlg32)
add_pch(mmsys mmsys.h)
add_cd_file(TARGET mmsys DESTINATION reactos/system32 FOR all)

View file

@ -17,7 +17,7 @@
#include <devguid.h>
#include <debug.h>
#include <shlwapi.h>
#include <commdlg.h>
#include "resource.h"
//typedef LONG (CALLBACK *APPLET_PROC)(VOID);

View file

@ -904,6 +904,11 @@ SoundsDlgProc(HWND hwndDlg,
WPARAM wParam,
LPARAM lParam)
{
OPENFILENAMEW ofn;
WCHAR filename[MAX_PATH];
LPWSTR pFileName;
LRESULT lResult;
switch (uMsg)
{
case WM_INITDIALOG:
@ -936,6 +941,41 @@ SoundsDlgProc(HWND hwndDlg,
{
switch (LOWORD(wParam))
{
case IDC_BROWSE_SOUND:
{
ZeroMemory(&ofn, sizeof(OPENFILENAMEW));
ofn.lStructSize = sizeof(OPENFILENAMEW);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = filename;
ofn.lpstrFile[0] = L'\0';
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = L"Wave Files (*.wav)\0*.wav\0"; //FIXME non-nls
ofn.nFilterIndex = 0;
ofn.lpstrFileTitle = L"Search for new sounds"; //FIXME non-nls
ofn.nMaxFileTitle = wcslen(ofn.lpstrFileTitle);
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_FILEMUSTEXIST;
if (GetOpenFileNameW(&ofn) == TRUE)
{
// FIXME search if list already contains that sound
// extract file name
pFileName = wcsrchr(filename, L'\\');
ASSERT(pFileName != NULL);
pFileName++;
// add to list
lResult = SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)pFileName);
if (lResult != CB_ERR)
{
// add path and select item
SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)_wcsdup(filename));
SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lResult, (LPARAM)0);
}
}
break;
}
case IDC_PLAY_SOUND:
{
LRESULT lIndex;