ReactOS 0.4.15-dev-7674-gc0b4db1
mplay32.c File Reference
#include "mplay32.h"
Include dependency graph for mplay32.c:

Go to the source code of this file.

Macros

#define IDT_PLAYTIMER   1000
 
#define MAIN_WINDOW_HEIGHT   125
 
#define MAIN_WINDOW_MIN_WIDTH   250
 
#define MAX_MCISTR   256
 
#define argv   __argv
 

Functions

static DWORD GetDeviceMode (HWND hwnd)
 
void EnableMenuItems (HWND hwnd)
 
void DisableMenuItems (void)
 
void ResizeClientArea (HWND hwnd, int nWidth, int nHeight)
 
void UpdateWindowCaption (HWND hwnd)
 
void UpdateTimeDisplay (HWND hwnd)
 
static VOID ShowLastWin32Error (HWND hwnd)
 
static VOID SetImageList (HWND hwnd)
 
static VOID ShowMCIError (HWND hwnd, MCIERROR mciError)
 
static VOID InitControls (HWND hwnd)
 
static VOID SwitchViewMode (HWND hwnd)
 
static DWORD GetNumDevices (VOID)
 
static DWORD GetDeviceName (DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
 
static DWORD GetDeviceFriendlyName (LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
 
static BOOL DeviceUsesFiles (LPTSTR lpDeviceName)
 
static MCIERROR CloseMciDevice (VOID)
 
static MCIERROR OpenMciDevice (HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
 
static VOID StopPlayback (HWND hwnd)
 
static VOID SeekPlayback (HWND hwnd, DWORD dwNewPos)
 
static VOID SeekBackPlayback (HWND hwnd)
 
static VOID SeekForwPlayback (HWND hwnd)
 
VOID CALLBACK PlayTimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
 
static VOID StartPlayback (HWND hwnd)
 
static VOID TogglePlaybackState (HWND hwnd)
 
static VOID ShowDeviceProperties (HWND hwnd)
 
static VOID CloseMediaFile (HWND hwnd)
 
static VOID OpenMediaFile (HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
 
static DWORD InsertDeviceMenuItem (HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD dwDeviceIndex)
 
static VOID BuildFileFilterAndDeviceMenu (VOID)
 
static VOID CleanupFileFilter (VOID)
 
static VOID OpenFileDialog (HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
 
static VOID HandleDeviceMenuItem (HWND hwnd, UINT uItem)
 
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
 
INT WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdShow)
 

Variables

HINSTANCE hInstance = NULL
 
HWND hTrackBar = NULL
 
HWND hToolBar = NULL
 
HWND hTimeDisplay = NULL
 
HMENU hMainMenu = NULL
 
TCHAR szAppTitle [256] = _T("")
 
TCHAR szDefaultFilter [MAX_PATH] = _T("")
 
TCHAR szCurrentFile [MAX_PATH] = _T("")
 
LPTSTR szFilter = NULL
 
WORD wDeviceId = 0
 
BOOL bRepeat = FALSE
 
BOOL bIsSingleWindow = FALSE
 
UINT MaxFilePos = 0
 
RECT PrevWindowPos
 
static const TBBUTTON Buttons []
 

Macro Definition Documentation

◆ argv

#define argv   __argv

Definition at line 18 of file mplay32.c.

◆ IDT_PLAYTIMER

#define IDT_PLAYTIMER   1000

Definition at line 9 of file mplay32.c.

◆ MAIN_WINDOW_HEIGHT

#define MAIN_WINDOW_HEIGHT   125

Definition at line 11 of file mplay32.c.

◆ MAIN_WINDOW_MIN_WIDTH

#define MAIN_WINDOW_MIN_WIDTH   250

Definition at line 12 of file mplay32.c.

◆ MAX_MCISTR

#define MAX_MCISTR   256

Definition at line 13 of file mplay32.c.

Function Documentation

◆ _tWinMain()

INT WINAPI _tWinMain ( HINSTANCE  hInst,
HINSTANCE  hPrevInst,
LPTSTR  lpCmdLine,
INT  nCmdShow 
)

Definition at line 1464 of file mplay32.c.

1465{
1466 WNDCLASSEX WndClass = {0};
1467 TCHAR szClassName[] = _T("ROSMPLAY32");
1468 HWND hwnd;
1469 MSG msg;
1470 DWORD dwError;
1471 HANDLE hAccel;
1472
1473 hInstance = hInst;
1474
1475 switch (GetUserDefaultUILanguage())
1476 {
1479 break;
1480
1481 default:
1482 break;
1483 }
1484
1486
1487 WndClass.cbSize = sizeof(WndClass);
1488 WndClass.lpszClassName = szClassName;
1489 WndClass.lpfnWndProc = MainWndProc;
1490 WndClass.hInstance = hInstance;
1491 WndClass.style = CS_HREDRAW | CS_VREDRAW;
1493 WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
1494 WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1495 WndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
1496
1498 {
1500 return 0;
1501 }
1502
1504 szAppTitle,
1508 350,
1510 NULL,
1511 NULL,
1512 hInstance,
1513 NULL);
1514 if (!hwnd)
1515 {
1517 return 0;
1518 }
1519
1521
1523
1525
1527
1528 dwError = SearchPath(NULL, _T("SNDVOL32.EXE"), NULL, 0, NULL, NULL);
1529 if (dwError == 0)
1530 {
1532 }
1533
1534 /* Show it */
1537
1538 if (*lpCmdLine == _T('"'))
1539 {
1541 }
1542 else
1543 {
1544 OpenMediaFile(hwnd, lpCmdLine, NULL);
1545 }
1546
1547 /* Message Loop */
1548 while (GetMessage(&msg, NULL, 0, 0))
1549 {
1551 {
1554 }
1555 }
1556
1558
1560
1561 return (INT)msg.wParam;
1562}
#define msg(x)
Definition: auth_time.c:54
#define IDI_MAIN
Definition: resource.h:4
#define IDS_APPTITLE
Definition: resource.h:3
#define IDM_VOLUMECTL
Definition: resource.h:50
#define IDR_MAINMENU
Definition: resource.h:40
#define ID_ACCELERATORS
Definition: resource.h:43
WCHAR WndClass[]
Definition: capicon.c:23
static const WCHAR szClassName[]
Definition: clipbrd.c:11
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:522
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:816
HACCEL hAccel
Definition: main.c:47
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: mplay32.c:1206
static VOID ShowLastWin32Error(HWND hwnd)
Definition: mplay32.c:213
HMENU hMainMenu
Definition: mplay32.c:25
#define MAIN_WINDOW_HEIGHT
Definition: mplay32.c:11
TCHAR szAppTitle[256]
Definition: mplay32.c:27
HINSTANCE hInstance
Definition: mplay32.c:21
#define argv
Definition: mplay32.c:18
void DisableMenuItems(void)
Definition: mplay32.c:82
static VOID BuildFileFilterAndDeviceMenu(VOID)
Definition: mplay32.c:951
static VOID OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
Definition: mplay32.c:893
static VOID CleanupFileFilter(VOID)
Definition: mplay32.c:1142
#define WS_CAPTION
Definition: pedump.c:624
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define WS_THICKFRAME
Definition: pedump.c:630
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_HEBREW
Definition: nls.h:67
#define SUBLANG_DEFAULT
Definition: nls.h:168
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1719
#define SearchPath
Definition: winbase.h:3835
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define CS_VREDRAW
Definition: winuser.h:658
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define CreateWindow
Definition: winuser.h:5753
#define GetMessage
Definition: winuser.h:5789
#define RegisterClassEx
Definition: winuser.h:5836
#define LoadIcon
Definition: winuser.h:5812
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5811
#define CW_USEDEFAULT
Definition: winuser.h:225
#define LoadString
Definition: winuser.h:5818
#define SW_SHOW
Definition: winuser.h:774
#define DispatchMessage
Definition: winuser.h:5764
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define TranslateAccelerator
Definition: winuser.h:5859
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define LoadAccelerators
Definition: winuser.h:5809
#define COLOR_BTNFACE
Definition: winuser.h:927
#define MF_GRAYED
Definition: winuser.h:129
char TCHAR
Definition: xmlstorage.h:189

◆ BuildFileFilterAndDeviceMenu()

static VOID BuildFileFilterAndDeviceMenu ( VOID  )
static

Definition at line 951 of file mplay32.c.

952{
954 TCHAR szFriendlyName[MAX_MCISTR];
955 TCHAR *szDevice = NULL;
956 static TCHAR szDefaultExtension[] = _T("*.*");
957 TCHAR *szExtensionList = NULL;
958 TCHAR *szExtension = NULL;
959 TCHAR *c = NULL;
960 TCHAR *d = NULL;
961 DWORD dwNumValues;
962 DWORD dwNumDevices;
963 DWORD dwValueNameLen;
964 DWORD dwValueDataSize;
965 DWORD dwMaskLen;
966 DWORD dwFilterSize;
967 DWORD dwDeviceSize;
968 DWORD dwExtensionLen;
969 DWORD dwPosition = 0;
970 DWORD i;
971 DWORD j;
972 size_t uSizeRemain;
973 size_t uMaskRemain;
974 HKEY hKey = NULL;
975
976 /* Always load the default (all files) filter */
978
979 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\MCI Extensions"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
980 {
981 goto Failure;
982 }
983
984 if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwNumValues, &dwValueNameLen, &dwValueDataSize, NULL, NULL) != ERROR_SUCCESS)
985 {
986 goto Failure;
987 }
988
989 dwMaskLen = ((dwValueNameLen + 3) * dwNumValues) + 1;
990
991 szExtensionList = malloc(dwMaskLen * sizeof(TCHAR));
992 if (!szExtensionList)
993 goto Failure;
994
995 dwNumDevices = GetNumDevices();
996
997 /* Allocate space for every pair of Device and Extension Filter */
998 dwFilterSize = (MAX_MCISTR + (dwMaskLen * 2) + 5) * dwNumDevices;
999
1000 /* Add space for the "All supported" entry */
1001 dwFilterSize = (dwFilterSize + (dwMaskLen * 2) + 7) * sizeof(TCHAR) + sizeof(szDefaultFilter);
1002
1003 szFilter = malloc(dwFilterSize);
1004 if (!szFilter)
1005 goto Failure;
1006
1007 szExtension = malloc((dwValueNameLen + 1) * sizeof(TCHAR));
1008 if (!szExtension)
1009 goto Failure;
1010
1011 szDevice = malloc(dwValueDataSize + sizeof(TCHAR));
1012 if (!szDevice)
1013 goto Failure;
1014
1015 ZeroMemory(szFilter, dwFilterSize);
1016
1017 uSizeRemain = dwFilterSize;
1018 c = szFilter;
1019
1020 for (j = 1; j <= dwNumDevices; j++)
1021 {
1023 {
1024 continue;
1025 }
1026
1027 if (GetDeviceFriendlyName(szDeviceName, szFriendlyName, sizeof(szFriendlyName)))
1028 {
1029 continue;
1030 }
1031
1032 /* Insert a menu item under the "Device" menu for every found MCI device */
1033 InsertDeviceMenuItem(GetSubMenu(hMainMenu, 3), dwPosition, TRUE, IDM_DEVICE_FIRST + dwPosition, j);
1034 dwPosition++;
1035
1036 /* Copy the default extension list, that may be overwritten after... */
1037 StringCbCopy(szExtensionList, dwMaskLen * sizeof(TCHAR), szDefaultExtension);
1038
1039 /* Try to determine the real extension list */
1040 uMaskRemain = dwMaskLen * sizeof(TCHAR);
1041 d = szExtensionList;
1042
1043 for (i = 0; i < dwNumValues; i++)
1044 {
1045 dwExtensionLen = dwValueNameLen + 1;
1046 dwDeviceSize = dwValueDataSize + sizeof(TCHAR);
1047
1048 ZeroMemory(szDevice, dwDeviceSize);
1049
1050 if (RegEnumValue(hKey, i, szExtension, &dwExtensionLen, NULL, NULL, (LPBYTE)szDevice, &dwDeviceSize) == ERROR_SUCCESS)
1051 {
1052 CharLowerBuff(szDevice, dwDeviceSize / sizeof(TCHAR));
1054 if (_tcscmp(szDeviceName, szDevice) == 0)
1055 {
1056 CharLowerBuff(szExtension, dwExtensionLen);
1057 StringCbPrintfEx(d, uMaskRemain, &d, &uMaskRemain, 0, _T("%s%s%s"), _T("*."), szExtension, _T(";"));
1058 }
1059 }
1060 }
1061
1062 /* Remove the last separator */
1063 d--;
1064 uSizeRemain += sizeof(*d);
1065 *d = _T('\0');
1066
1067 /* Add the description */
1068 StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szFriendlyName, szExtensionList);
1069
1070 /* Skip one char to separate the description from the filter mask */
1071 c++;
1072 uSizeRemain -= sizeof(*c);
1073
1074 /* Append the filter mask */
1075 StringCbCopyEx(c, uSizeRemain, szExtensionList, &c, &uSizeRemain, 0);
1076
1077 /* Skip another char to separate the elements of the filter mask */
1078 c++;
1079 uSizeRemain -= sizeof(*c);
1080 }
1081
1082 /* Build the full list of supported extensions */
1083 uMaskRemain = dwMaskLen * sizeof(TCHAR);
1084 d = szExtensionList;
1085
1086 for (i = 0; i < dwNumValues; i++)
1087 {
1088 dwExtensionLen = dwValueNameLen + 1;
1089
1090 if (RegEnumValue(hKey, i, szExtension, &dwExtensionLen, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
1091 {
1092 CharLowerBuff(szExtension, dwExtensionLen);
1093 StringCbPrintfEx(d, uMaskRemain, &d, &uMaskRemain, 0, _T("%s%s%s"), _T("*."), szExtension, _T(";"));
1094 }
1095 }
1096
1097 /* Remove the last separator */
1098 d--;
1099 uSizeRemain += sizeof(*d);
1100 *d = _T('\0');
1101
1102 /* Add the default (all files) description */
1103 StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szDefaultFilter, szExtensionList);
1104
1105 /* Skip one char to separate the description from the filter mask */
1106 c++;
1107 uSizeRemain -= sizeof(*c);
1108
1109 /* Append the filter mask */
1110 StringCbCopyEx(c, uSizeRemain, szExtensionList, &c, &uSizeRemain, 0);
1111
1112Cleanup:
1113 if (szExtensionList) free(szExtensionList);
1114 if (szExtension) free(szExtension);
1115 if (szDevice) free(szDevice);
1117
1118 return;
1119
1120Failure:
1121 /* We failed at retrieving the supported files, so use the default filter */
1122 if (szFilter) free(szFilter);
1124
1125 uSizeRemain = sizeof(szDefaultFilter);
1126 c = szFilter;
1127
1128 /* Add the default (all files) description */
1129 StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szDefaultFilter, szDefaultExtension);
1130
1131 /* Skip one char to separate the description from the filter mask */
1132 c++;
1133 uSizeRemain -= sizeof(*c);
1134
1135 /* Append the filter mask */
1136 StringCbCopyEx(c, uSizeRemain, szDefaultExtension, &c, &uSizeRemain, 0);
1137
1138 goto Cleanup;
1139}
#define IDM_DEVICE_FIRST
Definition: resource.h:56
#define IDS_ALL_TYPES_FILTER
Definition: resource.h:26
#define RegCloseKey(hKey)
Definition: registry.h:49
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szDeviceName[]
Definition: provider.c:56
static const WCHAR Cleanup[]
Definition: register.c:80
FxAutoRegKey hKey
const GLubyte * c
Definition: glext.h:8905
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define _tcscmp
Definition: tchar.h:1424
#define d
Definition: ke_i.h:81
static DWORD GetNumDevices(VOID)
Definition: mplay32.c:439
LPTSTR szFilter
Definition: mplay32.c:30
static DWORD GetDeviceFriendlyName(LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
Definition: mplay32.c:470
static DWORD GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
Definition: mplay32.c:456
#define MAX_MCISTR
Definition: mplay32.c:13
static DWORD InsertDeviceMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD dwDeviceIndex)
Definition: mplay32.c:914
TCHAR szDefaultFilter[MAX_PATH]
Definition: mplay32.c:28
#define KEY_READ
Definition: nt_native.h:1023
#define StringCbCopyEx
Definition: strsafe.h:192
#define StringCbPrintfEx
Definition: strsafe.h:600
#define StringCbCopy
Definition: strsafe.h:155
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ZeroMemory
Definition: winbase.h:1712
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegEnumValue
Definition: winreg.h:511
#define RegQueryInfoKey
Definition: winreg.h:521
#define CharLowerBuff
Definition: winuser.h:5737
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)

