ReactOS  0.4.15-dev-1039-gb9754fa
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 1465 of file mplay32.c.

1466 {
1467  WNDCLASSEX WndClass = {0};
1468  TCHAR szClassName[] = _T("ROSMPLAY32");
1469  HWND hwnd;
1470  MSG msg;
1471  DWORD dwError;
1472  HANDLE hAccel;
1473 
1474  hInstance = hInst;
1475 
1476  switch (GetUserDefaultUILanguage())
1477  {
1480  break;
1481 
1482  default:
1483  break;
1484  }
1485 
1487 
1488  WndClass.cbSize = sizeof(WndClass);
1489  WndClass.lpszClassName = szClassName;
1490  WndClass.lpfnWndProc = MainWndProc;
1491  WndClass.hInstance = hInstance;
1492  WndClass.style = CS_HREDRAW | CS_VREDRAW;
1494  WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
1495  WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1496  WndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
1497 
1498  if (!RegisterClassEx(&WndClass))
1499  {
1501  return 0;
1502  }
1503 
1505  szAppTitle,
1507  CW_USEDEFAULT,
1508  CW_USEDEFAULT,
1509  350,
1511  NULL,
1512  NULL,
1513  hInstance,
1514  NULL);
1515  if (!hwnd)
1516  {
1518  return 0;
1519  }
1520 
1522 
1524 
1526 
1527  DisableMenuItems();
1528 
1529  dwError = SearchPath(NULL, _T("SNDVOL32.EXE"), NULL, 0, NULL, NULL);
1530  if (dwError == 0)
1531  {
1533  }
1534 
1535  /* Show it */
1537  UpdateWindow(hwnd);
1538 
1539  if (*lpCmdLine == _T('"'))
1540  {
1541  OpenMediaFile(hwnd, argv[1], NULL);
1542  }
1543  else
1544  {
1545  OpenMediaFile(hwnd, lpCmdLine, NULL);
1546  }
1547 
1548  /* Message Loop */
1549  while (GetMessage(&msg, NULL, 0, 0))
1550  {
1552  {
1554  DispatchMessage(&msg);
1555  }
1556  }
1557 
1559 
1561 
1562  return (INT)msg.wParam;
1563 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define TranslateAccelerator
Definition: winuser.h:5835
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDR_MAINMENU
Definition: resource.h:40
#define DispatchMessage
Definition: winuser.h:5740
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:806
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define RegisterClassEx
Definition: winuser.h:5812
#define MF_BYCOMMAND
Definition: winuser.h:202
#define LAYOUT_RTL
Definition: wingdi.h:1370
#define CreateWindow
Definition: winuser.h:5729
#define IDS_APPTITLE
Definition: resource.h:3
static VOID BuildFileFilterAndDeviceMenu(VOID)
Definition: mplay32.c:951
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
BOOL WINAPI UpdateWindow(_In_ HWND)
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:527
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define CS_HREDRAW
Definition: winuser.h:648
HINSTANCE hInstance
Definition: mplay32.c:21
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define argv
Definition: mplay32.c:18
#define WS_CLIPCHILDREN
Definition: pedump.c:619
int32_t INT
Definition: typedefs.h:58
#define LANG_HEBREW
Definition: nls.h:67
#define SearchPath
Definition: winbase.h:3740
static VOID ShowLastWin32Error(HWND hwnd)
Definition: mplay32.c:213
#define MAIN_WINDOW_HEIGHT
Definition: mplay32.c:11
HMENU hMainMenu
Definition: mplay32.c:25
#define LoadAccelerators
Definition: winuser.h:5785
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_ACCELERATORS
Definition: resource.h:43
HACCEL hAccel
Definition: main.c:47
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
static VOID CleanupFileFilter(VOID)
Definition: mplay32.c:1142
void DisableMenuItems(void)
Definition: mplay32.c:82
#define SW_SHOW
Definition: winuser.h:769
static VOID OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
Definition: mplay32.c:893
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1720
#define WS_CAPTION
Definition: pedump.c:624
#define CS_VREDRAW
Definition: winuser.h:653
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: mplay32.c:1206
static const WCHAR szClassName[]
Definition: clipbrd.c:11
#define WS_OVERLAPPED
Definition: pedump.c:615
TCHAR szAppTitle[256]
Definition: mplay32.c:27
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDI_MAIN
Definition: resource.h:4
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5787
HINSTANCE hInst
Definition: dxdiag.c:13
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define GetMessage
Definition: winuser.h:5765
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define IDM_VOLUMECTL
Definition: resource.h:50
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LoadIcon
Definition: winuser.h:5788
#define MF_GRAYED
Definition: winuser.h:129
#define WS_SYSMENU
Definition: pedump.c:629
#define LoadString
Definition: winuser.h:5794
WCHAR WndClass[]
Definition: capicon.c:23

