Author: akhaldi
Date: Fri Mar 20 10:44:36 2015
New Revision: 66833
URL:
http://svn.reactos.org/svn/reactos?rev=66833&view=rev
Log:
[MPLAY32] Add entries for found mci devices in the "Device" menu. By Ricardo
Hanke. CORE-9385
Modified:
trunk/reactos/base/applications/mplay32/lang/bg-BG.rc
trunk/reactos/base/applications/mplay32/lang/cs-CZ.rc
trunk/reactos/base/applications/mplay32/lang/de-DE.rc
trunk/reactos/base/applications/mplay32/lang/en-US.rc
trunk/reactos/base/applications/mplay32/lang/es-ES.rc
trunk/reactos/base/applications/mplay32/lang/fr-FR.rc
trunk/reactos/base/applications/mplay32/lang/he-IL.rc
trunk/reactos/base/applications/mplay32/lang/it-IT.rc
trunk/reactos/base/applications/mplay32/lang/ja-JP.rc
trunk/reactos/base/applications/mplay32/lang/nl-NL.rc
trunk/reactos/base/applications/mplay32/lang/no-NO.rc
trunk/reactos/base/applications/mplay32/lang/pl-PL.rc
trunk/reactos/base/applications/mplay32/lang/pt-BR.rc
trunk/reactos/base/applications/mplay32/lang/ro-RO.rc
trunk/reactos/base/applications/mplay32/lang/ru-RU.rc
trunk/reactos/base/applications/mplay32/lang/sk-SK.rc
trunk/reactos/base/applications/mplay32/lang/sq-AL.rc
trunk/reactos/base/applications/mplay32/lang/sv-SE.rc
trunk/reactos/base/applications/mplay32/lang/tr-TR.rc
trunk/reactos/base/applications/mplay32/lang/uk-UA.rc
trunk/reactos/base/applications/mplay32/lang/zh-CN.rc
trunk/reactos/base/applications/mplay32/lang/zh-TW.rc
trunk/reactos/base/applications/mplay32/mplay32.c
trunk/reactos/base/applications/mplay32/resource.h
Modified: trunk/reactos/base/applications/mplay32/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/bg-BG.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -26,6 +26,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/cs-CZ.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/cs-CZ.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/cs-CZ.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -27,6 +27,7 @@
END
POPUP "&ZaÅÃzenÃ"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Vlastnosti", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "Ovládánà &hlasitosti", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/de-DE.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Gerät"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Eigenschaften", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Lautstärkeregelung", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/en-US.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/es-ES.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Dispositivo"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Propiedades", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "Control de &volumen", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/fr-FR.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "Périp&hérique"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Propriétés", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "Contrôle du &volume", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/he-IL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/he-IL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/he-IL.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/it-IT.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/ja-JP.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/ja-JP.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/ja-JP.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/nl-NL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/nl-NL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/nl-NL.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/no-NO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/no-NO.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/pl-PL.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -30,6 +30,7 @@
END
POPUP "&UrzÄ
dzenie"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "WÅaÅ&ciwoÅci", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Regulacja gÅoÅnoÅci", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/pt-BR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/pt-BR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/pt-BR.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -24,6 +24,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/ro-RO.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -28,6 +28,7 @@
END
POPUP "&Dispozitiv"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&ProprietÄÈiâ¦", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "Control &volumâ¦", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/ru-RU.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -22,6 +22,7 @@
END
POPUP "&УÑÑÑойÑÑво"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&СвойÑÑва", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&ÐÑомкоÑÑÑ", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/sk-SK.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -27,6 +27,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/sq-AL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/sq-AL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/sq-AL.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -26,6 +26,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/sv-SE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/sv-SE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/sv-SE.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -29,6 +29,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/tr-TR.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -24,6 +24,7 @@
END
POPUP "&Aygıt"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Husûsiyetler", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Ses Düzeyi Denetimi", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/uk-UA.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -30,6 +30,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/zh-CN.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/zh-CN.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/zh-CN.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -24,6 +24,7 @@
END
POPUP "设å¤(&D)"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "å±æ§(&P)", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "é³éæ§å¶(&V)", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/lang/zh-TW.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/lang/zh-TW.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/lang/zh-TW.rc [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -30,6 +30,7 @@
END
POPUP "&Device"
BEGIN
+ MENUITEM SEPARATOR
MENUITEM "&Properties", IDM_DEVPROPS
MENUITEM SEPARATOR
MENUITEM "&Volume Control", IDM_VOLUMECTL
Modified: trunk/reactos/base/applications/mplay32/mplay32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -483,6 +483,38 @@
return mciError;
}
+static BOOL
+DeviceUsesFiles(LPTSTR lpDeviceName)
+{
+ MCIERROR mciError;
+ MCI_OPEN_PARMS mciOpen;
+ MCI_GETDEVCAPS_PARMS mciDevCaps;
+ MCI_GENERIC_PARMS mciGeneric;
+
+ mciOpen.dwCallback = 0;
+ mciOpen.wDeviceID = 0;
+ mciOpen.lpstrDeviceType = lpDeviceName;
+ mciOpen.lpstrElementName = NULL;
+ mciOpen.lpstrAlias = NULL;
+
+ mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_WAIT,
(DWORD_PTR)&mciOpen);
+ if (mciError != 0)
+ return FALSE;
+
+ mciDevCaps.dwCallback = 0;
+ mciDevCaps.dwReturn = 0;
+ mciDevCaps.dwItem = MCI_GETDEVCAPS_USES_FILES;
+
+ mciError = mciSendCommand(mciOpen.wDeviceID, MCI_GETDEVCAPS, MCI_WAIT |
MCI_GETDEVCAPS_ITEM, (DWORD_PTR)&mciDevCaps);
+ if (mciError != 0)
+ return FALSE;
+
+ mciGeneric.dwCallback = 0;
+ mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
+
+ return (BOOL)mciDevCaps.dwReturn;
+}
+
static MCIERROR
CloseMciDevice(VOID)
{
@@ -509,7 +541,7 @@
MCIERROR mciError;
MCI_STATUS_PARMS mciStatus;
MCI_OPEN_PARMS mciOpen;
- DWORD dwFlags = MCI_OPEN_ELEMENT | MCI_WAIT;
+ DWORD dwFlags = MCI_WAIT;
LPTSTR lpStr;
if (wDeviceId)
@@ -524,6 +556,9 @@
if (lpType)
dwFlags |= MCI_OPEN_TYPE;
+ if (lpFileName)
+ dwFlags |= MCI_OPEN_ELEMENT;
+
mciError = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD_PTR)&mciOpen);
if (mciError != 0)
return mciError;
@@ -562,11 +597,16 @@
/* NOTE: Everything above this line may be done instead in OpenMediaFile() */
- lpStr = _tcsrchr(lpFileName, _T('\\'));
- if (lpStr) // Get only the file name (skip the last path separator)
- lpStr++;
+ if (lpFileName)
+ {
+ lpStr = _tcsrchr(lpFileName, _T('\\'));
+ if (lpStr) // Get only the file name (skip the last path separator)
+ lpStr++;
+ else
+ lpStr = lpFileName;
+ }
else
- lpStr = lpFileName;
+ lpStr = lpType;
StringCbCopy(szCurrentFile, sizeof(szCurrentFile), lpStr);
@@ -852,7 +892,7 @@
}
static VOID
-OpenMediaFile(HWND hwnd, LPTSTR lpFileName)
+OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
{
MCIERROR mciError;
@@ -862,7 +902,7 @@
if (wDeviceId)
CloseMediaFile(hwnd);
- mciError = OpenMciDevice(hwnd, NULL, lpFileName);
+ mciError = OpenMciDevice(hwnd, lpType, lpFileName);
if (mciError != 0)
{
ShowMCIError(hwnd, mciError);
@@ -872,8 +912,45 @@
StartPlayback(hwnd);
}
-static VOID
-BuildFileFilter(VOID)
+static DWORD
+InsertDeviceMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD
dwDeviceIndex)
+{
+ MENUITEMINFO lpmii;
+ MCIERROR mciError;
+ TCHAR szDeviceName[MAX_MCISTR];
+ TCHAR szFriendlyName[MAX_MCISTR];
+
+ mciError = GetDeviceName(dwDeviceIndex, szDeviceName, sizeof(szDeviceName));
+ if (mciError)
+ {
+ return mciError;
+ }
+
+ mciError = GetDeviceFriendlyName(szDeviceName, szFriendlyName,
sizeof(szFriendlyName));
+ if (mciError)
+ {
+ return mciError;
+ }
+
+ if (DeviceUsesFiles(szDeviceName))
+ {
+ StringCbCat(szFriendlyName, sizeof(szFriendlyName), _T("..."));
+ }
+
+ ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
+ lpmii.cbSize = sizeof(lpmii);
+ lpmii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID;
+ lpmii.wID = uItemID;
+ lpmii.fType = MF_STRING;
+ lpmii.dwTypeData = szFriendlyName;
+ lpmii.dwItemData = dwDeviceIndex;
+ InsertMenuItem(hMenu, uItem, fByPosition, &lpmii);
+
+ return 0;
+}
+
+static VOID
+BuildFileFilterAndDeviceMenu(VOID)
{
TCHAR szDeviceName[MAX_MCISTR];
TCHAR szFriendlyName[MAX_MCISTR];
@@ -891,6 +968,7 @@
DWORD dwFilterSize;
DWORD dwDeviceSize;
DWORD dwExtensionLen;
+ DWORD dwPosition = 0;
DWORD i;
DWORD j;
UINT uSizeRemain;
@@ -952,6 +1030,10 @@
{
continue;
}
+
+ /* Insert a menu item under the "Device" menu for every found MCI
device */
+ InsertDeviceMenuItem(GetSubMenu(hMainMenu, 3), dwPosition, TRUE, IDM_DEVICE_FIRST
+ dwPosition, j);
+ dwPosition++;
/* Copy the default extension list, that may be overwritten after... */
StringCbCopy(szExtensionList, dwMaskLen * sizeof(TCHAR), szDefaultExtension);
@@ -1065,7 +1147,7 @@
}
static VOID
-OpenFileDialog(HWND hwnd)
+OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
{
OPENFILENAME OpenFileName;
TCHAR szFile[MAX_PATH + 1] = _T("");
@@ -1087,11 +1169,46 @@
OpenFileName.lpstrInitialDir = szCurrentDir;
OpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST |
OFN_HIDEREADONLY | OFN_SHAREAWARE;
OpenFileName.lpstrDefExt = _T("\0");
+ OpenFileName.nFilterIndex = dwFilterIndex;
if (!GetOpenFileName(&OpenFileName))
return;
- OpenMediaFile(hwnd, OpenFileName.lpstrFile);
+ OpenMediaFile(hwnd, OpenFileName.lpstrFile, lpType);
+}
+
+static VOID
+HandleDeviceMenuItem(HWND hwnd, UINT uItem)
+{
+ MENUITEMINFO lpmii;
+ TCHAR szDeviceName[MAX_MCISTR];
+ MCIERROR mciError;
+
+ ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
+ lpmii.cbSize = sizeof(lpmii);
+ lpmii.fMask = MIIM_DATA;
+ GetMenuItemInfo(hMainMenu, uItem, FALSE, &lpmii);
+
+ mciError = GetDeviceName(lpmii.dwItemData, szDeviceName, sizeof(szDeviceName));
+ if (mciError)
+ {
+ ShowMCIError(hwnd, mciError);
+ return;
+ }
+
+ if (DeviceUsesFiles(szDeviceName))
+ {
+ OpenFileDialog(hwnd, uItem - IDM_DEVICE_FIRST + 1, szDeviceName);
+ return;
+ }
+
+ mciError = OpenMciDevice(hwnd, szDeviceName, NULL);
+ if (mciError)
+ {
+ ShowMCIError(hwnd, mciError);
+ }
+
+ return;
}
LRESULT CALLBACK
@@ -1114,7 +1231,7 @@
drophandle = (HDROP)wParam;
DragQueryFile(drophandle, 0, droppedfile, ARRAYSIZE(droppedfile));
DragFinish(drophandle);
- OpenMediaFile(hwnd, droppedfile);
+ OpenMediaFile(hwnd, droppedfile, NULL);
break;
}
@@ -1241,6 +1358,12 @@
case WM_COMMAND:
{
+ if (LOWORD(wParam) >= IDM_DEVICE_FIRST)
+ {
+ HandleDeviceMenuItem(hwnd, LOWORD(wParam));
+ break;
+ }
+
switch (LOWORD(wParam))
{
case IDC_PLAY:
@@ -1249,7 +1372,7 @@
if (wDeviceId)
TogglePlaybackState(hwnd);
else
- OpenFileDialog(hwnd);
+ OpenFileDialog(hwnd, 1, NULL);
break;
}
@@ -1276,7 +1399,7 @@
break;
case IDM_OPEN_FILE:
- OpenFileDialog(hwnd);
+ OpenFileDialog(hwnd, 1, NULL);
return 0;
case IDM_CLOSE_FILE:
@@ -1383,7 +1506,7 @@
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(ID_ACCELERATORS));
- BuildFileFilter();
+ BuildFileFilterAndDeviceMenu();
DragAcceptFiles(hwnd, TRUE);
@@ -1399,7 +1522,7 @@
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
- OpenMediaFile(hwnd, lpCmdLine);
+ OpenMediaFile(hwnd, lpCmdLine, NULL);
/* Message Loop */
while (GetMessage(&msg, NULL, 0, 0))
Modified: trunk/reactos/base/applications/mplay32/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/resource.h [iso-8859-1] Fri Mar 20 10:44:36
2015
@@ -52,6 +52,9 @@
#define IDM_REPEAT 1006
#define IDM_SWITCHVIEW 1007
+/* The device specific items in the device menu start here */
+#define IDM_DEVICE_FIRST 10000
+
/* ToolBar Icons */
#define TBICON_PLAY 0
#define TBICON_STOP 1