Referenced by _tWinMain().

◆ CleanupFileFilter()

static VOID CleanupFileFilter ( VOID  )
static

Definition at line 1142 of file mplay32.c.

1143{
1145}

Referenced by _tWinMain().

◆ CloseMciDevice()

static MCIERROR CloseMciDevice ( VOID  )
static

Definition at line 532 of file mplay32.c.

533{
534 MCIERROR mciError;
535 MCI_GENERIC_PARMS mciGeneric;
536
537 if (wDeviceId)
538 {
539 mciError = mciSendCommand(wDeviceId, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
540 if (mciError != 0) return mciError;
541 wDeviceId = 0;
542 }
543
545
547
548 return 0;
549}
DWORD MCIERROR
Definition: mmsystem.h:958
#define MCI_CLOSE
Definition: mmsystem.h:647
#define mciSendCommand
Definition: mmsystem.h:2861
#define MCI_WAIT
Definition: mmsystem.h:730
HWND hTimeDisplay
Definition: mplay32.c:24
WORD wDeviceId
Definition: mplay32.c:32
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:167
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by CloseMediaFile(), and OpenMciDevice().

◆ CloseMediaFile()

static VOID CloseMediaFile ( HWND  hwnd)
static

Definition at line 881 of file mplay32.c.

882{
884
885 if (bIsSingleWindow)
887
890}
BOOL bIsSingleWindow
Definition: mplay32.c:34
static VOID SwitchViewMode(HWND hwnd)
Definition: mplay32.c:371
static MCIERROR CloseMciDevice(VOID)
Definition: mplay32.c:532
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:652

Referenced by MainWndProc(), and OpenMediaFile().

◆ DeviceUsesFiles()

static BOOL DeviceUsesFiles ( LPTSTR  lpDeviceName)
static

Definition at line 500 of file mplay32.c.

501{
502 MCIERROR mciError;
503 MCI_OPEN_PARMS mciOpen;
504 MCI_GETDEVCAPS_PARMS mciDevCaps;
505 MCI_GENERIC_PARMS mciGeneric;
506
507 mciOpen.dwCallback = 0;
508 mciOpen.wDeviceID = 0;
509 mciOpen.lpstrDeviceType = lpDeviceName;
510 mciOpen.lpstrElementName = NULL;
511 mciOpen.lpstrAlias = NULL;
512
513 mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_WAIT, (DWORD_PTR)&mciOpen);
514 if (mciError != 0)
515 return FALSE;
516
517 mciDevCaps.dwCallback = 0;
518 mciDevCaps.dwReturn = 0;
520
521 mciError = mciSendCommand(mciOpen.wDeviceID, MCI_GETDEVCAPS, MCI_WAIT | MCI_GETDEVCAPS_ITEM, (DWORD_PTR)&mciDevCaps);
522 if (mciError != 0)
523 return FALSE;
524
525 mciGeneric.dwCallback = 0;
526 mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
527
528 return (BOOL)mciDevCaps.dwReturn;
529}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MCI_GETDEVCAPS
Definition: mmsystem.h:654
#define MCI_GETDEVCAPS_USES_FILES
Definition: mmsystem.h:763
#define MCI_OPEN
Definition: mmsystem.h:646
#define MCI_GETDEVCAPS_ITEM
Definition: mmsystem.h:758
#define MCI_OPEN_TYPE
Definition: mmsystem.h:739
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
LPCSTR lpstrDeviceType
Definition: mmsystem.h:1523
DWORD_PTR dwCallback
Definition: mmsystem.h:1521
MCIDEVICEID wDeviceID
Definition: mmsystem.h:1522
LPCSTR lpstrElementName
Definition: mmsystem.h:1524