◆ 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  {
1022  if (GetDeviceName(j, szDeviceName, sizeof(szDeviceName)))
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 
1112 Cleanup:
1113  if (szExtensionList) free(szExtensionList);
1114  if (szExtension) free(szExtension);
1115  if (szDevice) free(szDevice);
1116  RegCloseKey(hKey);
1117 
1118  return;
1119 
1120 Failure:
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 CharLowerBuff
Definition: winuser.h:5713
static DWORD GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
Definition: mplay32.c:456
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1648
HINSTANCE hInstance
Definition: mplay32.c:21
HMENU hMainMenu
Definition: mplay32.c:25
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define StringCbPrintfEx
Definition: strsafe.h:600
smooth NULL
Definition: ftsmooth.c:416
LPTSTR szFilter
Definition: mplay32.c:30
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
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD GetNumDevices(VOID)
Definition: mplay32.c:439
#define StringCbCopy
Definition: strsafe.h:155
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
static const WCHAR szDeviceName[]
Definition: provider.c:56
static const WCHAR Cleanup[]
Definition: register.c:80
#define IDS_ALL_TYPES_FILTER
Definition: resource.h:26
static DWORD GetDeviceFriendlyName(LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
Definition: mplay32.c:470
#define RegOpenKeyEx
Definition: winreg.h:520
#define MAX_MCISTR
Definition: mplay32.c:13
#define StringCbCopyEx
Definition: strsafe.h:192
#define IDM_DEVICE_FIRST
Definition: resource.h:56
static DWORD InsertDeviceMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD dwDeviceIndex)
Definition: mplay32.c:914
#define malloc
Definition: debug_ros.c:4
TCHAR szDefaultFilter[MAX_PATH]
Definition: mplay32.c:28
#define RegEnumValue
Definition: winreg.h:511
#define LoadString
Definition: winuser.h:5794
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by _tWinMain().

◆ CleanupFileFilter()

static VOID CleanupFileFilter ( VOID  )
static

Definition at line 1142 of file mplay32.c.

1143 {
1145 }
#define free
Definition: debug_ros.c:5
LPTSTR szFilter
Definition: mplay32.c:30
TCHAR szDefaultFilter[MAX_PATH]
Definition: mplay32.c:28

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 }
HWND hTimeDisplay
Definition: mplay32.c:24
#define MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
WORD wDeviceId
Definition: mplay32.c:32
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:167
void DisableMenuItems(void)
Definition: mplay32.c:82
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_CLOSE
Definition: mmsystem.h:647

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 
888  CloseMciDevice();
890 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static VOID SwitchViewMode(HWND hwnd)
Definition: mplay32.c:371
BOOL bIsSingleWindow
Definition: mplay32.c:34
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:652
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102
static MCIERROR CloseMciDevice(VOID)
Definition: mplay32.c:532

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;
519  mciDevCaps.dwItem = MCI_GETDEVCAPS_USES_FILES;
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 MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
#define MCI_GETDEVCAPS_USES_FILES
Definition: mmsystem.h:763
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define MCI_OPEN
Definition: mmsystem.h:646
#define MCI_OPEN_TYPE
Definition: mmsystem.h:739
MCIDEVICEID wDeviceID
Definition: mmsystem.h:1522
DWORD MCIERROR
Definition: mmsystem.h:958
#define MCI_GETDEVCAPS_ITEM
Definition: mmsystem.h:758
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD_PTR dwCallback
Definition: mmsystem.h:1521
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
LPCSTR lpstrDeviceType
Definition: mmsystem.h:1523
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCI_GETDEVCAPS
Definition: mmsystem.h:654
LPCSTR lpstrElementName
Definition: mmsystem.h:1524

Referenced by HandleDeviceMenuItem(), and InsertDeviceMenuItem().

◆ DisableMenuItems()

void DisableMenuItems ( void  )

Definition at line 82 of file mplay32.c.

