1 /* $Id: main.c 12852 2005-01-06 13:58:04Z mf $
3 * PROJECT: ReactOS Multimedia Control Panel
4 * FILE: lib/cpl/mmsys/mmsys.c
5 * PURPOSE: ReactOS Multimedia Control Panel
6 * PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
7 * Johannes Anderwald <janderwald@reactos.com>
19 typedef struct _IMGINFO
28 InitImageInfo(PIMGINFO ImgInfo
)
32 ZeroMemory(ImgInfo
, sizeof(*ImgInfo
));
34 ImgInfo
->hBitmap
= LoadImage(hApplet
,
35 MAKEINTRESOURCE(IDB_SPEAKIMG
),
41 if (ImgInfo
->hBitmap
!= NULL
)
43 GetObject(ImgInfo
->hBitmap
, sizeof(BITMAP
), &bitmap
);
45 ImgInfo
->cxSource
= bitmap
.bmWidth
;
46 ImgInfo
->cySource
= bitmap
.bmHeight
;
51 InitVolumeControls(HWND hwndDlg
)
59 NumWavOut
= waveOutGetNumDevs();
63 // deactivate all controls
67 errcode
= waveOutMessage((HWAVEOUT
)WAVE_MAPPER
, DRVM_MAPPER_PREFERRED_GET
, (DWORD_PTR
)&dwDeviceID
, (DWORD_PTR
)&dwStatus
);
68 if (errcode
!= MMSYSERR_NOERROR
)
70 MessageBox(hwndDlg
, _T("Failed to enumerate default device"), NULL
, MB_OK
);
74 if (waveOutGetDevCaps(dwDeviceID
, &woc
, sizeof(WAVEOUTCAPS
)) != MMSYSERR_NOERROR
)
76 MessageBox(hwndDlg
, _T("waveOutGetDevCaps failed"), NULL
, MB_OK
);
80 SendDlgItemMessage(hwndDlg
, IDC_DEVICE_NAME
, WM_SETTEXT
, (WPARAM
)0, (LPARAM
)woc
.szPname
);
82 if (!(woc
.dwSupport
& WAVECAPS_VOLUME
))
84 /// the device does not support volume changes
85 /// disable volume control
86 EnableWindow(GetDlgItem(hwndDlg
, IDC_VOLUME_TRACKBAR
), FALSE
);
90 SendDlgItemMessage(hwndDlg
, IDC_VOLUME_TRACKBAR
, TBM_SETRANGE
, (WPARAM
)TRUE
, (LPARAM
)MAKELONG(0, 10));
91 SendDlgItemMessage(hwndDlg
, IDC_VOLUME_TRACKBAR
, TBM_SETPAGESIZE
, (WPARAM
)FALSE
, (LPARAM
)1);
92 SendDlgItemMessage(hwndDlg
, IDC_VOLUME_TRACKBAR
, TBM_SETSEL
, (WPARAM
)FALSE
, (LPARAM
)MAKELONG(0, 10));
93 SendDlgItemMessage(hwndDlg
, IDC_VOLUME_TRACKBAR
, TBM_SETPOS
, (WPARAM
)TRUE
, (LPARAM
)4);
97 /* Volume property page dialog callback */
98 //static INT_PTR CALLBACK
100 VolumeDlgProc(HWND hwndDlg
,
105 static IMGINFO ImgInfo
;
106 UNREFERENCED_PARAMETER(lParam
);
107 UNREFERENCED_PARAMETER(wParam
);
113 InitImageInfo(&ImgInfo
);
114 InitVolumeControls(hwndDlg
);
119 LPDRAWITEMSTRUCT lpDrawItem
;
120 lpDrawItem
= (LPDRAWITEMSTRUCT
) lParam
;
121 if(lpDrawItem
->CtlID
== IDC_SPEAKIMG
)
126 /* position image in centre of dialog */
127 left
= (lpDrawItem
->rcItem
.right
- ImgInfo
.cxSource
) / 2;
129 hdcMem
= CreateCompatibleDC(lpDrawItem
->hDC
);
132 SelectObject(hdcMem
, ImgInfo
.hBitmap
);
133 BitBlt(lpDrawItem
->hDC
,
135 lpDrawItem
->rcItem
.top
,
136 lpDrawItem
->rcItem
.right
- lpDrawItem
->rcItem
.left
,
137 lpDrawItem
->rcItem
.bottom
- lpDrawItem
->rcItem
.top
,