Referenced by HandleDeviceMenuItem(), and InsertDeviceMenuItem().

◆ DisableMenuItems()

void DisableMenuItems ( void  )

Definition at line 82 of file mplay32.c.

Referenced by _tWinMain(), and CloseMciDevice().

◆ EnableMenuItems()

void EnableMenuItems ( HWND  hwnd)

Definition at line 54 of file mplay32.c.

55{
56 MCIERROR mciError;
57 MCI_GENERIC_PARMS mciGeneric;
58 MCI_DGV_RECT_PARMS mciVideoRect;
59 MCI_DGV_WINDOW_PARMSW mciVideoWindow;
60
62
63 mciError = mciSendCommand(wDeviceId, MCI_CONFIGURE, MCI_TEST, (DWORD_PTR)&mciGeneric);
64 if (mciError == 0)
65 {
67 }
68
69 mciVideoWindow.hWnd = hwnd;
70
72 if (!mciError)
73 {
75 if (!mciError)
76 {
78 }
79 }
80}
#define MCI_DGV_WINDOW_HWND
Definition: digitalv.h:453
#define MCI_DGV_WHERE_SOURCE
Definition: digitalv.h:444
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MCI_TEST
Definition: digitalv.h:32
#define MCI_WINDOW
Definition: mmsystem.h:665
#define MCI_WHERE
Definition: mmsystem.h:667
#define MF_ENABLED
Definition: winuser.h:128

Referenced by OpenMciDevice().

◆ GetDeviceFriendlyName()

static DWORD GetDeviceFriendlyName ( LPTSTR  lpDeviceName,
LPTSTR  lpFriendlyName,
DWORD  dwFriendlyNameSize 
)
static

Definition at line 470 of file mplay32.c.

471{
472 MCIERROR mciError;
473 MCI_OPEN_PARMS mciOpen;
474 MCI_INFO_PARMS mciInfo;
475 MCI_GENERIC_PARMS mciGeneric;
476
477 mciOpen.dwCallback = 0;
478 mciOpen.wDeviceID = 0;
479 mciOpen.lpstrDeviceType = lpDeviceName;
480 mciOpen.lpstrElementName = NULL;
481 mciOpen.lpstrAlias = NULL;
482
483 mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_WAIT, (DWORD_PTR)&mciOpen);
484 if (mciError != 0)
485 return mciError;
486
487 mciInfo.dwCallback = 0;
488 mciInfo.lpstrReturn = lpFriendlyName;
489 mciInfo.dwRetSize = dwFriendlyNameSize;
490
491 mciError = mciSendCommand(mciOpen.wDeviceID, MCI_INFO, MCI_INFO_PRODUCT, (DWORD_PTR)&mciInfo);
492
493 mciGeneric.dwCallback = 0;
494 mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
495
496 return mciError;
497}
#define MCI_INFO_PRODUCT
Definition: mmsystem.h:752
#define MCI_INFO
Definition: mmsystem.h:653
DWORD_PTR dwCallback
Definition: mmsystem.h:1573

Referenced by BuildFileFilterAndDeviceMenu(), and InsertDeviceMenuItem().

◆ GetDeviceMode()

static DWORD GetDeviceMode ( HWND  hwnd)
static

Definition at line 635 of file mplay32.c.

636{
637 MCIERROR mciError;
638 MCI_STATUS_PARMS mciStatus;
639
640 mciStatus.dwItem = MCI_STATUS_MODE;
642 if (mciError != 0)
643 {
644 ShowMCIError(hwnd, mciError);
645 return MCI_MODE_NOT_READY;
646 }
647
648 return mciStatus.dwReturn;
649}
#define MCI_STATUS
Definition: mmsystem.h:662
#define MCI_STATUS_MODE
Definition: mmsystem.h:747
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
DWORD_PTR dwReturn
Definition: mmsystem.h:1567

Referenced by TogglePlaybackState(), and UpdateWindowCaption().

◆ GetDeviceName()

static DWORD GetDeviceName ( DWORD  dwDeviceIndex,
LPTSTR  lpDeviceName,
DWORD  dwDeviceNameSize 
)
static

Definition at line 456 of file mplay32.c.

457{
458 MCI_SYSINFO_PARMS mciSysInfo;
459
460 mciSysInfo.dwCallback = 0;
461 mciSysInfo.lpstrReturn = lpDeviceName;
462 mciSysInfo.dwRetSize = dwDeviceNameSize;
463 mciSysInfo.dwNumber = dwDeviceIndex;
465
467}
#define MCI_SYSINFO_NAME
Definition: mmsystem.h:770
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
#define MCI_DEVTYPE_WAVEFORM_AUDIO
Definition: mmsystem.h:689
#define MCI_SYSINFO
Definition: mmsystem.h:659
DWORD_PTR dwCallback
Definition: mmsystem.h:1591

Referenced by BuildFileFilterAndDeviceMenu(), HandleDeviceMenuItem(), and InsertDeviceMenuItem().

◆ GetNumDevices()

static DWORD GetNumDevices ( VOID  )
static

Definition at line 439 of file mplay32.c.