83 {
87 }
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDM_DEVPROPS
Definition: resource.h:51
HMENU hMainMenu
Definition: mplay32.c:25
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDM_SWITCHVIEW
Definition: resource.h:53
#define IDM_CLOSE_FILE
Definition: resource.h:47
#define MF_GRAYED
Definition: winuser.h:129

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 
71  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD_PTR)&mciVideoWindow);
72  if (!mciError)
73  {
75  if (!mciError)
76  {
78  }
79  }
80 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MF_BYCOMMAND
Definition: winuser.h:202
#define mciSendCommand
Definition: mmsystem.h:2861
#define IDM_DEVPROPS
Definition: resource.h:51
WORD wDeviceId
Definition: mplay32.c:32
#define MCI_WINDOW
Definition: mmsystem.h:665
HMENU hMainMenu
Definition: mplay32.c:25
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MCI_WHERE
Definition: mmsystem.h:667
#define MCI_DGV_WHERE_SOURCE
Definition: digitalv.h:444
#define IDM_SWITCHVIEW
Definition: resource.h:53
#define MCI_DGV_WINDOW_HWND
Definition: digitalv.h:453
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MCI_TEST
Definition: digitalv.h:32
#define MF_ENABLED
Definition: winuser.h:128
#define IDM_CLOSE_FILE
Definition: resource.h:47
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65

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_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
smooth NULL
Definition: ftsmooth.c:416
#define MCI_OPEN
Definition: mmsystem.h:646
#define MCI_INFO
Definition: mmsystem.h:653
#define MCI_OPEN_TYPE
Definition: mmsystem.h:739
MCIDEVICEID wDeviceID
Definition: mmsystem.h:1522
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD_PTR dwCallback
Definition: mmsystem.h:1521
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
LPCSTR lpstrDeviceType
Definition: mmsystem.h:1523
#define MCI_CLOSE
Definition: mmsystem.h:647
LPCSTR lpstrElementName
Definition: mmsystem.h:1524
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
#define MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
WORD wDeviceId
Definition: mplay32.c:32
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
#define MCI_STATUS
Definition: mmsystem.h:662
#define MCI_STATUS_MODE
Definition: mmsystem.h:747
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694

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 mciSendCommand
Definition: mmsystem.h:2861
DWORD_PTR dwCallback
Definition: mmsystem.h:1591
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_DEVTYPE_WAVEFORM_AUDIO
Definition: mmsystem.h:689
#define MCI_SYSINFO_NAME
Definition: mmsystem.h:770
#define MCI_SYSINFO
Definition: mmsystem.h:659

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 mciSendCommand
Definition: mmsystem.h:2861
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define MCI_SYSINFO_QUANTITY
Definition: mmsystem.h:768
DWORD_PTR dwCallback
Definition: mmsystem.h:1591
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_SYSINFO
Definition: mmsystem.h:659

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static DWORD GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
Definition: mplay32.c:456
ULONG_PTR dwItemData
Definition: winuser.h:3225
static MCIERROR OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
Definition: mplay32.c:552
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
#define ZeroMemory
Definition: winbase.h:1648
HMENU hMainMenu
Definition: mplay32.c:25
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define GetMenuItemInfo
Definition: winuser.h:5763
char TCHAR
Definition: xmlstorage.h:189
static BOOL DeviceUsesFiles(LPTSTR lpDeviceName)
Definition: mplay32.c:500
DWORD MCIERROR
Definition: mmsystem.h:958
static const WCHAR szDeviceName[]
Definition: provider.c:56
#define MAX_MCISTR
Definition: mplay32.c:13
#define IDM_DEVICE_FIRST
Definition: resource.h:56
#define MIIM_DATA
Definition: winuser.h:721
static VOID OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
Definition: mplay32.c:1148

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 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HWND hTimeDisplay
Definition: mplay32.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hTrackBar
Definition: mplay32.c:22
#define TBS_ENABLESELRANGE
Definition: commctrl.h:2020
#define TRACKBAR_CLASS
Definition: commctrl.h:2009
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hInstance
Definition: mplay32.c:21
HWND hToolBar
Definition: mplay32.c:23
#define WS_CHILD
Definition: pedump.c:617
int32_t INT
Definition: typedefs.h:58
static VOID ShowLastWin32Error(HWND hwnd)
Definition: mplay32.c:213
#define CreateWindowEx
Definition: winuser.h:5730
#define TOOLBARCLASSNAME
Definition: commctrl.h:942
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_BOTTOM
Definition: commctrl.h:2240
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
#define SS_CENTER
Definition: pedump.c:693
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
static const WCHAR L[]
Definition: oid.c:1250
#define TB_ADDBUTTONS
Definition: commctrl.h:1267
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
#define WS_TABSTOP
Definition: pedump.c:634
#define SS_SUNKEN
Definition: winuser.h:358
#define SendMessage
Definition: winuser.h:5818
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_FLAT
Definition: commctrl.h:988

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 }
static DWORD GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
Definition: mplay32.c:456
ULONG_PTR dwItemData
Definition: winuser.h:3225
#define MF_STRING
Definition: winuser.h:138
#define ZeroMemory
Definition: winbase.h:1648
#define MIIM_ID
Definition: winuser.h:717
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define StringCbCat
Definition: strsafe.h:334
static BOOL DeviceUsesFiles(LPTSTR lpDeviceName)
Definition: mplay32.c:500
DWORD MCIERROR
Definition: mmsystem.h:958
#define MIIM_TYPE
Definition: winuser.h:720
static const WCHAR szDeviceName[]
Definition: provider.c:56
static DWORD GetDeviceFriendlyName(LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
Definition: mplay32.c:470
#define MAX_MCISTR
Definition: mplay32.c:13
#define MIIM_DATA
Definition: winuser.h:721
LPSTR dwTypeData
Definition: winuser.h:3226
#define InsertMenuItem
Definition: winuser.h:5779

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  {
1212  InitControls(hwnd);
1213  hMainMenu = GetMenu(hwnd);
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  {
1233  StopPlayback(hwnd);
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  {
1313  UINT Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
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 
1323  GetClientRect(hwnd, &Rect);
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  {
1365  if (LOWORD(wParam) >= IDM_DEVICE_FIRST)
1366  {
1368  break;
1369  }
1370 
1371  switch (LOWORD(wParam))
1372  {
1373  case IDC_PLAY:
1374  case IDC_PAUSE:
1375  {
1376  if (wDeviceId)
1378  else
1379  OpenFileDialog(hwnd, 1, NULL);
1380 
1381  break;
1382  }
1383 
1384  case IDC_STOP:
1385  StopPlayback(hwnd);
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:
1406  OpenFileDialog(hwnd, 1, NULL);
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  {
1443  ShellAbout(hwnd, szAppTitle, NULL, mplayIcon);
1444  DeleteObject(mplayIcon);
1445  break;
1446  }
1447 
1448  case IDM_EXIT:
1449  PostMessage(hwnd, WM_CLOSE, 0, 0);
1450  return 0;
1451  }
1452  break;
1453  }
1454 
1455  case WM_DESTROY:
1457  PostQuitMessage(0);
1458  return 0;
1459  }
1460 
1461  return DefWindowProc(hwnd, Message, wParam, lParam);
1462 }
HWND hTimeDisplay
Definition: mplay32.c:24
#define IDC_SEEKBACK
Definition: resource.h:72
#define MCI_DGV_PUT_DESTINATION
Definition: digitalv.h:234
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define IDS_TOOLTIP_SEEKFORW
Definition: resource.h:23
#define IDC_BACKWARD
Definition: resource.h:71
#define IDS_TOOLTIP_STOP
Definition: resource.h:19
#define MF_BYCOMMAND
Definition: winuser.h:202
HWND hTrackBar
Definition: mplay32.c:22
#define IDM_ABOUT
Definition: resource.h:29
#define MCI_WAIT
Definition: mmsystem.h:730
static VOID TogglePlaybackState(HWND hwnd)
Definition: mplay32.c:807
#define TRUE
Definition: types.h:120
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID HandleDeviceMenuItem(HWND hwnd, UINT uItem)
Definition: mplay32.c:1172
#define IDC_SEEKFORW
Definition: resource.h:73
LONG top
Definition: windef.h:307
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hInstance
Definition: mplay32.c:21
#define TBM_SETPOS
Definition: commctrl.h:2032
#define IDM_DEVPROPS
Definition: resource.h:51
HWND hToolBar
Definition: mplay32.c:23
static VOID StartPlayback(HWND hwnd)
Definition: mplay32.c:773
LONG left
Definition: windef.h:306
#define IDC_PAUSE
Definition: resource.h:75
LONG right
Definition: windef.h:308
#define DWORD
Definition: nt_native.h:44
WPARAM wParam
Definition: combotst.c:138
BOOL bRepeat
Definition: mplay32.c:33
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
#define TB_GETITEMRECT
Definition: commctrl.h:1129
struct tagNMHDR * LPNMHDR
WORD wDeviceId
Definition: mplay32.c:32
UINT code
Definition: winuser.h:3134
#define MAIN_WINDOW_HEIGHT
Definition: mplay32.c:11
#define IDM_REPEAT
Definition: resource.h:52
HMENU hMainMenu
Definition: mplay32.c:25
#define MAIN_WINDOW_MIN_WIDTH
Definition: mplay32.c:12
#define FALSE
Definition: types.h:117
static VOID SwitchViewMode(HWND hwnd)
Definition: mplay32.c:371
#define TB_AUTOSIZE
Definition: commctrl.h:1133
#define TBM_GETPOS
Definition: commctrl.h:2027
#define IDS_TOOLTIP_EJECT
Definition: resource.h:20
#define ShellExecute
Definition: shellapi.h:691
#define WM_DROPFILES
Definition: winuser.h:1807
#define TTN_GETDISPINFO
Definition: commctrl.h:1874
#define IDC_STOP
Definition: resource.h:69
#define WM_SIZING
Definition: winuser.h:1789
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define LPRECT
Definition: precomp.h:28
switch(r->id)
Definition: btrfs.c:2980
static VOID OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
Definition: mplay32.c:893
#define IDM_SWITCHVIEW
Definition: resource.h:53
BOOL bIsSingleWindow
Definition: mplay32.c:34
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define PostMessage
Definition: winuser.h:5807
#define MF_CHECKED
Definition: winuser.h:132
#define LPTOOLTIPTEXT
Definition: commctrl.h:1886
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define IDS_TOOLTIP_SEEKBACK
Definition: resource.h:22
#define WM_SIZE
Definition: winuser.h:1593
#define IDC_EJECT
Definition: resource.h:70
#define IDM_OPEN_FILE
Definition: resource.h:46
static VOID SeekBackPlayback(HWND hwnd)
Definition: mplay32.c:711
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:34
TCHAR szAppTitle[256]
Definition: mplay32.c:27
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID CloseMediaFile(HWND hwnd)
Definition: mplay32.c:881
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ShellAbout
Definition: shellapi.h:690
#define IDM_CLOSE_FILE
Definition: resource.h:47
CHAR Message[80]
Definition: alive.c:5
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
static const WCHAR L[]
Definition: oid.c:1250
#define IDI_MAIN
Definition: resource.h:4
#define IDS_TOOLTIP_PLAY
Definition: resource.h:18
#define IDC_FORWARD
Definition: resource.h:74
#define IDS_TOOLTIP_PAUSE
Definition: resource.h:25
#define WM_COMMAND
Definition: winuser.h:1722
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define HTCAPTION
Definition: winuser.h:2451
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:652
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SW_SHOWNORMAL
Definition: winuser.h:764
static VOID SeekForwPlayback(HWND hwnd)
Definition: mplay32.c:734
#define MCI_PUT
Definition: mmsystem.h:666
#define MM_MCINOTIFY
Definition: mmsystem.h:55
#define IDC_PLAY
Definition: resource.h:68
static VOID SeekPlayback(HWND hwnd, DWORD dwNewPos)
Definition: mplay32.c:687
unsigned int UINT
Definition: ndis.h:50
#define WM_HSCROLL
Definition: winuser.h:1725
#define IDM_EXIT
Definition: resource.h:27
#define DragQueryFile
Definition: shellapi.h:684
#define IDM_VOLUMECTL
Definition: resource.h:50
#define IDS_TOOLTIP_FORWARD
Definition: resource.h:24
#define SendMessage
Definition: winuser.h:5818
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
#define WM_CREATE
Definition: winuser.h:1590
#define IDM_DEVICE_FIRST
Definition: resource.h:56
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define MCI_DGV_RECT
Definition: digitalv.h:232
#define IDS_TOOLTIP_BACKWARD
Definition: resource.h:21
#define SM_CYMENU
Definition: winuser.h:966
#define LoadIcon
Definition: winuser.h:5788
static VOID ShowDeviceProperties(HWND hwnd)
Definition: mplay32.c:868
HMENU WINAPI GetMenu(_In_ HWND)
static VOID OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
Definition: mplay32.c:1148
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_NOTIFY
Definition: richedit.h:61
struct Rect Rect
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1676

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_FILEMUSTEXIST
Definition: commdlg.h:106
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hwndOwner
Definition: commdlg.h:330
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1648
HINSTANCE hInstance
Definition: mplay32.c:21
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define GetOpenFileName
Definition: commdlg.h:665
DWORD nMaxFile
Definition: commdlg.h:337
LPTSTR szFilter
Definition: mplay32.c:30
HINSTANCE hInstance
Definition: commdlg.h:331
static VOID OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
Definition: mplay32.c:893
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_SHAREAWARE
Definition: commdlg.h:119
LPSTR lpstrFile
Definition: commdlg.h:336
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nFilterIndex
Definition: commdlg.h:335
DWORD Flags
Definition: commdlg.h:342

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)
561  CloseMciDevice();
562 
563  mciOpen.lpstrDeviceType = lpType;
564  mciOpen.lpstrElementName = lpFileName;
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 
624  StringCbCopy(szCurrentFile, sizeof(szCurrentFile), lpStr);
625 
627 
630 
631  return 0;
632 }
HWND hTimeDisplay
Definition: mplay32.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hTrackBar
Definition: mplay32.c:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
#define MCI_WAIT
Definition: mmsystem.h:730
UINT MaxFilePos
Definition: mplay32.c:35
#define TRUE
Definition: types.h:120
#define mciSendCommand
Definition: mmsystem.h:2861
#define TBM_SETPOS
Definition: commctrl.h:2032
UINT_PTR WPARAM
Definition: windef.h:207
CHAR * LPTSTR
Definition: xmlstorage.h:192
WORD wDeviceId
Definition: mplay32.c:32
#define TBM_SETRANGEMIN
Definition: commctrl.h:2034
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:167
#define TBM_SETRANGEMAX
Definition: commctrl.h:2035
#define TBM_SETPAGESIZE
Definition: commctrl.h:2047
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MCI_OPEN
Definition: mmsystem.h:646
#define TBM_SETTICFREQ
Definition: commctrl.h:2046
TCHAR szCurrentFile[MAX_PATH]
Definition: mplay32.c:29
void EnableMenuItems(HWND hwnd)
Definition: mplay32.c:54
#define MCI_STATUS
Definition: mmsystem.h:662
#define _T(x)
Definition: vfdio.h:22
#define MCI_STATUS_LENGTH
Definition: mmsystem.h:744
#define MCI_OPEN_TYPE
Definition: mmsystem.h:739
unsigned long DWORD
Definition: ntddk_ex.h:95
MCIDEVICEID wDeviceID
Definition: mmsystem.h:1522
DWORD MCIERROR
Definition: mmsystem.h:958
#define StringCbCopy
Definition: strsafe.h:155
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD_PTR dwCallback
Definition: mmsystem.h:1521
LPCSTR lpstrDeviceType
Definition: mmsystem.h:1523
#define MCI_OPEN_ELEMENT
Definition: mmsystem.h:735
#define SendMessage
Definition: winuser.h:5818
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
LPCSTR lpstrElementName
Definition: mmsystem.h:1524
_In_ LPCSTR lpFileName
Definition: winbase.h:3034
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102
static MCIERROR CloseMciDevice(VOID)
Definition: mplay32.c:532
#define TBM_SETLINESIZE
Definition: commctrl.h:2049

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static MCIERROR OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
Definition: mplay32.c:552
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
static VOID StartPlayback(HWND hwnd)
Definition: mplay32.c:773
WORD wDeviceId
Definition: mplay32.c:32
static VOID CloseMediaFile(HWND hwnd)
Definition: mplay32.c:881
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD MCIERROR
Definition: mmsystem.h:958
#define GetFileAttributes
Definition: winbase.h:3655
_In_ LPCSTR lpFileName
Definition: winbase.h:3034

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 }
HWND hTimeDisplay
Definition: mplay32.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hTrackBar
Definition: mplay32.c:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
#define TRUE
Definition: types.h:120
#define mciSendCommand
Definition: mmsystem.h:2861
#define TBM_SETPOS
Definition: commctrl.h:2032
UINT_PTR WPARAM
Definition: windef.h:207
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
WORD wDeviceId
Definition: mplay32.c:32
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:167
#define IDT_PLAYTIMER
Definition: mplay32.c:9
LONG_PTR LPARAM
Definition: windef.h:208
#define MCI_STATUS
Definition: mmsystem.h:662
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define SendMessage
Definition: winuser.h:5818

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LONG bottom
Definition: windef.h:309
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
#define mciSendCommand
Definition: mmsystem.h:2861
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
WORD wDeviceId
Definition: mplay32.c:32
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
#define MCI_STATUS
Definition: mmsystem.h:662
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:65
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:652
static VOID SeekPlayback(HWND hwnd, DWORD dwNewPos)
Definition: mplay32.c:687
unsigned int UINT
Definition: ndis.h:50

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
UINT MaxFilePos
Definition: mplay32.c:35
#define mciSendCommand
Definition: mmsystem.h:2861
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
WORD wDeviceId
Definition: mplay32.c:32
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
#define MCI_STATUS
Definition: mmsystem.h:662
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:65
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:652
static VOID SeekPlayback(HWND hwnd, DWORD dwNewPos)
Definition: mplay32.c:687
unsigned int UINT
Definition: ndis.h:50

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DWORD_PTR
Definition: treelist.c:76
#define MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
#define MCI_PLAY
Definition: mmsystem.h:649
WORD wDeviceId
Definition: mplay32.c:32
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define MCI_SEEK
Definition: mmsystem.h:650
#define MCI_TO
Definition: mmsystem.h:732

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDB_SEEKBACKICON
Definition: resource.h:11
#define RGB(r, g, b)
Definition: precomp.h:62
#define IDB_FORWARDICON
Definition: resource.h:13
HINSTANCE hInstance
Definition: mplay32.c:21
HWND hToolBar
Definition: mplay32.c:23
#define IDB_PLAYICON
Definition: resource.h:7
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
static VOID ShowLastWin32Error(HWND hwnd)
Definition: mplay32.c:213
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define IDB_BACKWARDICON
Definition: resource.h:10
LONG_PTR LPARAM
Definition: windef.h:208
#define IDB_STOPICON
Definition: resource.h:8
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
#define IDB_SEEKFORWICON
Definition: resource.h:12
#define ILC_COLOR24
Definition: commctrl.h:353
#define IDB_PAUSEICON
Definition: resource.h:14
#define ILC_MASK
Definition: commctrl.h:347
#define IMAGE_BITMAP
Definition: winuser.h:211
#define IDB_EJECTICON
Definition: resource.h:9
#define SendMessage
Definition: winuser.h:5818
#define LoadImage
Definition: winuser.h:5790
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077

