https://git.reactos.org/?p=reactos.git;a=commitdiff;h=722797c779e1bd8f2b927…
commit 722797c779e1bd8f2b927e22f5b841db64901707
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Feb 24 16:12:55 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Feb 24 16:16:53 2019 +0100
[SNDVOL32] Disable only the 'Play' button, when no audio device is
avaiblable.
---
dll/cpl/mmsys/sounds.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/dll/cpl/mmsys/sounds.c b/dll/cpl/mmsys/sounds.c
index 5d89dfd6aa..79ee1f28a7 100644
--- a/dll/cpl/mmsys/sounds.c
+++ b/dll/cpl/mmsys/sounds.c
@@ -57,6 +57,7 @@ typedef struct _GLOBAL_DATA
HIMAGELIST hSoundsImageList;
PLABEL_MAP pLabelMap;
PAPP_MAP pAppMap;
+ UINT NumWavOut;
} GLOBAL_DATA, *PGLOBAL_DATA;
@@ -1107,11 +1108,11 @@ SoundsDlgProc(HWND hwndDlg,
{
case WM_INITDIALOG:
{
- UINT NumWavOut = waveOutGetNumDevs();
-
pGlobalData = (PGLOBAL_DATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLOBAL_DATA));
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
+ pGlobalData->NumWavOut = waveOutGetNumDevs();
+
SendMessage(GetDlgItem(hwndDlg, IDC_PLAY_SOUND),
BM_SETIMAGE,(WPARAM)IMAGE_ICON,
(LPARAM)(HANDLE)LoadIcon(hApplet,
MAKEINTRESOURCE(IDI_PLAY_ICON)));
@@ -1127,14 +1128,6 @@ SoundsDlgProc(HWND hwndDlg,
LoadSoundFiles(hwndDlg);
ShowSoundScheme(pGlobalData, hwndDlg);
- if (!NumWavOut)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SAVEAS_BTN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_BTN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SCHEME_LIST), FALSE);
- }
-
if (wParam == (WPARAM)GetDlgItem(hwndDlg, IDC_SOUND_SCHEME))
return TRUE;
SetFocus(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME));
@@ -1257,7 +1250,7 @@ SoundsDlgProc(HWND hwndDlg,
///
_tcscpy(pLabelContext->szValue, (TCHAR*)lResult);
}
- if (_tcslen((TCHAR*)lResult) && lIndex != 0)
+ if (_tcslen((TCHAR*)lResult) && lIndex != 0
&& pGlobalData->NumWavOut != 0)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), TRUE);
}
@@ -1322,7 +1315,8 @@ SoundsDlgProc(HWND hwndDlg,
break;
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), TRUE);
+ if (pGlobalData->NumWavOut != 0)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), TRUE);
lCount = ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_SOUND_LIST));
for (lIndex = 0; lIndex < lCount; lIndex++)