440{
441 MCI_SYSINFO_PARMS mciSysInfo;
442 DWORD dwNumDevices = 0;
443
444 mciSysInfo.dwCallback = 0;
445 mciSysInfo.lpstrReturn = (LPTSTR)&dwNumDevices;
446 mciSysInfo.dwRetSize = sizeof(dwNumDevices);
447 mciSysInfo.dwNumber = 0;
448 mciSysInfo.wDeviceType = MCI_ALL_DEVICE_ID;
449
451
452 return *(DWORD*)mciSysInfo.lpstrReturn;
453}
#define MCI_SYSINFO_QUANTITY
Definition: mmsystem.h:768
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by BuildFileFilterAndDeviceMenu().

◆ HandleDeviceMenuItem()

static VOID HandleDeviceMenuItem ( HWND  hwnd,
UINT  uItem 
)
static

Definition at line 1172 of file mplay32.c.

1173{
1174 MENUITEMINFO lpmii;
1176 MCIERROR mciError;
1177
1178 ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
1179 lpmii.cbSize = sizeof(lpmii);
1180 lpmii.fMask = MIIM_DATA;
1181 GetMenuItemInfo(hMainMenu, uItem, FALSE, &lpmii);
1182
1183 mciError = GetDeviceName(lpmii.dwItemData, szDeviceName, sizeof(szDeviceName));
1184 if (mciError)
1185 {
1186 ShowMCIError(hwnd, mciError);
1187 return;
1188 }
1189
1191 {
1193 return;
1194 }
1195
1196 mciError = OpenMciDevice(hwnd, szDeviceName, NULL);
1197 if (mciError)
1198 {
1199 ShowMCIError(hwnd, mciError);
1200 }
1201
1202 return;
1203}
static BOOL DeviceUsesFiles(LPTSTR lpDeviceName)
Definition: mplay32.c:500
static MCIERROR OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
Definition: mplay32.c:552
static VOID OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
Definition: mplay32.c:1148
ULONG_PTR dwItemData
Definition: winuser.h:3249
#define GetMenuItemInfo
Definition: winuser.h:5787
#define MIIM_DATA
Definition: winuser.h:726

Referenced by MainWndProc().

◆ InitControls()

static VOID InitControls ( HWND  hwnd)
static

Definition at line 303 of file mplay32.c.

304{
305 INT NumButtons = ARRAYSIZE(Buttons);
306
308
309 /* Create trackbar */
312 NULL,
314 0,
315 0,
316 340,
317 20,
318 hwnd,
319 NULL,
320 hInstance,
321 NULL);
322 if (!hTrackBar)
323 {
325 return;
326 }
327
328 /* Create toolbar */
331 NULL,
334 0,
335 40,
336 340,
337 30,
338 hwnd,
339 NULL,
340 hInstance,
341 NULL);
342 if (!hToolBar)
343 {
345 return;
346 }
347
349 L"STATIC",
350 NULL,
352 195,
353 4,
354 135,
355 18,
356 hToolBar,
357 NULL,
358 hInstance,
359 NULL);
360 if (!hTimeDisplay)
361 {
363 return;
364 }
365
368}
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
HWND hTrackBar
Definition: mplay32.c:22
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
HWND hToolBar
Definition: mplay32.c:23
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
#define SS_CENTER
Definition: pedump.c:693
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define TB_ADDBUTTONS
Definition: commctrl.h:1271
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define CCS_BOTTOM
Definition: commctrl.h:2244
#define TBS_ENABLESELRANGE
Definition: commctrl.h:2024
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
#define TRACKBAR_CLASS
Definition: commctrl.h:2013
LONG_PTR LPARAM
Definition: windef.h:208
#define CreateWindowEx
Definition: winuser.h:5754
#define SendMessage
Definition: winuser.h:5842
#define SS_SUNKEN
Definition: winuser.h:358

Referenced by _tWinMain(), DllMain(), Initialize(), MainWndProc(), and wWinMain().

◆ InsertDeviceMenuItem()

static DWORD InsertDeviceMenuItem ( HMENU  hMenu,
UINT  uItem,
BOOL  fByPosition,
UINT  uItemID,
DWORD  dwDeviceIndex 
)
static

Definition at line 914 of file mplay32.c.

915{
916 MENUITEMINFO lpmii;
917 MCIERROR mciError;
919 TCHAR szFriendlyName[MAX_MCISTR];
920
921 mciError = GetDeviceName(dwDeviceIndex, szDeviceName, sizeof(szDeviceName));
922 if (mciError)
923 {
924 return mciError;
925 }
926
927 mciError = GetDeviceFriendlyName(szDeviceName, szFriendlyName, sizeof(szFriendlyName));
928 if (mciError)
929 {
930 return mciError;
931 }
932
934 {
935 StringCbCat(szFriendlyName, sizeof(szFriendlyName), _T("..."));
936 }
937
938 ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
939 lpmii.cbSize = sizeof(lpmii);
940 lpmii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID;
941 lpmii.wID = uItemID;
942 lpmii.fType = MF_STRING;
943 lpmii.dwTypeData = szFriendlyName;
944 lpmii.dwItemData = dwDeviceIndex;
945 InsertMenuItem(hMenu, uItem, fByPosition, &lpmii);
946
947 return 0;
948}
#define StringCbCat
Definition: strsafe.h:334
LPSTR dwTypeData
Definition: winuser.h:3250
#define MIIM_ID
Definition: winuser.h:722
#define MF_STRING
Definition: winuser.h:138
#define InsertMenuItem
Definition: winuser.h:5803
#define MIIM_TYPE
Definition: winuser.h:725

Referenced by BuildFileFilterAndDeviceMenu().

◆ MainWndProc()