Referenced by DECLARE_INTERFACE_(), InitControls(), CSideTreeView::SetImageList(), 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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
WORD wDeviceId
Definition: mplay32.c:32
#define MCI_CONFIGURE
Definition: digitalv.h:45
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
TCHAR szAppTitle[256]
Definition: mplay32.c:27
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FormatMessage
Definition: winbase.h:3635
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5797
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MB_OK
Definition: winuser.h:784
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

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);
299  MessageBox(hwnd, szTempMessage, szAppTitle, MB_OK | MB_ICONEXCLAMATION);
300 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hInstance
Definition: mplay32.c:21
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define FALSE
Definition: types.h:117
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define StringCbPrintf
Definition: strsafe.h:544
TCHAR szAppTitle[256]
Definition: mplay32.c:27
#define MessageBox
Definition: winuser.h:5797
#define IDS_DEFAULTMCIERRMSG
Definition: resource.h:28
#define MB_OK
Definition: winuser.h:784
#define MAX_MCISTR
Definition: mplay32.c:13
#define LoadString
Definition: winuser.h:5794
#define mciGetErrorString
Definition: mmsystem.h:2865

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 
797  TB_SETCMDID,
798  0,
799  IDC_PAUSE);
802  IDC_PAUSE,
804 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define DWORD_PTR
Definition: treelist.c:76
#define MCI_WAIT
Definition: mmsystem.h:730
UINT MaxFilePos
Definition: mplay32.c:35
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
#define MCI_PLAY
Definition: mmsystem.h:649
HWND hToolBar
Definition: mplay32.c:23
#define IDC_PAUSE
Definition: resource.h:75
#define IDB_PLAYICON
Definition: resource.h:7
VOID(CALLBACK * TIMERPROC)(HWND, UINT, UINT_PTR, DWORD)
Definition: winuser.h:2872
WORD wDeviceId
Definition: mplay32.c:32
#define TB_SETCMDID
Definition: commctrl.h:1139
#define IDT_PLAYTIMER
Definition: mplay32.c:9
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDB_PAUSEICON
Definition: resource.h:14
DWORD MCIERROR
Definition: mmsystem.h:958
VOID CALLBACK PlayTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: mplay32.c:757
#define TB_CHANGEBITMAP
Definition: commctrl.h:1140
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
#define SendMessage
Definition: winuser.h:5818
#define MCI_FROM
Definition: mmsystem.h:731
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define MCI_SEEK
Definition: mmsystem.h:650
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102

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 
677  TB_SETCMDID,
678  0,
679  IDC_PLAY);
682  IDC_PLAY,
684 }
HWND hTimeDisplay
Definition: mplay32.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND hTrackBar
Definition: mplay32.c:22
#define DWORD_PTR
Definition: treelist.c:76
#define MCI_WAIT
Definition: mmsystem.h:730
#define TRUE
Definition: types.h:120
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
#define TBM_SETPOS
Definition: commctrl.h:2032
HWND hToolBar
Definition: mplay32.c:23
UINT_PTR WPARAM
Definition: windef.h:207
#define IDB_PLAYICON
Definition: resource.h:7
WORD wDeviceId
Definition: mplay32.c:32
#define MCI_STOP
Definition: mmsystem.h:651
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:167
#define TB_SETCMDID
Definition: commctrl.h:1139
#define IDT_PLAYTIMER
Definition: mplay32.c:9
LONG_PTR LPARAM
Definition: windef.h:208
DWORD MCIERROR
Definition: mmsystem.h:958
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define TB_CHANGEBITMAP
Definition: commctrl.h:1140
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
#define IDC_PLAY
Definition: resource.h:68
#define SendMessage
Definition: winuser.h:5818
#define MCI_SEEK
Definition: mmsystem.h:650
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102

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 
381  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD_PTR)&mciVideoWindow);
382  if (mciError != 0)
383  return;
384 
386  if (mciError != 0)
387  return;
388 
389  if (!bIsSingleWindow)
390  {
392 
394 
395  mciError = mciSendCommand(wDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE, (DWORD_PTR)&mciVideoRect);
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 }
HWND hTimeDisplay
Definition: mplay32.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MF_BYCOMMAND
Definition: winuser.h:202
HWND hTrackBar
Definition: mplay32.c:22
#define TRUE
Definition: types.h:120
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
LONG top
Definition: windef.h:307
HWND hToolBar
Definition: mplay32.c:23
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
WORD wDeviceId
Definition: mplay32.c:32
#define MCI_WINDOW
Definition: mmsystem.h:665
HMENU hMainMenu
Definition: mplay32.c:25
#define FALSE
Definition: types.h:117
#define MCI_WHERE
Definition: mmsystem.h:667
void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
Definition: mplay32.c:89
#define MCI_DGV_WHERE_SOURCE
Definition: digitalv.h:444
#define MCI_DGV_WINDOW_DEFAULT
Definition: digitalv.h:459
#define IDM_SWITCHVIEW
Definition: resource.h:53
BOOL bIsSingleWindow
Definition: mplay32.c:34
#define MCI_DGV_WINDOW_HWND
Definition: digitalv.h:453
#define MF_CHECKED
Definition: winuser.h:132
#define MCI_TEST
Definition: digitalv.h:32
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
DWORD MCIERROR
Definition: mmsystem.h:958
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
RECT PrevWindowPos
Definition: mplay32.c:36
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

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 
858  TB_SETCMDID,
859  0,
860  idCmd);
863  idCmd,
864  idBmp - IDB_PLAYICON);
865 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define DWORD_PTR
Definition: treelist.c:76
#define MCI_WAIT
Definition: mmsystem.h:730
#define mciSendCommand
Definition: mmsystem.h:2861
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:288
#define MCI_RESUME
Definition: mmsystem.h:675
HWND hToolBar
Definition: mplay32.c:23
static VOID StartPlayback(HWND hwnd)
Definition: mplay32.c:773
#define IDC_PAUSE
Definition: resource.h:75
#define IDB_PLAYICON
Definition: resource.h:7
WORD wDeviceId
Definition: mplay32.c:32
#define TB_SETCMDID
Definition: commctrl.h:1139
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define IDB_PAUSEICON
Definition: resource.h:14
static DWORD GetDeviceMode(HWND hwnd)
Definition: mplay32.c:635
DWORD MCIERROR
Definition: mmsystem.h:958
#define TB_CHANGEBITMAP
Definition: commctrl.h:1140
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
#define IDC_PLAY
Definition: resource.h:68
#define SendMessage
Definition: winuser.h:5818
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
#define MCI_PAUSE
Definition: mmsystem.h:652
#define MCI_MODE_OPEN
Definition: mmsystem.h:700
unsigned int ULONG
Definition: retypes.h:1
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:102

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
TCHAR szTime[64]
Definition: solitaire.cpp:18
#define mciSendCommand
Definition: mmsystem.h:2861
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
const GLfloat * m
Definition: glext.h:10848
WORD wDeviceId
Definition: mplay32.c:32
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
#define MCI_FORMAT_MILLISECONDS
Definition: mmsystem.h:701
#define MCI_STATUS
Definition: mmsystem.h:662
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define StringCbPrintf
Definition: strsafe.h:544
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define SetWindowText
Definition: winuser.h:5832
#define MAX_MCISTR
Definition: mplay32.c:13
#define MCI_STATUS_TIME_FORMAT
Definition: mmsystem.h:749

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  {
118  break;
119  }
120 
121  case MCI_MODE_STOP:
122  {
124  break;
125  }
126 
127  case MCI_MODE_PLAY:
128  {
130  break;
131  }
132 
133  case MCI_MODE_OPEN:
134  {
136  break;
137  }
138 
139  case MCI_MODE_RECORD:
140  {
142  break;
143  }
144 
145  case MCI_MODE_SEEK:
146  {
148  break;
149  }
150 
151  case MCI_MODE_NOT_READY:
152  {
154  break;
155  }
156 
157  default:
158  {
160  }
161  }
162 
163  StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s (%s)"), szAppTitle, szCurrentFile, szStatus);
164  SetWindowText(hwnd, szNewTitle);
165 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hInstance
Definition: mplay32.c:21
WORD wDeviceId
Definition: mplay32.c:32
#define MCI_MODE_RECORD
Definition: mmsystem.h:697
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define IDS_MODE_NOT_READY
Definition: resource.h:37
#define IDS_MODE_OPEN
Definition: resource.h:31
TCHAR szCurrentFile[MAX_PATH]
Definition: mplay32.c:29
#define IDS_MODE_PLAY
Definition: resource.h:33
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define IDS_MODE_STOP
Definition: resource.h:32
#define IDS_MODE_SEEK
Definition: resource.h:36
static const WCHAR szStatus[]
Definition: http.c:74
#define StringCbPrintf
Definition: strsafe.h:544
#define MAX_PATH
Definition: compat.h:34
TCHAR szAppTitle[256]
Definition: mplay32.c:27
static DWORD GetDeviceMode(HWND hwnd)
Definition: mplay32.c:635
#define IDS_MODE_UNKNOWN
Definition: resource.h:30
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
#define MCI_MODE_SEEK
Definition: mmsystem.h:698
#define SetWindowText
Definition: winuser.h:5832
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
#define MCI_MODE_OPEN
Definition: mmsystem.h:700
#define LoadString
Definition: winuser.h:5794
#define IDS_MODE_PAUSE
Definition: resource.h:34
#define IDS_MODE_RECORD
Definition: resource.h:35

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 IDC_SEEKBACK
Definition: resource.h:72
#define IDC_BACKWARD
Definition: resource.h:71
#define IDC_SEEKFORW
Definition: resource.h:73
#define TBICON_PLAY
Definition: resource.h:59
#define BTNS_BUTTON
Definition: commctrl.h:994
#define TBICON_EJECT
Definition: resource.h:61
#define IDC_STOP
Definition: resource.h:69
#define TBICON_FORWARD
Definition: resource.h:65
#define BTNS_SEP
Definition: commctrl.h:995
#define IDC_EJECT
Definition: resource.h:70
#define TBICON_SEEKFORW
Definition: resource.h:64
#define IDC_FORWARD
Definition: resource.h:74
#define TBICON_BACKWARD
Definition: resource.h:62
#define IDC_PLAY
Definition: resource.h:68
#define TBICON_SEEKBACK
Definition: resource.h:63
#define TBICON_STOP
Definition: resource.h:60
#define TBSTATE_ENABLED
Definition: commctrl.h:970

Definition at line 41 of file mplay32.c.

Referenced by CMainToolbar::Create(), HEXEDIT_WM_LBUTTONDOWN(), InitControls(), 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 DebuggerShell(), LoadSymbolsFromConfig(), OpenMciDevice(), and UpdateWindowCaption().

◆ szDefaultFilter

TCHAR szDefaultFilter[MAX_PATH] = _T("")

Definition at line 28 of file mplay32.c.

Referenced by BuildFileFilterAndDeviceMenu(), and CleanupFileFilter().

◆ szFilter

◆ wDeviceId