LRESULT CALLBACK MainWndProc ( HWND  hwnd,
UINT  Message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1206 of file mplay32.c.

1207{
1208 switch (Message)
1209 {
1210 case WM_CREATE:
1211 {
1214 break;
1215 }
1216
1217 case WM_DROPFILES:
1218 {
1219 HDROP drophandle;
1220 TCHAR droppedfile[MAX_PATH];
1221
1222 drophandle = (HDROP)wParam;
1223 DragQueryFile(drophandle, 0, droppedfile, ARRAYSIZE(droppedfile));
1224 DragFinish(drophandle);
1225 OpenMediaFile(hwnd, droppedfile, NULL);
1226 break;
1227 }
1228
1229 case MM_MCINOTIFY:
1230 {
1232 {
1234 if (bRepeat)
1235 {
1237 }
1238 }
1239 break;
1240 }
1241
1242 case WM_NOTIFY:
1243 {
1244 LPNMHDR pnmhdr = (LPNMHDR)lParam;
1245
1246 switch (pnmhdr->code)
1247 {
1248 case TTN_GETDISPINFO:
1249 {
1251 UINT idButton = (UINT)lpttt->hdr.idFrom;
1252
1253 switch (idButton)
1254 {
1255 case IDC_PLAY:
1256 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PLAY);
1257 break;
1258 case IDC_STOP:
1259 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
1260 break;
1261 case IDC_EJECT:
1262 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EJECT);
1263 break;
1264 case IDC_BACKWARD:
1265 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_BACKWARD);
1266 break;
1267 case IDC_SEEKBACK:
1268 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SEEKBACK);
1269 break;
1270 case IDC_SEEKFORW:
1271 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SEEKFORW);
1272 break;
1273 case IDC_FORWARD:
1274 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_FORWARD);
1275 break;
1276 case IDC_PAUSE:
1277 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
1278 break;
1279 }
1280 break;
1281 }
1282 }
1283 }
1284 break;
1285
1286 case WM_SIZING:
1287 {
1288 LPRECT pRect = (LPRECT)lParam;
1289
1290 if (!bIsSingleWindow)
1291 {
1292 if (pRect->right - pRect->left < MAIN_WINDOW_MIN_WIDTH)
1293 pRect->right = pRect->left + MAIN_WINDOW_MIN_WIDTH;
1294
1295 if (pRect->bottom - pRect->top != MAIN_WINDOW_HEIGHT)
1296 pRect->bottom = pRect->top + MAIN_WINDOW_HEIGHT;
1297 }
1298 return TRUE;
1299 }
1300
1301 case WM_SIZE:
1302 {
1303 RECT Rect;
1304
1305 if (hToolBar && hTrackBar)
1306 {
1309 MoveWindow(hTimeDisplay, LOWORD(lParam) - 140, 4, 135, 18, TRUE);
1310
1311 if (!bIsSingleWindow)
1312 {
1315 }
1316 else
1317 {
1318 RECT ToolbarRect;
1319 MCI_DGV_PUT_PARMS mciPut;
1320
1321 MoveWindow(hTrackBar, 180, 0, LOWORD(lParam) - 322, 25, TRUE);
1322
1324 GetClientRect(hToolBar, &ToolbarRect);
1325
1326 mciPut.rc.top = 0;
1327 mciPut.rc.left = 0;
1328 mciPut.rc.right = Rect.right;
1329 mciPut.rc.bottom = Rect.bottom - (ToolbarRect.bottom - ToolbarRect.top) - 2;
1330
1332 }
1333 }
1334 return 0L;
1335 }
1336
1337 case WM_HSCROLL:
1338 {
1339 if (hTrackBar == (HWND)lParam)
1340 {
1341 if (wDeviceId)
1342 {
1343 DWORD dwNewPos = (DWORD)SendMessage(hTrackBar, TBM_GETPOS, 0, 0);
1344 SeekPlayback(hwnd, dwNewPos);
1345 }
1346 else
1347 {
1349 }
1350 }
1351 }
1352 break;
1353
1354 case WM_NCLBUTTONDBLCLK:
1355 {
1356 if (wParam == HTCAPTION)
1357 {
1359 }
1360 }
1361 break;
1362
1363 case WM_COMMAND:
1364 {
1366 {
1368 break;
1369 }
1370
1371 switch (LOWORD(wParam))
1372 {
1373 case IDC_PLAY:
1374 case IDC_PAUSE:
1375 {
1376 if (wDeviceId)
1378 else
1380
1381 break;
1382 }
1383
1384 case IDC_STOP:
1386 break;
1387
1388 case IDC_EJECT:
1389 break;
1390
1391 case IDC_BACKWARD:
1392 break;
1393
1394 case IDC_SEEKBACK:
1396 break;
1397
1398 case IDC_SEEKFORW:
1400 break;
1401
1402 case IDC_FORWARD:
1403 break;
1404
1405 case IDM_OPEN_FILE:
1407 return 0;
1408
1409 case IDM_CLOSE_FILE:
1411 break;
1412
1413 case IDM_REPEAT:
1414 {
1415 if (!bRepeat)
1416 {
1418 bRepeat = TRUE;
1419 }
1420 else
1421 {
1423 bRepeat = FALSE;
1424 }
1425 break;
1426 }
1427
1428 case IDM_SWITCHVIEW:
1430 break;
1431
1432 case IDM_DEVPROPS:
1434 break;
1435
1436 case IDM_VOLUMECTL:
1437 ShellExecute(hwnd, NULL, _T("SNDVOL32.EXE"), NULL, NULL, SW_SHOWNORMAL);
1438 break;
1439
1440 case IDM_ABOUT:
1441 {
1444 break;
1445 }
1446
1447 case IDM_EXIT:
1448 PostMessage(hwnd, WM_CLOSE, 0, 0);
1449 return 0;
1450 }
1451 break;
1452 }
1453
1454 case WM_DESTROY:
1456 PostQuitMessage(0);
1457 return 0;
1458 }
1459
1461}
#define IDM_ABOUT
Definition: resource.h:29
#define IDM_EXIT
Definition: resource.h:27
#define IDS_TOOLTIP_SEEKBACK
Definition: resource.h:22
#define IDC_SEEKFORW
Definition: resource.h:73
#define IDM_OPEN_FILE
Definition: resource.h:46
#define IDC_BACKWARD
Definition: resource.h:71
#define IDS_TOOLTIP_EJECT
Definition: resource.h:20
#define IDS_TOOLTIP_SEEKFORW
Definition: resource.h:23
#define IDS_TOOLTIP_FORWARD
Definition: resource.h:24
#define IDC_PAUSE
Definition: resource.h:75
#define IDC_EJECT
Definition: resource.h:70
#define IDS_TOOLTIP_BACKWARD
Definition: resource.h:21
#define IDS_TOOLTIP_PAUSE
Definition: resource.h:25
#define IDC_PLAY
Definition: resource.h:68
#define IDC_SEEKBACK
Definition: resource.h:72
#define IDS_TOOLTIP_STOP
Definition: resource.h:19
#define IDM_REPEAT
Definition: resource.h:52
#define IDC_STOP
Definition: resource.h:69
#define IDC_FORWARD
Definition: resource.h:74
#define IDS_TOOLTIP_PLAY
Definition: resource.h:18
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define MCI_DGV_PUT_DESTINATION
Definition: digitalv.h:234
#define MCI_DGV_RECT
Definition: digitalv.h:232
#define MAX_PATH
Definition: compat.h:34
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
static const WCHAR Message[]
Definition: register.c:74
switch(r->id)
Definition: btrfs.c:3046
#define MCI_PUT
Definition: mmsystem.h:666
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
#define MM_MCINOTIFY
Definition: mmsystem.h:55
static VOID CloseMediaFile(HWND hwnd)
Definition: mplay32.c:881
static VOID SeekPlayback(HWND hwnd, DWORD dwNewPos)
Definition: mplay32.c:687
static VOID SeekBackPlayback(HWND hwnd)
Definition: mplay32.c:711
static VOID TogglePlaybackState(HWND hwnd)
Definition: mplay32.c:807
BOOL bRepeat
Definition: mplay32.c:33
static VOID ShowDeviceProperties(HWND hwnd)
Definition: mplay32.c:868
static VOID HandleDeviceMenuItem(HWND hwnd, UINT uItem)
Definition: mplay32.c:1172
static VOID SeekForwPlayback(HWND hwnd)
Definition: mplay32.c:734
#define MAIN_WINDOW_MIN_WIDTH
Definition: mplay32.c:12
static VOID StartPlayback(HWND hwnd)
Definition: mplay32.c:773
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
unsigned int UINT
Definition: ndis.h:50
#define DWORD
Definition: nt_native.h:44
#define LOWORD(l)
Definition: pedump.c:82
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define TBM_GETPOS
Definition: commctrl.h:2031
#define TTN_GETDISPINFO
Definition: commctrl.h:1878
#define TBM_SETPOS
Definition: commctrl.h:2036
#define TB_GETITEMRECT
Definition: commctrl.h:1133
#define LPTOOLTIPTEXT
Definition: commctrl.h:1890
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
#define ShellExecute
Definition: shellapi.h:690
#define DragQueryFile
Definition: shellapi.h:683
#define ShellAbout
Definition: shellapi.h:689
UINT code
Definition: winuser.h:3158
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define HIWORD(l)
Definition: typedefs.h:247
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define LPRECT
Definition: precomp.h:28
#define SW_SHOWNORMAL
Definition: winuser.h:769
#define WM_CLOSE
Definition: winuser.h:1620
#define WM_HSCROLL
Definition: winuser.h:1742
#define HTCAPTION
Definition: winuser.h:2475
#define WM_CREATE
Definition: winuser.h:1607
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1610
#define WM_DROPFILES
Definition: winuser.h:1824
#define WM_COMMAND
Definition: winuser.h:1739
#define SM_CYMENU
Definition: winuser.h:975
#define MF_CHECKED
Definition: winuser.h:132
#define MF_UNCHECKED
Definition: winuser.h:204
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1693
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
struct tagNMHDR * LPNMHDR
#define PostMessage
Definition: winuser.h:5831
#define WM_SIZING
Definition: winuser.h:1806
#define WM_DESTROY
Definition: winuser.h:1608
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
HMENU WINAPI GetMenu(_In_ HWND)

Referenced by _tWinMain().

◆ OpenFileDialog()

static VOID OpenFileDialog ( HWND  hwnd,
DWORD  dwFilterIndex,
LPTSTR  lpType 
)
static

Definition at line 1148 of file mplay32.c.

1149{
1150 OPENFILENAME OpenFileName;
1151 TCHAR szFile[MAX_PATH + 1] = _T("");
1152
1153 ZeroMemory(&OpenFileName, sizeof(OpenFileName));
1154
1155 OpenFileName.lStructSize = sizeof(OpenFileName);
1156 OpenFileName.hwndOwner = hwnd;
1157 OpenFileName.hInstance = hInstance;
1158 OpenFileName.lpstrFilter = szFilter;
1159 OpenFileName.lpstrFile = szFile;
1160 OpenFileName.nMaxFile = ARRAYSIZE(szFile);
1162 OpenFileName.lpstrDefExt = _T("\0");
1163 OpenFileName.nFilterIndex = dwFilterIndex;
1164
1165 if (!GetOpenFileName(&OpenFileName))
1166 return;
1167
1168 OpenMediaFile(hwnd, OpenFileName.lpstrFile, lpType);
1169}
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_SHAREAWARE
Definition: commdlg.h:119
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define GetOpenFileName
Definition: commdlg.h:665
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nFilterIndex
Definition: commdlg.h:335
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337

Referenced by HandleDeviceMenuItem(), and MainWndProc().

◆ OpenMciDevice()

static MCIERROR OpenMciDevice ( HWND  hwnd,
LPTSTR  lpType,
LPTSTR  lpFileName 
)
static

Definition at line 552 of file mplay32.c.

553{
554 MCIERROR mciError;
555 MCI_STATUS_PARMS mciStatus;
556 MCI_OPEN_PARMS mciOpen;
558 LPTSTR lpStr;
559
560 if (wDeviceId)
562
563 mciOpen.lpstrDeviceType = lpType;
565 mciOpen.dwCallback = 0;
566 mciOpen.wDeviceID = 0;
567 mciOpen.lpstrAlias = NULL;
568
569 if (lpType)
571
572 if (lpFileName)
574
575 mciError = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD_PTR)&mciOpen);
576 if (mciError != 0)
577 return mciError;
578
579 mciStatus.dwItem = MCI_STATUS_LENGTH;
580
581 mciError = mciSendCommand(mciOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR)&mciStatus);
582 if (mciError != 0)
583 return mciError;
584
590
591 if (mciStatus.dwReturn < 10000)
592 {
594 }
595 else if (mciStatus.dwReturn < 100000)
596 {
598 }
599 else if (mciStatus.dwReturn < 1000000)
600 {
602 }
603 else
604 {
606 }
607
608 MaxFilePos = mciStatus.dwReturn;
609 wDeviceId = mciOpen.wDeviceID;
610
611 /* NOTE: Everything above this line may be done instead in OpenMediaFile() */
612
613 if (lpFileName)
614 {
615 lpStr = _tcsrchr(lpFileName, _T('\\'));
616 if (lpStr) // Get only the file name (skip the last path separator)
617 lpStr++;
618 else
619 lpStr = lpFileName;
620 }
621 else
622 lpStr = lpType;
623
625
627
630
631 return 0;
632}
#define MCI_OPEN_ELEMENT
Definition: mmsystem.h:735
#define MCI_STATUS_LENGTH
Definition: mmsystem.h:744
#define _tcsrchr
Definition: utility.h:116
UINT MaxFilePos
Definition: mplay32.c:35
TCHAR szCurrentFile[MAX_PATH]
Definition: mplay32.c:29
void EnableMenuItems(HWND hwnd)
Definition: mplay32.c:54
#define TBM_SETPAGESIZE
Definition: commctrl.h:2051
#define TBM_SETLINESIZE
Definition: commctrl.h:2053
#define TBM_SETRANGEMIN
Definition: commctrl.h:2038
#define TBM_SETTICFREQ
Definition: commctrl.h:2050
#define TBM_SETRANGEMAX
Definition: commctrl.h:2039
_In_ LPCSTR lpFileName
Definition: winbase.h:3071
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
UINT_PTR WPARAM
Definition: windef.h:207

Referenced by HandleDeviceMenuItem(), and OpenMediaFile().

◆ OpenMediaFile()

static VOID OpenMediaFile ( HWND  hwnd,
LPTSTR  lpFileName,
LPTSTR  lpType 
)
static

Definition at line 893 of file mplay32.c.

894{
895 MCIERROR mciError;
896
898 return;
899
900 if (wDeviceId)
902
903 mciError = OpenMciDevice(hwnd, lpType, lpFileName);
904 if (mciError != 0)
905 {
906 ShowMCIError(hwnd, mciError);
907 return;
908 }
909
911}
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GetFileAttributes
Definition: winbase.h:3750

Referenced by _tWinMain(), MainWndProc(), and OpenFileDialog().

◆ PlayTimerProc()

VOID CALLBACK PlayTimerProc ( HWND  hwnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)

Definition at line 757 of file mplay32.c.

758{
759 MCI_STATUS_PARMS mciStatus;
760 DWORD dwPos;
761
763
764 mciStatus.dwItem = MCI_STATUS_POSITION;
766 dwPos = mciStatus.dwReturn;
767
770}
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
#define IDT_PLAYTIMER
Definition: mplay32.c:9
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by StartPlayback().

◆ ResizeClientArea()

void ResizeClientArea ( HWND  hwnd,
int  nWidth,
int  nHeight 
)

Definition at line 89 of file mplay32.c.

90{
91 RECT rcClientRect;
92 RECT rcWindowRect;
93 POINT ptDifference;
94
95 GetClientRect(hwnd, &rcClientRect);
96 GetWindowRect(hwnd, &rcWindowRect);
97 ptDifference.x = (rcWindowRect.right - rcWindowRect.left) - rcClientRect.right;
98 ptDifference.y = (rcWindowRect.bottom - rcWindowRect.top) - rcClientRect.bottom;
99 MoveWindow(hwnd, rcWindowRect.left, rcWindowRect.top, nWidth + ptDifference.x, nHeight + ptDifference.y, TRUE);
100}
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by SwitchViewMode().

◆ SeekBackPlayback()

static VOID SeekBackPlayback ( HWND  hwnd)
static

Definition at line 711 of file mplay32.c.

712{
713 MCI_STATUS_PARMS mciStatus;
714 DWORD dwNewPos;
715
716 if (wDeviceId == 0) return;
717
718 mciStatus.dwItem = MCI_STATUS_POSITION;
720
721 dwNewPos = mciStatus.dwReturn - 1;
722
723 if ((UINT)dwNewPos <= 1)
724 {
726 }
727 else
728 {
729 SeekPlayback(hwnd, dwNewPos);
730 }
731}

Referenced by MainWndProc().

◆ SeekForwPlayback()

static VOID SeekForwPlayback ( HWND  hwnd)
static

Definition at line 734 of file mplay32.c.

735{
736 MCI_STATUS_PARMS mciStatus;
737 DWORD dwNewPos;
738
739 if (wDeviceId == 0) return;
740
741 mciStatus.dwItem = MCI_STATUS_POSITION;
743
744 dwNewPos = mciStatus.dwReturn + 1;
745
746 if ((UINT)dwNewPos >= MaxFilePos)
747 {
749 }
750 else
751 {
752 SeekPlayback(hwnd, dwNewPos);
753 }
754}

Referenced by MainWndProc().

◆ SeekPlayback()

static VOID SeekPlayback ( HWND  hwnd,
DWORD  dwNewPos 
)
static

Definition at line 687 of file mplay32.c.

688{
689 MCIERROR mciError;
690 MCI_SEEK_PARMS mciSeek;
691 MCI_PLAY_PARMS mciPlay;
692
693 if (wDeviceId == 0) return;
694
695 mciSeek.dwTo = (DWORD_PTR)dwNewPos;
696 mciError = mciSendCommand(wDeviceId, MCI_SEEK, MCI_WAIT | MCI_TO, (DWORD_PTR)&mciSeek);
697 if (mciError != 0)
698 {
699 ShowMCIError(hwnd, mciError);
700 }
701
702 mciPlay.dwCallback = (DWORD_PTR)hwnd;
703 mciError = mciSendCommand(wDeviceId, MCI_PLAY, MCI_NOTIFY, (DWORD_PTR)&mciPlay);
704 if (mciError != 0)
705 {
706 ShowMCIError(hwnd, mciError);
707 }
708}
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define MCI_TO
Definition: mmsystem.h:732
#define MCI_SEEK
Definition: mmsystem.h:650
#define MCI_PLAY
Definition: mmsystem.h:649
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
#define DWORD_PTR
Definition: treelist.c:76

Referenced by MainWndProc(), SeekBackPlayback(), and SeekForwPlayback().

◆ SetImageList()

static VOID SetImageList ( HWND  hwnd)
static

Definition at line 238 of file mplay32.c.

239{
240 HIMAGELIST hImageList;
241
242 hImageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 1, 1);
243 if (!hImageList)
244 {
246 return;
247 }
248
249 ImageList_AddMasked(hImageList,
251 RGB(255, 255, 255));
252
253 ImageList_AddMasked(hImageList,
255 RGB(255, 255, 255));
256
257 ImageList_AddMasked(hImageList,
259 RGB(255, 255, 255));
260
261 ImageList_AddMasked(hImageList,
263 RGB(255, 255, 255));
264
265 ImageList_AddMasked(hImageList,
267 RGB(255, 255, 255));
268
269 ImageList_AddMasked(hImageList,
271 RGB(255, 255, 255));
272
273 ImageList_AddMasked(hImageList,
275 RGB(255, 255, 255));
276
277 ImageList_AddMasked(hImageList,
279 RGB(255, 255, 255));
280
283 0,
284 (LPARAM)hImageList));
285}
#define IDB_PLAYICON
Definition: resource.h:7
#define IDB_SEEKBACKICON
Definition: resource.h:11
#define IDB_EJECTICON
Definition: resource.h:9
#define IDB_SEEKFORWICON
Definition: resource.h:12
#define IDB_STOPICON
Definition: resource.h:8
#define IDB_PAUSEICON
Definition: resource.h:14
#define IDB_BACKWARDICON
Definition: resource.h:10
#define IDB_FORWARDICON
Definition: resource.h:13
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define RGB(r, g, b)
Definition: precomp.h:62
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define ILC_MASK
Definition: commctrl.h:351
#define ILC_COLOR24
Definition: commctrl.h:357
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LoadImage
Definition: winuser.h:5814
#define LR_DEFAULTCOLOR
Definition: winuser.h:1086

Referenced by CAppsListView::Create(), DECLARE_INTERFACE_(), InitControls(), CNotifyToolbar::Initialize(), CNotifyToolbar::ResizeImagelist(), and CMenuToolbarBase::UpdateImageLists().

◆ ShowDeviceProperties()

static VOID ShowDeviceProperties ( HWND  hwnd)
static

Definition at line 868 of file mplay32.c.

869{
870 MCIERROR mciError;
871 MCI_GENERIC_PARMS mciGeneric;
872
873 mciError = mciSendCommand(wDeviceId, MCI_CONFIGURE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
874 if (mciError != 0)
875 {
876 ShowMCIError(hwnd, mciError);
877 }
878}

Referenced by MainWndProc().

◆ ShowLastWin32Error()

static VOID ShowLastWin32Error ( HWND  hwnd)
static

Definition at line 213 of file mplay32.c.

214{
215 LPTSTR lpMessageBuffer;
216 DWORD dwError = GetLastError();
217
218 if (dwError == ERROR_SUCCESS)
219 return;
220
224 NULL,
225 dwError,
227 (LPTSTR)&lpMessageBuffer,
228 0, NULL))
229 {
230 return;
231 }
232
233 MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR);
234 LocalFree(lpMessageBuffer);
235}
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
#define FormatMessage
Definition: winbase.h:3730
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define MB_ICONERROR
Definition: winuser.h:786
#define MB_OK
Definition: winuser.h:789
#define MessageBox
Definition: winuser.h:5821

Referenced by _tWinMain(), InitControls(), and SetImageList().

◆ ShowMCIError()

static VOID ShowMCIError ( HWND  hwnd,
MCIERROR  mciError 
)
static

Definition at line 288 of file mplay32.c.

289{
290 TCHAR szErrorMessage[MAX_MCISTR];
291 TCHAR szTempMessage[MAX_MCISTR + 44];
292
293 if (mciGetErrorString(mciError, szErrorMessage, ARRAYSIZE(szErrorMessage)) == FALSE)
294 {
295 LoadString(hInstance, IDS_DEFAULTMCIERRMSG, szErrorMessage, ARRAYSIZE(szErrorMessage));
296 }
297
298 StringCbPrintf(szTempMessage, sizeof(szTempMessage), _T("MMSYS%lu: %s"), mciError, szErrorMessage);
300}
#define IDS_DEFAULTMCIERRMSG
Definition: resource.h:28
#define mciGetErrorString
Definition: mmsystem.h:2865
#define StringCbPrintf
Definition: strsafe.h:544
#define MB_ICONEXCLAMATION
Definition: winuser.h:784

Referenced by GetDeviceMode(), HandleDeviceMenuItem(), OpenMediaFile(), SeekPlayback(), ShowDeviceProperties(), StartPlayback(), StopPlayback(), SwitchViewMode(), and TogglePlaybackState().

◆ StartPlayback()

static VOID StartPlayback ( HWND  hwnd)
static

Definition at line 773 of file mplay32.c.

774{
775 MCIERROR mciError;
776 MCI_PLAY_PARMS mciPlay;
777 MCI_SEEK_PARMS mciSeek;
778
780
782
783 mciPlay.dwCallback = (DWORD_PTR)hwnd;
784 mciPlay.dwFrom = 0;
785 mciPlay.dwTo = MaxFilePos;
786
787 mciError = mciSendCommand(wDeviceId, MCI_PLAY, MCI_NOTIFY | MCI_FROM /*| MCI_TO*/, (DWORD_PTR)&mciPlay);
788 if (mciError != 0)
789 {
790 ShowMCIError(hwnd, mciError);
791 return;
792 }
793
795
798 0,
799 IDC_PAUSE);
802 IDC_PAUSE,
804}
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
#define MCI_FROM
Definition: mmsystem.h:731
VOID CALLBACK PlayTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: mplay32.c:757
#define TB_CHANGEBITMAP
Definition: commctrl.h:1144
#define TB_SETCMDID
Definition: commctrl.h:1143
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
VOID(CALLBACK * TIMERPROC)(HWND, UINT, UINT_PTR, DWORD)
Definition: winuser.h:2896

Referenced by MainWndProc(), OpenMediaFile(), and TogglePlaybackState().

◆ StopPlayback()

static VOID StopPlayback ( HWND  hwnd)
static

Definition at line 652 of file mplay32.c.

653{
654 MCIERROR mciError;
655 MCI_GENERIC_PARMS mciGeneric;
656 MCI_SEEK_PARMS mciSeek;
657
658 if (wDeviceId == 0) return;
659
662
663 mciGeneric.dwCallback = (DWORD_PTR)hwnd;
664 mciError = mciSendCommand(wDeviceId, MCI_STOP, MCI_WAIT, (DWORD_PTR)&mciGeneric);
665 if (mciError != 0)
666 {
667 ShowMCIError(hwnd, mciError);
668 return;
669 }
670
672
675
678 0,
679 IDC_PLAY);
682 IDC_PLAY,
684}
#define MCI_STOP
Definition: mmsystem.h:651

Referenced by CloseMediaFile(), MainWndProc(), SeekBackPlayback(), and SeekForwPlayback().

◆ SwitchViewMode()

static VOID SwitchViewMode ( HWND  hwnd)
static

Definition at line 371 of file mplay32.c.

372{
373 MCIERROR mciError;
374 MCI_DGV_RECT_PARMS mciVideoRect;
375 MCI_DGV_WINDOW_PARMSW mciVideoWindow;
376 RECT rcToolbarRect;
377 RECT rcTempRect;
378
379 mciVideoWindow.hWnd = hwnd;
380
382 if (mciError != 0)
383 return;
384
386 if (mciError != 0)
387 return;
388
389 if (!bIsSingleWindow)
390 {
392
394
396 if (mciError != 0)
397 {
398 ShowMCIError(hwnd, mciError);
399 return;
400 }
401
402 GetWindowRect(hToolBar, &rcToolbarRect);
403 ResizeClientArea(hwnd, mciVideoRect.rc.right, mciVideoRect.rc.bottom + (rcToolbarRect.bottom - rcToolbarRect.top));
404
405 mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&mciVideoWindow);
406 if (mciError != 0)
407 {
408 ShowMCIError(hwnd, mciError);
409 return;
410 }
411
412 GetWindowRect(hToolBar, &rcTempRect);
413 MoveWindow(hTrackBar, 180, 0, rcTempRect.right - rcTempRect.left - 322, 25, TRUE);
414 MoveWindow(hTimeDisplay, rcTempRect.right - rcTempRect.left - 140, 4, 135, 18, TRUE);
415
418 }
419 else
420 {
423
424 mciVideoWindow.hWnd = MCI_DGV_WINDOW_DEFAULT;
425 mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&mciVideoWindow);
426 if (mciError != 0)
427 {
428 ShowMCIError(hwnd, mciError);
429 return;
430 }
431
433
435 }
436}
#define MCI_DGV_WINDOW_DEFAULT
Definition: digitalv.h:459
RECT PrevWindowPos
Definition: mplay32.c:36
void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
Definition: mplay32.c:89
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)

Referenced by CloseMediaFile(), and MainWndProc().

◆ TogglePlaybackState()

static VOID TogglePlaybackState ( HWND  hwnd)
static

Definition at line 807 of file mplay32.c.

808{
809 MCIERROR mciError;
810 MCI_GENERIC_PARMS mciGeneric;
811 ULONG idBmp = IDB_PLAYICON;
812 ULONG idCmd = IDC_PLAY;
813
814 if (wDeviceId == 0) return;
815
816 switch (GetDeviceMode(hwnd))
817 {
818 case MCI_MODE_OPEN:
819 case MCI_MODE_STOP:
820 {
822 return;
823 }
824
825 case MCI_MODE_PLAY:
826 {
827 mciGeneric.dwCallback = (DWORD_PTR)hwnd;
828 mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
829 idBmp = IDB_PLAYICON;
830 idCmd = IDC_PLAY;
831 break;
832 }
833
834 case MCI_MODE_PAUSE:
835 {
836 mciGeneric.dwCallback = (DWORD_PTR)hwnd;
837 mciError = mciSendCommand(wDeviceId, MCI_RESUME, MCI_WAIT, (DWORD_PTR)&mciGeneric);
838 idBmp = IDB_PAUSEICON;
839 idCmd = IDC_PAUSE;
840 break;
841 }
842
843 default:
844 {
845 return;
846 }
847 }
848
849 if (mciError != 0)
850 {
851 ShowMCIError(hwnd, mciError);
852 return;
853 }
854
856
859 0,
860 idCmd);
863 idCmd,
864 idBmp - IDB_PLAYICON);
865}
#define MCI_RESUME
Definition: mmsystem.h:675
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define MCI_MODE_OPEN
Definition: mmsystem.h:700
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define MCI_PAUSE
Definition: mmsystem.h:652
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
static DWORD GetDeviceMode(HWND hwnd)
Definition: mplay32.c:635
uint32_t ULONG
Definition: typedefs.h:59

Referenced by MainWndProc().

◆ UpdateTimeDisplay()

void UpdateTimeDisplay ( HWND  hwnd)

Definition at line 167 of file mplay32.c.

168{
169 MCI_STATUS_PARMS mciStatus;
171 DWORD dwTimeFormat;
172
173 if (!wDeviceId)
174 {
175 SetWindowText(hwnd, _T(""));
176 return;
177 }
178
179 mciStatus.dwItem = MCI_STATUS_TIME_FORMAT;
180 mciStatus.dwReturn = 0;
182 dwTimeFormat = mciStatus.dwReturn;
183
184 mciStatus.dwItem = MCI_STATUS_POSITION;
185 mciStatus.dwReturn = 0;
187
188 switch(dwTimeFormat)
189 {
191 {
192 int s, m, h;
193
194 s = (mciStatus.dwReturn / 1000) % 60;
195 m = ((mciStatus.dwReturn / (1000*60)) % 60);
196 h = ((mciStatus.dwReturn / (1000*60*60)) % 24);
197 StringCbPrintf(szTime, sizeof(szTime), _T("%02lu:%02lu:%02lu"), h, m, s);
198 break;
199 }
200
201 /* The time format is unknown, so use the returned position as is */
202 default:
203 {
204 StringCbPrintf(szTime, sizeof(szTime), _T("%lu"), mciStatus.dwReturn);
205 break;
206 }
207 }
208
210}
GLdouble s
Definition: gl.h:2039
const GLfloat * m
Definition: glext.h:10848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define MCI_FORMAT_MILLISECONDS
Definition: mmsystem.h:701
#define MCI_STATUS_TIME_FORMAT
Definition: mmsystem.h:749
TCHAR szTime[64]
Definition: solitaire.cpp:20
#define SetWindowText
Definition: winuser.h:5856

Referenced by CloseMciDevice(), OpenMciDevice(), PlayTimerProc(), and StopPlayback().

◆ UpdateWindowCaption()

void UpdateWindowCaption ( HWND  hwnd)

Definition at line 102 of file mplay32.c.

103{
104 TCHAR szNewTitle[MAX_PATH + 3 + 256];
105 TCHAR szStatus[128];
106
107 if (wDeviceId == 0)
108 {
110 return;
111 }
112
113 switch (GetDeviceMode(hwnd))
114 {
115 case MCI_MODE_PAUSE:
116 {
117 LoadString(hInstance, IDS_MODE_PAUSE, szStatus, ARRAYSIZE(szStatus));
118 break;
119 }
120
121 case MCI_MODE_STOP:
122 {
123 LoadString(hInstance, IDS_MODE_STOP, szStatus, ARRAYSIZE(szStatus));
124 break;
125 }
126
127 case MCI_MODE_PLAY:
128 {
129 LoadString(hInstance, IDS_MODE_PLAY, szStatus, ARRAYSIZE(szStatus));
130 break;
131 }
132
133 case MCI_MODE_OPEN:
134 {
135 LoadString(hInstance, IDS_MODE_OPEN, szStatus, ARRAYSIZE(szStatus));
136 break;
137 }
138
139 case MCI_MODE_RECORD:
140 {
141 LoadString(hInstance, IDS_MODE_RECORD, szStatus, ARRAYSIZE(szStatus));
142 break;
143 }
144
145 case MCI_MODE_SEEK:
146 {
147 LoadString(hInstance, IDS_MODE_SEEK, szStatus, ARRAYSIZE(szStatus));
148 break;
149 }
150
152 {
153 LoadString(hInstance, IDS_MODE_NOT_READY, szStatus, ARRAYSIZE(szStatus));
154 break;
155 }
156
157 default:
158 {
159 LoadString(hInstance, IDS_MODE_UNKNOWN, szStatus, ARRAYSIZE(szStatus));
160 }
161 }
162
163 StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s (%s)"), szAppTitle, szCurrentFile, szStatus);
164 SetWindowText(hwnd, szNewTitle);
165}
#define IDS_MODE_SEEK
Definition: resource.h:36
#define IDS_MODE_NOT_READY
Definition: resource.h:37
#define IDS_MODE_RECORD
Definition: resource.h:35
#define IDS_MODE_PAUSE
Definition: resource.h:34
#define IDS_MODE_STOP
Definition: resource.h:32
#define IDS_MODE_UNKNOWN
Definition: resource.h:30
#define IDS_MODE_PLAY
Definition: resource.h:33
#define IDS_MODE_OPEN
Definition: resource.h:31
#define MCI_MODE_RECORD
Definition: mmsystem.h:697
#define MCI_MODE_SEEK
Definition: mmsystem.h:698

Referenced by CloseMediaFile(), EDIT_WndProc(), OpenMciDevice(), StartPlayback(), StopPlayback(), and TogglePlaybackState().

Variable Documentation

◆ bIsSingleWindow

BOOL bIsSingleWindow = FALSE

Definition at line 34 of file mplay32.c.

Referenced by CloseMediaFile(), MainWndProc(), and SwitchViewMode().

◆ bRepeat

BOOL bRepeat = FALSE

Definition at line 33 of file mplay32.c.

Referenced by MainWndProc().

◆ Buttons

const TBBUTTON Buttons[]
static
Initial value:
=
{
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
}
#define TBICON_PLAY
Definition: resource.h:59
#define TBICON_SEEKBACK
Definition: resource.h:63
#define TBICON_STOP
Definition: resource.h:60
#define TBICON_EJECT
Definition: resource.h:61
#define TBICON_SEEKFORW
Definition: resource.h:64
#define TBICON_FORWARD
Definition: resource.h:65
#define TBICON_BACKWARD
Definition: resource.h:62
#define BTNS_BUTTON
Definition: commctrl.h:998
#define BTNS_SEP
Definition: commctrl.h:999
#define TBSTATE_ENABLED
Definition: commctrl.h:974

Definition at line 41 of file mplay32.c.

Referenced by CMainToolbar::Create(), HEXEDIT_WM_LBUTTONDOWN(), InitControls(), InPortIsr(), KbdHid_StartDevice(), MessageBoxTimeoutIndirectW(), and MouHid_StartDevice().

◆ hInstance

◆ hMainMenu

◆ hTimeDisplay

◆ hToolBar

◆ hTrackBar

HWND hTrackBar = NULL

◆ MaxFilePos

UINT MaxFilePos = 0

Definition at line 35 of file mplay32.c.

Referenced by OpenMciDevice(), SeekForwPlayback(), and StartPlayback().

◆ PrevWindowPos

RECT PrevWindowPos

Definition at line 36 of file mplay32.c.

Referenced by SwitchViewMode().

◆ szAppTitle

TCHAR szAppTitle[256] = _T("")

◆ szCurrentFile

TCHAR szCurrentFile[MAX_PATH] = _T("")

Definition at line 29 of file mplay32.c.

Referenced by OpenMciDevice(), and UpdateWindowCaption().

◆ szDefaultFilter

TCHAR szDefaultFilter[MAX_PATH] = _T("")

Definition at line 28 of file mplay32.c.

Referenced by BuildFileFilterAndDeviceMenu(), and CleanupFileFilter().

◆ szFilter

◆ wDeviceId