ReactOS  0.4.11-dev-946-g431643b
mplay32.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Multimedia Player
3  * FILE: base/applications/mplay32/mplay32.c
4  * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
5  */
6 
7 #include "mplay32.h"
8 
9 #define IDT_PLAYTIMER 1000
10 
11 #define MAIN_WINDOW_HEIGHT 125
12 #define MAIN_WINDOW_MIN_WIDTH 250
13 #define MAX_MCISTR 256
14 
20 
21 TCHAR szAppTitle[256] = _T("");
25 
31 
33 
34 /* ToolBar Buttons */
35 static const TBBUTTON Buttons[] =
36 { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
40  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
45 // {TBICON_PAUSE, IDC_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}
46 };
47 
49 {
50  MCIERROR mciError;
51  MCI_GENERIC_PARMS mciGeneric;
52  MCI_DGV_RECT_PARMS mciVideoRect;
53  MCI_DGV_WINDOW_PARMSW mciVideoWindow;
54 
56 
57  mciError = mciSendCommand(wDeviceId, MCI_CONFIGURE, MCI_TEST, (DWORD_PTR)&mciGeneric);
58  if (mciError == 0)
59  {
61  }
62 
63  mciVideoWindow.hWnd = hwnd;
64 
65  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD_PTR)&mciVideoWindow);
66  if (!mciError)
67  {
69  if (!mciError)
70  {
72  }
73  }
74 }
75 
76 void DisableMenuItems(void)
77 {
81 }
82 
83 void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
84 {
85  RECT rcClientRect;
86  RECT rcWindowRect;
87  POINT ptDifference;
88 
89  GetClientRect(hwnd, &rcClientRect);
90  GetWindowRect(hwnd, &rcWindowRect);
91  ptDifference.x = (rcWindowRect.right - rcWindowRect.left) - rcClientRect.right;
92  ptDifference.y = (rcWindowRect.bottom - rcWindowRect.top) - rcClientRect.bottom;
93  MoveWindow(hwnd, rcWindowRect.left, rcWindowRect.top, nWidth + ptDifference.x, nHeight + ptDifference.y, TRUE);
94 }
95 
97 {
98  TCHAR szNewTitle[MAX_PATH + 3 + 256];
99  TCHAR szStatus[128];
100 
101  if (wDeviceId == 0)
102  {
103  SetWindowText(hwnd, szAppTitle);
104  return;
105  }
106 
107  switch (GetDeviceMode(hwnd))
108  {
109  case MCI_MODE_PAUSE:
110  {
111  LoadString(hInstance, IDS_MODE_PAUSE, szStatus, ARRAYSIZE(szStatus));
112  break;
113  }
114 
115  case MCI_MODE_STOP:
116  {
117  LoadString(hInstance, IDS_MODE_STOP, szStatus, ARRAYSIZE(szStatus));
118  break;
119  }
120 
121  case MCI_MODE_PLAY:
122  {
123  LoadString(hInstance, IDS_MODE_PLAY, szStatus, ARRAYSIZE(szStatus));
124  break;
125  }
126 
127  case MCI_MODE_OPEN:
128  {
129  LoadString(hInstance, IDS_MODE_OPEN, szStatus, ARRAYSIZE(szStatus));
130  break;
131  }
132 
133  case MCI_MODE_RECORD:
134  {
135  LoadString(hInstance, IDS_MODE_RECORD, szStatus, ARRAYSIZE(szStatus));
136  break;
137  }
138 
139  case MCI_MODE_SEEK:
140  {
141  LoadString(hInstance, IDS_MODE_SEEK, szStatus, ARRAYSIZE(szStatus));
142  break;
143  }
144 
145  case MCI_MODE_NOT_READY:
146  {
147  LoadString(hInstance, IDS_MODE_NOT_READY, szStatus, ARRAYSIZE(szStatus));
148  break;
149  }
150 
151  default:
152  {
153  LoadString(hInstance, IDS_MODE_UNKNOWN, szStatus, ARRAYSIZE(szStatus));
154  }
155  }
156 
157  StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s (%s)"), szAppTitle, szCurrentFile, szStatus);
158  SetWindowText(hwnd, szNewTitle);
159 }
160 
162 {
163  MCI_STATUS_PARMS mciStatus;
165  DWORD dwTimeFormat;
166 
167  if (!wDeviceId)
168  {
169  SetWindowText(hwnd, _T(""));
170  return;
171  }
172 
173  mciStatus.dwItem = MCI_STATUS_TIME_FORMAT;
174  mciStatus.dwReturn = 0;
176  dwTimeFormat = mciStatus.dwReturn;
177 
178  mciStatus.dwItem = MCI_STATUS_POSITION;
179  mciStatus.dwReturn = 0;
181 
182  switch(dwTimeFormat)
183  {
185  {
186  int s, m, h;
187 
188  s = (mciStatus.dwReturn / 1000) % 60;
189  m = ((mciStatus.dwReturn / (1000*60)) % 60);
190  h = ((mciStatus.dwReturn / (1000*60*60)) % 24);
191  StringCbPrintf(szTime, sizeof(szTime), _T("%02lu:%02lu:%02lu"), h, m, s);
192  break;
193  }
194 
195  /* The time format is unknown, so use the returned position as is */
196  default:
197  {
198  StringCbPrintf(szTime, sizeof(szTime), _T("%lu"), mciStatus.dwReturn);
199  break;
200  }
201  }
202 
203  SetWindowText(hwnd, szTime);
204 }
205 
206 static VOID
208 {
209  LPTSTR lpMessageBuffer;
210  DWORD dwError = GetLastError();
211 
212  if (dwError == ERROR_SUCCESS)
213  return;
214 
218  NULL,
219  dwError,
221  (LPTSTR)&lpMessageBuffer,
222  0, NULL))
223  {
224  return;
225  }
226 
227  MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR);
228  LocalFree(lpMessageBuffer);
229 }
230 
231 static VOID
233 {
234  HIMAGELIST hImageList;
235 
236  hImageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 1, 1);
237  if (!hImageList)
238  {
239  ShowLastWin32Error(hwnd);
240  return;
241  }
242 
243  ImageList_AddMasked(hImageList,
245  RGB(255, 255, 255));
246 
247  ImageList_AddMasked(hImageList,
249  RGB(255, 255, 255));
250 
251  ImageList_AddMasked(hImageList,
253  RGB(255, 255, 255));
254 
255  ImageList_AddMasked(hImageList,
257  RGB(255, 255, 255));
258 
259  ImageList_AddMasked(hImageList,
261  RGB(255, 255, 255));
262 
263  ImageList_AddMasked(hImageList,
265  RGB(255, 255, 255));
266 
267  ImageList_AddMasked(hImageList,
269  RGB(255, 255, 255));
270 
271  ImageList_AddMasked(hImageList,
273  RGB(255, 255, 255));
274 
277  0,
278  (LPARAM)hImageList));
279 }
280 
281 static VOID
283 {
284  TCHAR szErrorMessage[MAX_MCISTR];
285  TCHAR szTempMessage[MAX_MCISTR + 44];
286 
287  if (mciGetErrorString(mciError, szErrorMessage, ARRAYSIZE(szErrorMessage)) == FALSE)
288  {
289  LoadString(hInstance, IDS_DEFAULTMCIERRMSG, szErrorMessage, ARRAYSIZE(szErrorMessage));
290  }
291 
292  StringCbPrintf(szTempMessage, sizeof(szTempMessage), _T("MMSYS%lu: %s"), mciError, szErrorMessage);
293  MessageBox(hwnd, szTempMessage, szAppTitle, MB_OK | MB_ICONEXCLAMATION);
294 }
295 
296 static VOID
298 {
299  INT NumButtons = ARRAYSIZE(Buttons);
300 
302 
303  /* Create trackbar */
304  hTrackBar = CreateWindowEx(0,
306  NULL,
308  0,
309  0,
310  340,
311  20,
312  hwnd,
313  NULL,
314  hInstance,
315  NULL);
316  if (!hTrackBar)
317  {
318  ShowLastWin32Error(hwnd);
319  return;
320  }
321 
322  /* Create toolbar */
323  hToolBar = CreateWindowEx(0,
325  NULL,
328  0,
329  40,
330  340,
331  30,
332  hwnd,
333  NULL,
334  hInstance,
335  NULL);
336  if (!hToolBar)
337  {
338  ShowLastWin32Error(hwnd);
339  return;
340  }
341 
342  hTimeDisplay = CreateWindowEx(0,
343  L"STATIC",
344  NULL,
346  195,
347  4,
348  135,
349  18,
350  hToolBar,
351  NULL,
352  hInstance,
353  NULL);
354  if (!hTimeDisplay)
355  {
356  ShowLastWin32Error(hwnd);
357  return;
358  }
359 
360  SetImageList(hwnd);
361  SendMessage(hToolBar, TB_ADDBUTTONS, NumButtons, (LPARAM)Buttons);
362 }
363 
364 static VOID
366 {
367  MCIERROR mciError;
368  MCI_DGV_RECT_PARMS mciVideoRect;
369  MCI_DGV_WINDOW_PARMSW mciVideoWindow;
370  RECT rcToolbarRect;
371  RECT rcTempRect;
372 
373  mciVideoWindow.hWnd = hwnd;
374 
375  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND | MCI_TEST, (DWORD_PTR)&mciVideoWindow);
376  if (mciError != 0)
377  return;
378 
380  if (mciError != 0)
381  return;
382 
383  if (!bIsSingleWindow)
384  {
385  GetWindowRect(hwnd, &PrevWindowPos);
386 
387  SetParent(hTrackBar, hToolBar);
388 
389  mciError = mciSendCommand(wDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE, (DWORD_PTR)&mciVideoRect);
390  if (mciError != 0)
391  {
392  ShowMCIError(hwnd, mciError);
393  return;
394  }
395 
396  GetWindowRect(hToolBar, &rcToolbarRect);
397  ResizeClientArea(hwnd, mciVideoRect.rc.right, mciVideoRect.rc.bottom + (rcToolbarRect.bottom - rcToolbarRect.top));
398 
399  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&mciVideoWindow);
400  if (mciError != 0)
401  {
402  ShowMCIError(hwnd, mciError);
403  return;
404  }
405 
406  GetWindowRect(hToolBar, &rcTempRect);
407  MoveWindow(hTrackBar, 180, 0, rcTempRect.right - rcTempRect.left - 322, 25, TRUE);
408  MoveWindow(hTimeDisplay, rcTempRect.right - rcTempRect.left - 140, 4, 135, 18, TRUE);
409 
412  }
413  else
414  {
417 
418  mciVideoWindow.hWnd = MCI_DGV_WINDOW_DEFAULT;
419  mciError = mciSendCommand(wDeviceId, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&mciVideoWindow);
420  if (mciError != 0)
421  {
422  ShowMCIError(hwnd, mciError);
423  return;
424  }
425 
426  SetParent(hTrackBar, hwnd);
427 
428  MoveWindow(hwnd, PrevWindowPos.left, PrevWindowPos.top, PrevWindowPos.right - PrevWindowPos.left, PrevWindowPos.bottom - PrevWindowPos.top, TRUE);
429  }
430 }
431 
432 static DWORD
434 {
435  MCI_SYSINFO_PARMS mciSysInfo;
436  DWORD dwNumDevices = 0;
437 
438  mciSysInfo.dwCallback = 0;
439  mciSysInfo.lpstrReturn = (LPTSTR)&dwNumDevices;
440  mciSysInfo.dwRetSize = sizeof(dwNumDevices);
441  mciSysInfo.dwNumber = 0;
442  mciSysInfo.wDeviceType = MCI_ALL_DEVICE_ID;
443 
445 
446  return *(DWORD*)mciSysInfo.lpstrReturn;
447 }
448 
449 static DWORD
450 GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
451 {
452  MCI_SYSINFO_PARMS mciSysInfo;
453 
454  mciSysInfo.dwCallback = 0;
455  mciSysInfo.lpstrReturn = lpDeviceName;
456  mciSysInfo.dwRetSize = dwDeviceNameSize;
457  mciSysInfo.dwNumber = dwDeviceIndex;
459 
461 }
462 
463 static DWORD
464 GetDeviceFriendlyName(LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
465 {
466  MCIERROR mciError;
467  MCI_OPEN_PARMS mciOpen;
468  MCI_INFO_PARMS mciInfo;
469  MCI_GENERIC_PARMS mciGeneric;
470 
471  mciOpen.dwCallback = 0;
472  mciOpen.wDeviceID = 0;
473  mciOpen.lpstrDeviceType = lpDeviceName;
474  mciOpen.lpstrElementName = NULL;
475  mciOpen.lpstrAlias = NULL;
476 
477  mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_WAIT, (DWORD_PTR)&mciOpen);
478  if (mciError != 0)
479  return mciError;
480 
481  mciInfo.dwCallback = 0;
482  mciInfo.lpstrReturn = lpFriendlyName;
483  mciInfo.dwRetSize = dwFriendlyNameSize;
484 
485  mciError = mciSendCommand(mciOpen.wDeviceID, MCI_INFO, MCI_INFO_PRODUCT, (DWORD_PTR)&mciInfo);
486 
487  mciGeneric.dwCallback = 0;
488  mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
489 
490  return mciError;
491 }
492 
493 static BOOL
494 DeviceUsesFiles(LPTSTR lpDeviceName)
495 {
496  MCIERROR mciError;
497  MCI_OPEN_PARMS mciOpen;
498  MCI_GETDEVCAPS_PARMS mciDevCaps;
499  MCI_GENERIC_PARMS mciGeneric;
500 
501  mciOpen.dwCallback = 0;
502  mciOpen.wDeviceID = 0;
503  mciOpen.lpstrDeviceType = lpDeviceName;
504  mciOpen.lpstrElementName = NULL;
505  mciOpen.lpstrAlias = NULL;
506 
507  mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_WAIT, (DWORD_PTR)&mciOpen);
508  if (mciError != 0)
509  return FALSE;
510 
511  mciDevCaps.dwCallback = 0;
512  mciDevCaps.dwReturn = 0;
513  mciDevCaps.dwItem = MCI_GETDEVCAPS_USES_FILES;
514 
515  mciError = mciSendCommand(mciOpen.wDeviceID, MCI_GETDEVCAPS, MCI_WAIT | MCI_GETDEVCAPS_ITEM, (DWORD_PTR)&mciDevCaps);
516  if (mciError != 0)
517  return FALSE;
518 
519  mciGeneric.dwCallback = 0;
520  mciSendCommand(mciOpen.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
521 
522  return (BOOL)mciDevCaps.dwReturn;
523 }
524 
525 static MCIERROR
527 {
528  MCIERROR mciError;
529  MCI_GENERIC_PARMS mciGeneric;
530 
531  if (wDeviceId)
532  {
533  mciError = mciSendCommand(wDeviceId, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
534  if (mciError != 0) return mciError;
535  wDeviceId = 0;
536  }
537 
538  UpdateTimeDisplay(hTimeDisplay);
539 
541 
542  return 0;
543 }
544 
545 static MCIERROR
547 {
548  MCIERROR mciError;
549  MCI_STATUS_PARMS mciStatus;
550  MCI_OPEN_PARMS mciOpen;
552  LPTSTR lpStr;
553 
554  if (wDeviceId)
555  CloseMciDevice();
556 
557  mciOpen.lpstrDeviceType = lpType;
558  mciOpen.lpstrElementName = lpFileName;
559  mciOpen.dwCallback = 0;
560  mciOpen.wDeviceID = 0;
561  mciOpen.lpstrAlias = NULL;
562 
563  if (lpType)
564  dwFlags |= MCI_OPEN_TYPE;
565 
566  if (lpFileName)
567  dwFlags |= MCI_OPEN_ELEMENT;
568 
569  mciError = mciSendCommand(0, MCI_OPEN, dwFlags, (DWORD_PTR)&mciOpen);
570  if (mciError != 0)
571  return mciError;
572 
573  mciStatus.dwItem = MCI_STATUS_LENGTH;
574 
575  mciError = mciSendCommand(mciOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR)&mciStatus);
576  if (mciError != 0)
577  return mciError;
578 
579  SendMessage(hTrackBar, TBM_SETRANGEMIN, (WPARAM)TRUE, (LPARAM)1);
580  SendMessage(hTrackBar, TBM_SETRANGEMAX, (WPARAM)TRUE, (LPARAM)mciStatus.dwReturn);
581  SendMessage(hTrackBar, TBM_SETPAGESIZE, 0, 10);
582  SendMessage(hTrackBar, TBM_SETLINESIZE, 0, 1);
583  SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)1);
584 
585  if (mciStatus.dwReturn < 10000)
586  {
587  SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM)100, (LPARAM)0);
588  }
589  else if (mciStatus.dwReturn < 100000)
590  {
591  SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM)1000, (LPARAM)0);
592  }
593  else if (mciStatus.dwReturn < 1000000)
594  {
595  SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM)10000, (LPARAM)0);
596  }
597  else
598  {
599  SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM)100000, (LPARAM)0);
600  }
601 
602  MaxFilePos = mciStatus.dwReturn;
603  wDeviceId = mciOpen.wDeviceID;
604 
605  /* NOTE: Everything above this line may be done instead in OpenMediaFile() */
606 
607  if (lpFileName)
608  {
609  lpStr = _tcsrchr(lpFileName, _T('\\'));
610  if (lpStr) // Get only the file name (skip the last path separator)
611  lpStr++;
612  else
613  lpStr = lpFileName;
614  }
615  else
616  lpStr = lpType;
617 
618  StringCbCopy(szCurrentFile, sizeof(szCurrentFile), lpStr);
619 
620  EnableMenuItems(hwnd);
621 
622  UpdateTimeDisplay(hTimeDisplay);
623  UpdateWindowCaption(hwnd);
624 
625  return 0;
626 }
627 
628 static DWORD
630 {
631  MCIERROR mciError;
632  MCI_STATUS_PARMS mciStatus;
633 
634  mciStatus.dwItem = MCI_STATUS_MODE;
636  if (mciError != 0)
637  {
638  ShowMCIError(hwnd, mciError);
639  return MCI_MODE_NOT_READY;
640  }
641 
642  return mciStatus.dwReturn;
643 }
644 
645 static VOID
647 {
648  MCIERROR mciError;
649  MCI_GENERIC_PARMS mciGeneric;
650  MCI_SEEK_PARMS mciSeek;
651 
652  if (wDeviceId == 0) return;
653 
654  KillTimer(hwnd, IDT_PLAYTIMER);
655  SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)1);
656 
657  mciGeneric.dwCallback = (DWORD_PTR)hwnd;
658  mciError = mciSendCommand(wDeviceId, MCI_STOP, MCI_WAIT, (DWORD_PTR)&mciGeneric);
659  if (mciError != 0)
660  {
661  ShowMCIError(hwnd, mciError);
662  return;
663  }
664 
666 
667  UpdateTimeDisplay(hTimeDisplay);
668  UpdateWindowCaption(hwnd);
669 
670  SendMessage(hToolBar,
671  TB_SETCMDID,
672  0,
673  IDC_PLAY);
674  SendMessage(hToolBar,
676  IDC_PLAY,
678 }
679 
680 static VOID
682 {
683  MCIERROR mciError;
684  MCI_SEEK_PARMS mciSeek;
685  MCI_PLAY_PARMS mciPlay;
686 
687  if (wDeviceId == 0) return;
688 
689  mciSeek.dwTo = (DWORD_PTR)dwNewPos;
690  mciError = mciSendCommand(wDeviceId, MCI_SEEK, MCI_WAIT | MCI_TO, (DWORD_PTR)&mciSeek);
691  if (mciError != 0)
692  {
693  ShowMCIError(hwnd, mciError);
694  }
695 
696  mciPlay.dwCallback = (DWORD_PTR)hwnd;
697  mciError = mciSendCommand(wDeviceId, MCI_PLAY, MCI_NOTIFY, (DWORD_PTR)&mciPlay);
698  if (mciError != 0)
699  {
700  ShowMCIError(hwnd, mciError);
701  }
702 }
703 
704 static VOID
706 {
707  MCI_STATUS_PARMS mciStatus;
708  DWORD dwNewPos;
709 
710  if (wDeviceId == 0) return;
711 
712  mciStatus.dwItem = MCI_STATUS_POSITION;
714 
715  dwNewPos = mciStatus.dwReturn - 1;
716 
717  if ((UINT)dwNewPos <= 1)
718  {
719  StopPlayback(hwnd);
720  }
721  else
722  {
723  SeekPlayback(hwnd, dwNewPos);
724  }
725 }
726 
727 static VOID
729 {
730  MCI_STATUS_PARMS mciStatus;
731  DWORD dwNewPos;
732 
733  if (wDeviceId == 0) return;
734 
735  mciStatus.dwItem = MCI_STATUS_POSITION;
737 
738  dwNewPos = mciStatus.dwReturn + 1;
739 
740  if ((UINT)dwNewPos >= MaxFilePos)
741  {
742  StopPlayback(hwnd);
743  }
744  else
745  {
746  SeekPlayback(hwnd, dwNewPos);
747  }
748 }
749 
752 {
753  MCI_STATUS_PARMS mciStatus;
754  DWORD dwPos;
755 
756  if (wDeviceId == 0) KillTimer(hwnd, IDT_PLAYTIMER);
757 
758  mciStatus.dwItem = MCI_STATUS_POSITION;
760  dwPos = mciStatus.dwReturn;
761 
762  SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwPos);
763  UpdateTimeDisplay(hTimeDisplay);
764 }
765 
766 static VOID
768 {
769  MCIERROR mciError;
770  MCI_PLAY_PARMS mciPlay;
771  MCI_SEEK_PARMS mciSeek;
772 
774 
776 
777  mciPlay.dwCallback = (DWORD_PTR)hwnd;
778  mciPlay.dwFrom = 0;
779  mciPlay.dwTo = MaxFilePos;
780 
781  mciError = mciSendCommand(wDeviceId, MCI_PLAY, MCI_NOTIFY | MCI_FROM /*| MCI_TO*/, (DWORD_PTR)&mciPlay);
782  if (mciError != 0)
783  {
784  ShowMCIError(hwnd, mciError);
785  return;
786  }
787 
788  UpdateWindowCaption(hwnd);
789 
790  SendMessage(hToolBar,
791  TB_SETCMDID,
792  0,
793  IDC_PAUSE);
794  SendMessage(hToolBar,
796  IDC_PAUSE,
798 }
799 
800 static VOID
802 {
803  MCIERROR mciError;
804  MCI_GENERIC_PARMS mciGeneric;
805  ULONG idBmp = IDB_PLAYICON;
806  ULONG idCmd = IDC_PLAY;
807 
808  if (wDeviceId == 0) return;
809 
810  switch (GetDeviceMode(hwnd))
811  {
812  case MCI_MODE_OPEN:
813  case MCI_MODE_STOP:
814  {
815  StartPlayback(hwnd);
816  return;
817  }
818 
819  case MCI_MODE_PLAY:
820  {
821  mciGeneric.dwCallback = (DWORD_PTR)hwnd;
822  mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
823  idBmp = IDB_PLAYICON;
824  idCmd = IDC_PLAY;
825  break;
826  }
827 
828  case MCI_MODE_PAUSE:
829  {
830  mciGeneric.dwCallback = (DWORD_PTR)hwnd;
831  mciError = mciSendCommand(wDeviceId, MCI_RESUME, MCI_WAIT, (DWORD_PTR)&mciGeneric);
832  idBmp = IDB_PAUSEICON;
833  idCmd = IDC_PAUSE;
834  break;
835  }
836 
837  default:
838  {
839  return;
840  }
841  }
842 
843  if (mciError != 0)
844  {
845  ShowMCIError(hwnd, mciError);
846  return;
847  }
848 
849  UpdateWindowCaption(hwnd);
850 
851  SendMessage(hToolBar,
852  TB_SETCMDID,
853  0,
854  idCmd);
855  SendMessage(hToolBar,
857  idCmd,
858  idBmp - IDB_PLAYICON);
859 }
860 
861 static VOID
863 {
864  MCIERROR mciError;
865  MCI_GENERIC_PARMS mciGeneric;
866 
867  mciError = mciSendCommand(wDeviceId, MCI_CONFIGURE, MCI_WAIT, (DWORD_PTR)&mciGeneric);
868  if (mciError != 0)
869  {
870  ShowMCIError(hwnd, mciError);
871  }
872 }
873 
874 static VOID
876 {
877  StopPlayback(hwnd);
878 
879  if (bIsSingleWindow)
880  SwitchViewMode(hwnd);
881 
882  CloseMciDevice();
883  UpdateWindowCaption(hwnd);
884 }
885 
886 static VOID
888 {
889  MCIERROR mciError;
890 
891  if (GetFileAttributes(lpFileName) == INVALID_FILE_ATTRIBUTES)
892  return;
893 
894  if (wDeviceId)
895  CloseMediaFile(hwnd);
896 
897  mciError = OpenMciDevice(hwnd, lpType, lpFileName);
898  if (mciError != 0)
899  {
900  ShowMCIError(hwnd, mciError);
901  return;
902  }
903 
904  StartPlayback(hwnd);
905 }
906 
907 static DWORD
908 InsertDeviceMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD dwDeviceIndex)
909 {
910  MENUITEMINFO lpmii;
911  MCIERROR mciError;
913  TCHAR szFriendlyName[MAX_MCISTR];
914 
915  mciError = GetDeviceName(dwDeviceIndex, szDeviceName, sizeof(szDeviceName));
916  if (mciError)
917  {
918  return mciError;
919  }
920 
921  mciError = GetDeviceFriendlyName(szDeviceName, szFriendlyName, sizeof(szFriendlyName));
922  if (mciError)
923  {
924  return mciError;
925  }
926 
927  if (DeviceUsesFiles(szDeviceName))
928  {
929  StringCbCat(szFriendlyName, sizeof(szFriendlyName), _T("..."));
930  }
931 
932  ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
933  lpmii.cbSize = sizeof(lpmii);
934  lpmii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID;
935  lpmii.wID = uItemID;
936  lpmii.fType = MF_STRING;
937  lpmii.dwTypeData = szFriendlyName;
938  lpmii.dwItemData = dwDeviceIndex;
939  InsertMenuItem(hMenu, uItem, fByPosition, &lpmii);
940 
941  return 0;
942 }
943 
944 static VOID
946 {
948  TCHAR szFriendlyName[MAX_MCISTR];
949  TCHAR *szDevice = NULL;
950  static TCHAR szDefaultExtension[] = _T("*.*");
951  TCHAR *szExtensionList = NULL;
952  TCHAR *szExtension = NULL;
953  TCHAR *c = NULL;
954  TCHAR *d = NULL;
955  DWORD dwNumValues;
956  DWORD dwNumDevices;
957  DWORD dwValueNameLen;
958  DWORD dwValueDataSize;
959  DWORD dwMaskLen;
960  DWORD dwFilterSize;
961  DWORD dwDeviceSize;
962  DWORD dwExtensionLen;
963  DWORD dwPosition = 0;
964  DWORD i;
965  DWORD j;
966  size_t uSizeRemain;
967  size_t uMaskRemain;
968  HKEY hKey = NULL;
969 
970  /* Always load the default (all files) filter */
972 
973  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\MCI Extensions"), 0, KEY_READ, &hKey) != ERROR_SUCCESS)
974  {
975  goto Failure;
976  }
977 
978  if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwNumValues, &dwValueNameLen, &dwValueDataSize, NULL, NULL) != ERROR_SUCCESS)
979  {
980  goto Failure;
981  }
982 
983  dwMaskLen = ((dwValueNameLen + 3) * dwNumValues) + 1;
984 
985  szExtensionList = malloc(dwMaskLen * sizeof(TCHAR));
986  if (!szExtensionList)
987  goto Failure;
988 
989  dwNumDevices = GetNumDevices();
990 
991  /* Allocate space for every pair of Device and Extension Filter */
992  dwFilterSize = (MAX_MCISTR + (dwMaskLen * 2) + 5) * dwNumDevices;
993 
994  /* Add space for the "All supported" entry */
995  dwFilterSize = (dwFilterSize + (dwMaskLen * 2) + 7) * sizeof(TCHAR) + sizeof(szDefaultFilter);
996 
997  szFilter = malloc(dwFilterSize);
998  if (!szFilter)
999  goto Failure;
1000 
1001  szExtension = malloc((dwValueNameLen + 1) * sizeof(TCHAR));
1002  if (!szExtension)
1003  goto Failure;
1004 
1005  szDevice = malloc(dwValueDataSize + sizeof(TCHAR));
1006  if (!szDevice)
1007  goto Failure;
1008 
1009  ZeroMemory(szFilter, dwFilterSize);
1010 
1011  uSizeRemain = dwFilterSize;
1012  c = szFilter;
1013 
1014  for (j = 1; j <= dwNumDevices; j++)
1015  {
1016  if (GetDeviceName(j, szDeviceName, sizeof(szDeviceName)))
1017  {
1018  continue;
1019  }
1020 
1021  if (GetDeviceFriendlyName(szDeviceName, szFriendlyName, sizeof(szFriendlyName)))
1022  {
1023  continue;
1024  }
1025 
1026  /* Insert a menu item under the "Device" menu for every found MCI device */
1027  InsertDeviceMenuItem(GetSubMenu(hMainMenu, 3), dwPosition, TRUE, IDM_DEVICE_FIRST + dwPosition, j);
1028  dwPosition++;
1029 
1030  /* Copy the default extension list, that may be overwritten after... */
1031  StringCbCopy(szExtensionList, dwMaskLen * sizeof(TCHAR), szDefaultExtension);
1032 
1033  /* Try to determine the real extension list */
1034  uMaskRemain = dwMaskLen * sizeof(TCHAR);
1035  d = szExtensionList;
1036 
1037  for (i = 0; i < dwNumValues; i++)
1038  {
1039  dwExtensionLen = dwValueNameLen + 1;
1040  dwDeviceSize = dwValueDataSize + sizeof(TCHAR);
1041 
1042  ZeroMemory(szDevice, dwDeviceSize);
1043 
1044  if (RegEnumValue(hKey, i, szExtension, &dwExtensionLen, NULL, NULL, (LPBYTE)szDevice, &dwDeviceSize) == ERROR_SUCCESS)
1045  {
1046  CharLowerBuff(szDevice, dwDeviceSize / sizeof(TCHAR));
1047  CharLowerBuff(szDeviceName, ARRAYSIZE(szDeviceName));
1048  if (_tcscmp(szDeviceName, szDevice) == 0)
1049  {
1050  CharLowerBuff(szExtension, dwExtensionLen);
1051  StringCbPrintfEx(d, uMaskRemain, &d, &uMaskRemain, 0, _T("%s%s%s"), _T("*."), szExtension, _T(";"));
1052  }
1053  }
1054  }
1055 
1056  /* Remove the last separator */
1057  d--;
1058  uSizeRemain += sizeof(*d);
1059  *d = _T('\0');
1060 
1061  /* Add the description */
1062  StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szFriendlyName, szExtensionList);
1063 
1064  /* Skip one char to separate the description from the filter mask */
1065  c++;
1066  uSizeRemain -= sizeof(*c);
1067 
1068  /* Append the filter mask */
1069  StringCbCopyEx(c, uSizeRemain, szExtensionList, &c, &uSizeRemain, 0);
1070 
1071  /* Skip another char to separate the elements of the filter mask */
1072  c++;
1073  uSizeRemain -= sizeof(*c);
1074  }
1075 
1076  /* Build the full list of supported extensions */
1077  uMaskRemain = dwMaskLen * sizeof(TCHAR);
1078  d = szExtensionList;
1079 
1080  for (i = 0; i < dwNumValues; i++)
1081  {
1082  dwExtensionLen = dwValueNameLen + 1;
1083 
1084  if (RegEnumValue(hKey, i, szExtension, &dwExtensionLen, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
1085  {
1086  CharLowerBuff(szExtension, dwExtensionLen);
1087  StringCbPrintfEx(d, uMaskRemain, &d, &uMaskRemain, 0, _T("%s%s%s"), _T("*."), szExtension, _T(";"));
1088  }
1089  }
1090 
1091  /* Remove the last separator */
1092  d--;
1093  uSizeRemain += sizeof(*d);
1094  *d = _T('\0');
1095 
1096  /* Add the default (all files) description */
1097  StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szDefaultFilter, szExtensionList);
1098 
1099  /* Skip one char to separate the description from the filter mask */
1100  c++;
1101  uSizeRemain -= sizeof(*c);
1102 
1103  /* Append the filter mask */
1104  StringCbCopyEx(c, uSizeRemain, szExtensionList, &c, &uSizeRemain, 0);
1105 
1106 Cleanup:
1107  if (szExtensionList) free(szExtensionList);
1108  if (szExtension) free(szExtension);
1109  if (szDevice) free(szDevice);
1110  RegCloseKey(hKey);
1111 
1112  return;
1113 
1114 Failure:
1115  /* We failed at retrieving the supported files, so use the default filter */
1116  if (szFilter) free(szFilter);
1118 
1119  uSizeRemain = sizeof(szDefaultFilter);
1120  c = szFilter;
1121 
1122  /* Add the default (all files) description */
1123  StringCbPrintfEx(c, uSizeRemain, &c, &uSizeRemain, 0, _T("%s (%s)"), szDefaultFilter, szDefaultExtension);
1124 
1125  /* Skip one char to separate the description from the filter mask */
1126  c++;
1127  uSizeRemain -= sizeof(*c);
1128 
1129  /* Append the filter mask */
1130  StringCbCopyEx(c, uSizeRemain, szDefaultExtension, &c, &uSizeRemain, 0);
1131 
1132  goto Cleanup;
1133 }
1134 
1135 static VOID
1137 {
1139 }
1140 
1141 static VOID
1142 OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
1143 {
1144  OPENFILENAME OpenFileName;
1145  TCHAR szFile[MAX_PATH + 1] = _T("");
1146  TCHAR szCurrentDir[MAX_PATH];
1147 
1148  ZeroMemory(&OpenFileName, sizeof(OpenFileName));
1149 
1150  if (!GetCurrentDirectory(ARRAYSIZE(szCurrentDir), szCurrentDir))
1151  {
1152  StringCbCopy(szCurrentDir, sizeof(szCurrentDir), _T("c:\\"));
1153  }
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);
1161  OpenFileName.lpstrInitialDir = szCurrentDir;
1163  OpenFileName.lpstrDefExt = _T("\0");
1164  OpenFileName.nFilterIndex = dwFilterIndex;
1165 
1166  if (!GetOpenFileName(&OpenFileName))
1167  return;
1168 
1169  OpenMediaFile(hwnd, OpenFileName.lpstrFile, lpType);
1170 }
1171 
1172 static VOID
1174 {
1175  MENUITEMINFO lpmii;
1177  MCIERROR mciError;
1178 
1179  ZeroMemory(&lpmii, sizeof(MENUITEMINFO));
1180  lpmii.cbSize = sizeof(lpmii);
1181  lpmii.fMask = MIIM_DATA;
1182  GetMenuItemInfo(hMainMenu, uItem, FALSE, &lpmii);
1183 
1184  mciError = GetDeviceName(lpmii.dwItemData, szDeviceName, sizeof(szDeviceName));
1185  if (mciError)
1186  {
1187  ShowMCIError(hwnd, mciError);
1188  return;
1189  }
1190 
1191  if (DeviceUsesFiles(szDeviceName))
1192  {
1193  OpenFileDialog(hwnd, uItem - IDM_DEVICE_FIRST + 1, szDeviceName);
1194  return;
1195  }
1196 
1197  mciError = OpenMciDevice(hwnd, szDeviceName, NULL);
1198  if (mciError)
1199  {
1200  ShowMCIError(hwnd, mciError);
1201  }
1202 
1203  return;
1204 }
1205 
1208 {
1209  switch (Message)
1210  {
1211  case WM_CREATE:
1212  {
1213  InitControls(hwnd);
1214  hMainMenu = GetMenu(hwnd);
1215  break;
1216  }
1217 
1218  case WM_DROPFILES:
1219  {
1220  HDROP drophandle;
1221  TCHAR droppedfile[MAX_PATH];
1222 
1223  drophandle = (HDROP)wParam;
1224  DragQueryFile(drophandle, 0, droppedfile, ARRAYSIZE(droppedfile));
1225  DragFinish(drophandle);
1226  OpenMediaFile(hwnd, droppedfile, NULL);
1227  break;
1228  }
1229 
1230  case MM_MCINOTIFY:
1231  {
1232  if (wParam == MCI_NOTIFY_SUCCESSFUL)
1233  {
1234  StopPlayback(hwnd);
1235  if (bRepeat)
1236  {
1237  StartPlayback(hwnd);
1238  }
1239  }
1240  break;
1241  }
1242 
1243  case WM_NOTIFY:
1244  {
1245  LPNMHDR pnmhdr = (LPNMHDR)lParam;
1246 
1247  switch (pnmhdr->code)
1248  {
1249  case TTN_GETDISPINFO:
1250  {
1251  LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)lParam;
1252  UINT idButton = (UINT)lpttt->hdr.idFrom;
1253 
1254  switch (idButton)
1255  {
1256  case IDC_PLAY:
1257  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PLAY);
1258  break;
1259  case IDC_STOP:
1260  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
1261  break;
1262  case IDC_EJECT:
1263  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EJECT);
1264  break;
1265  case IDC_BACKWARD:
1266  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_BACKWARD);
1267  break;
1268  case IDC_SEEKBACK:
1269  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SEEKBACK);
1270  break;
1271  case IDC_SEEKFORW:
1272  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SEEKFORW);
1273  break;
1274  case IDC_FORWARD:
1275  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_FORWARD);
1276  break;
1277  case IDC_PAUSE:
1278  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
1279  break;
1280  }
1281  break;
1282  }
1283  }
1284  }
1285  break;
1286 
1287  case WM_SIZING:
1288  {
1289  LPRECT pRect = (LPRECT)lParam;
1290 
1291  if (!bIsSingleWindow)
1292  {
1293  if (pRect->right - pRect->left < MAIN_WINDOW_MIN_WIDTH)
1294  pRect->right = pRect->left + MAIN_WINDOW_MIN_WIDTH;
1295 
1296  if (pRect->bottom - pRect->top != MAIN_WINDOW_HEIGHT)
1297  pRect->bottom = pRect->top + MAIN_WINDOW_HEIGHT;
1298  }
1299  return TRUE;
1300  }
1301 
1302  case WM_SIZE:
1303  {
1304  RECT Rect;
1305 
1306  if (hToolBar && hTrackBar)
1307  {
1308  SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
1309  SendMessage(hToolBar, TB_GETITEMRECT, 1, (LPARAM)&Rect);
1310  MoveWindow(hTimeDisplay, LOWORD(lParam) - 140, 4, 135, 18, TRUE);
1311 
1312  if (!bIsSingleWindow)
1313  {
1314  UINT Size = GetSystemMetrics(SM_CYMENU) + Rect.bottom;
1315  MoveWindow(hTrackBar, 0, 0, LOWORD(lParam), HIWORD(lParam) - Size, TRUE);
1316  }
1317  else
1318  {
1319  RECT ToolbarRect;
1320  MCI_DGV_PUT_PARMS mciPut;
1321 
1322  MoveWindow(hTrackBar, 180, 0, LOWORD(lParam) - 322, 25, TRUE);
1323 
1324  GetClientRect(hwnd, &Rect);
1325  GetClientRect(hToolBar, &ToolbarRect);
1326 
1327  mciPut.rc.top = 0;
1328  mciPut.rc.left = 0;
1329  mciPut.rc.right = Rect.right;
1330  mciPut.rc.bottom = Rect.bottom - (ToolbarRect.bottom - ToolbarRect.top) - 2;
1331 
1333  }
1334  }
1335  return 0L;
1336  }
1337 
1338  case WM_HSCROLL:
1339  {
1340  if (hTrackBar == (HWND)lParam)
1341  {
1342  if (wDeviceId)
1343  {
1344  DWORD dwNewPos = (DWORD)SendMessage(hTrackBar, TBM_GETPOS, 0, 0);
1345  SeekPlayback(hwnd, dwNewPos);
1346  }
1347  else
1348  {
1349  SendMessage(hTrackBar, TBM_SETPOS, TRUE, 0);
1350  }
1351  }
1352  }
1353  break;
1354 
1355  case WM_NCLBUTTONDBLCLK:
1356  {
1357  if (wParam == HTCAPTION)
1358  {
1359  SwitchViewMode(hwnd);
1360  }
1361  }
1362  break;
1363 
1364  case WM_COMMAND:
1365  {
1366  if (LOWORD(wParam) >= IDM_DEVICE_FIRST)
1367  {
1368  HandleDeviceMenuItem(hwnd, LOWORD(wParam));
1369  break;
1370  }
1371 
1372  switch (LOWORD(wParam))
1373  {
1374  case IDC_PLAY:
1375  case IDC_PAUSE:
1376  {
1377  if (wDeviceId)
1378  TogglePlaybackState(hwnd);
1379  else
1380  OpenFileDialog(hwnd, 1, NULL);
1381 
1382  break;
1383  }
1384 
1385  case IDC_STOP:
1386  StopPlayback(hwnd);
1387  break;
1388 
1389  case IDC_EJECT:
1390  break;
1391 
1392  case IDC_BACKWARD:
1393  break;
1394 
1395  case IDC_SEEKBACK:
1396  SeekBackPlayback(hwnd);
1397  break;
1398 
1399  case IDC_SEEKFORW:
1400  SeekForwPlayback(hwnd);
1401  break;
1402 
1403  case IDC_FORWARD:
1404  break;
1405 
1406  case IDM_OPEN_FILE:
1407  OpenFileDialog(hwnd, 1, NULL);
1408  return 0;
1409 
1410  case IDM_CLOSE_FILE:
1411  CloseMediaFile(hwnd);
1412  break;
1413 
1414  case IDM_REPEAT:
1415  {
1416  if (!bRepeat)
1417  {
1419  bRepeat = TRUE;
1420  }
1421  else
1422  {
1424  bRepeat = FALSE;
1425  }
1426  break;
1427  }
1428 
1429  case IDM_SWITCHVIEW:
1430  SwitchViewMode(hwnd);
1431  break;
1432 
1433  case IDM_DEVPROPS:
1434  ShowDeviceProperties(hwnd);
1435  break;
1436 
1437  case IDM_VOLUMECTL:
1438  ShellExecute(hwnd, NULL, _T("SNDVOL32.EXE"), NULL, NULL, SW_SHOWNORMAL);
1439  break;
1440 
1441  case IDM_ABOUT:
1442  {
1443  HICON mplayIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN));
1444  ShellAbout(hwnd, szAppTitle, 0, mplayIcon);
1445  DeleteObject(mplayIcon);
1446  break;
1447  }
1448 
1449  case IDM_EXIT:
1450  PostMessage(hwnd, WM_CLOSE, 0, 0);
1451  return 0;
1452  }
1453  break;
1454  }
1455 
1456  case WM_DESTROY:
1457  CloseMediaFile(hwnd);
1458  PostQuitMessage(0);
1459  return 0;
1460  }
1461 
1462  return DefWindowProc(hwnd, Message, wParam, lParam);
1463 }
1464 
1465 INT WINAPI
1466 _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdShow)
1467 {
1468  WNDCLASSEX WndClass = {0};
1469  TCHAR szClassName[] = _T("ROSMPLAY32");
1470  HWND hwnd;
1471  MSG msg;
1472  DWORD dwError;
1473  HANDLE hAccel;
1474 
1475  hInstance = hInst;
1476 
1477  switch (GetUserDefaultUILanguage())
1478  {
1481  break;
1482 
1483  default:
1484  break;
1485  }
1486 
1488 
1489  WndClass.cbSize = sizeof(WndClass);
1490  WndClass.lpszClassName = szClassName;
1491  WndClass.lpfnWndProc = MainWndProc;
1492  WndClass.hInstance = hInstance;
1493  WndClass.style = CS_HREDRAW | CS_VREDRAW;
1494  WndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN));
1495  WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
1496  WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1498 
1499  if (!RegisterClassEx(&WndClass))
1500  {
1502  return 0;
1503  }
1504 
1505  hwnd = CreateWindow(szClassName,
1506  szAppTitle,
1508  CW_USEDEFAULT,
1509  CW_USEDEFAULT,
1510  350,
1512  NULL,
1513  NULL,
1514  hInstance,
1515  NULL);
1516  if (!hwnd)
1517  {
1519  return 0;
1520  }
1521 
1522  hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(ID_ACCELERATORS));
1523 
1525 
1526  DragAcceptFiles(hwnd, TRUE);
1527 
1528  DisableMenuItems();
1529 
1530  dwError = SearchPath(NULL, _T("SNDVOL32.EXE"), NULL, 0, NULL, NULL);
1531  if (dwError == 0)
1532  {
1534  }
1535 
1536  /* Show it */
1537  ShowWindow(hwnd, SW_SHOW);
1538  UpdateWindow(hwnd);
1539 
1540  OpenMediaFile(hwnd, lpCmdLine, NULL);
1541 
1542  /* Message Loop */
1543  while (GetMessage(&msg, NULL, 0, 0))
1544  {
1545  if (!TranslateAccelerator(hwnd, hAccel, &msg))
1546  {
1547  TranslateMessage(&msg);
1548  DispatchMessage(&msg);
1549  }
1550  }
1551 
1553 
1554  DestroyAcceleratorTable(hAccel);
1555 
1556  return (INT)msg.wParam;
1557 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
HWND hTimeDisplay
Definition: mplay32.c:18
#define IDC_SEEKBACK
Definition: resource.h:72
#define MCI_DGV_PUT_DESTINATION
Definition: digitalv.h:234
#define WS_THICKFRAME
Definition: pedump.c:630
#define TranslateAccelerator
Definition: winuser.h:5726
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CharLowerBuff
Definition: winuser.h:5604
UINT style
Definition: winuser.h:3155
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDR_MAINMENU
Definition: resource.h:40
#define DispatchMessage
Definition: winuser.h:5631
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:561
#define IDB_SEEKBACKICON
Definition: resource.h:11
#define MCI_MODE_STOP
Definition: mmsystem.h:695
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static HICON
Definition: imagelist.c:84
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define IDS_TOOLTIP_SEEKFORW
Definition: resource.h:23
#define TRUE
Definition: types.h:120
#define IDC_BACKWARD
Definition: resource.h:71
#define RegisterClassEx
Definition: winuser.h:5703
static DWORD GetDeviceName(DWORD dwDeviceIndex, LPTSTR lpDeviceName, DWORD dwDeviceNameSize)
Definition: mplay32.c:450
#define MCI_INFO_PRODUCT
Definition: mmsystem.h:752
#define IDS_TOOLTIP_STOP
Definition: resource.h:19
#define MF_BYCOMMAND
Definition: winuser.h:202
long y
Definition: polytest.cpp:48
#define RegQueryInfoKey
Definition: winreg.h:521
#define LAYOUT_RTL
Definition: wingdi.h:1352
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hTrackBar
Definition: mplay32.c:16
#define MCI_STATUS_ITEM
Definition: mmsystem.h:742
#define DWORD_PTR
Definition: treelist.c:76
#define TBS_ENABLESELRANGE
Definition: commctrl.h:1994
HCURSOR hCursor
Definition: winuser.h:3161
#define IDM_ABOUT
Definition: resource.h:29
WNDPROC lpfnWndProc
Definition: winuser.h:3156
#define CreateWindow
Definition: winuser.h:5620
#define MCI_WAIT
Definition: mmsystem.h:730
ULONG_PTR dwItemData
Definition: winuser.h:3192
static VOID TogglePlaybackState(HWND hwnd)
Definition: mplay32.c:801
TCHAR szTime[64]
Definition: solitaire.cpp:18
long x
Definition: polytest.cpp:48
#define IDB_FORWARDICON
Definition: resource.h:13
UINT MaxFilePos
Definition: mplay32.c:29
#define IDS_APPTITLE
Definition: resource.h:3
HWND hwndOwner
Definition: commdlg.h:330
static VOID BuildFileFilterAndDeviceMenu(VOID)
Definition: mplay32.c:945
LPCSTR lpszClassName
Definition: winuser.h:3164
static MCIERROR OpenMciDevice(HWND hwnd, LPTSTR lpType, LPTSTR lpFileName)
Definition: mplay32.c:546
#define KEY_READ
Definition: nt_native.h:1023
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define DWORD
Definition: msvc.h:34
#define mciSendCommand
Definition: mmsystem.h:2851
static VOID ShowMCIError(HWND hwnd, MCIERROR mciError)
Definition: mplay32.c:282
#define TRACKBAR_CLASS
Definition: commctrl.h:1983
#define free
Definition: debug_ros.c:5
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
static VOID HandleDeviceMenuItem(HWND hwnd, UINT uItem)
Definition: mplay32.c:1173
#define IDC_SEEKFORW
Definition: resource.h:73
#define CALLBACK
Definition: compat.h:27
#define MF_STRING
Definition: winuser.h:138
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
BOOL WINAPI UpdateWindow(_In_ HWND)
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:527
LONG top
Definition: windef.h:297
#define TBICON_PLAY
Definition: resource.h:59
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define CS_HREDRAW
Definition: winuser.h:648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hInstance
Definition: mplay32.c:15
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define MCI_PLAY
Definition: mmsystem.h:649
#define TBM_SETPOS
Definition: commctrl.h:2006
#define IDM_DEVPROPS
Definition: resource.h:51
#define MCI_RESUME
Definition: mmsystem.h:675
HWND hToolBar
Definition: mplay32.c:17
static VOID StartPlayback(HWND hwnd)
Definition: mplay32.c:767
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:296
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDC_PAUSE
Definition: resource.h:75
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:298
#define IDB_PLAYICON
Definition: resource.h:7
#define MCI_STATUS_POSITION
Definition: mmsystem.h:745
int32_t INT
Definition: typedefs.h:56
#define LANG_HEBREW
Definition: nls.h:67
#define GetOpenFileName
Definition: commdlg.h:665
WPARAM wParam
Definition: combotst.c:138
BOOL bRepeat
Definition: mplay32.c:27
CHAR * LPTSTR
Definition: xmlstorage.h:192
VOID(CALLBACK * TIMERPROC)(HWND, UINT, UINT_PTR, DWORD)
Definition: winuser.h:2850
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:297
#define TB_GETITEMRECT
Definition: commctrl.h:1103
struct tagNMHDR * LPNMHDR
INT WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdShow)
Definition: mplay32.c:1466
WORD wDeviceId
Definition: mplay32.c:26
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define SearchPath
Definition: winbase.h:3714
DWORD nMaxFile
Definition: commdlg.h:337
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
#define TBM_SETRANGEMIN
Definition: commctrl.h:2008
static VOID ShowLastWin32Error(HWND hwnd)
Definition: mplay32.c:207
#define MCI_STOP
Definition: mmsystem.h:651
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define MCI_WINDOW
Definition: mmsystem.h:665
UINT code
Definition: winuser.h:3112
DWORD_PTR dwReturn
Definition: mmsystem.h:1567
#define MAIN_WINDOW_HEIGHT
Definition: mplay32.c:11
#define MCI_GETDEVCAPS_USES_FILES
Definition: mmsystem.h:763
#define IDM_REPEAT
Definition: resource.h:52
HMENU hMainMenu
Definition: mplay32.c:19
#define LoadAccelerators
Definition: winuser.h:5676
#define MAIN_WINDOW_MIN_WIDTH
Definition: mplay32.c:12
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define BTNS_BUTTON
Definition: commctrl.h:968
#define MCI_MODE_RECORD
Definition: mmsystem.h:697
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
void UpdateTimeDisplay(HWND hwnd)
Definition: mplay32.c:161
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
#define ID_ACCELERATORS
Definition: resource.h:43
unsigned char * LPBYTE
Definition: typedefs.h:52
#define TBICON_EJECT
Definition: resource.h:61
#define TBM_SETRANGEMAX
Definition: commctrl.h:2009
#define IDB_BACKWARDICON
Definition: resource.h:10
#define MCI_SYSINFO_QUANTITY
Definition: mmsystem.h:768
HINSTANCE hInstance
Definition: winuser.h:3159
static VOID SwitchViewMode(HWND hwnd)
Definition: mplay32.c:365
#define MCI_FORMAT_MILLISECONDS
Definition: mmsystem.h:701
HACCEL hAccel
Definition: main.c:47
#define StringCbPrintfEx
Definition: strsafe.h:600
#define TB_SETCMDID
Definition: commctrl.h:1113
#define TB_AUTOSIZE
Definition: commctrl.h:1107
LONG_PTR LPARAM
Definition: windef.h:208
#define TBM_GETPOS
Definition: commctrl.h:2001
#define IDS_TOOLTIP_EJECT
Definition: resource.h:20
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define ShellExecute
Definition: shellapi.h:679
#define MCI_WHERE
Definition: mmsystem.h:667
#define WM_DROPFILES
Definition: winuser.h:1801
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
void ResizeClientArea(HWND hwnd, int nWidth, int nHeight)
Definition: mplay32.c:83
#define GetCurrentDirectory
Definition: winbase.h:3619
#define TTN_GETDISPINFO
Definition: commctrl.h:1848
#define IDC_STOP
Definition: resource.h:69
#define CreateWindowEx
Definition: winuser.h:5621
#define CW_USEDEFAULT
Definition: winuser.h:225
#define MCI_DGV_WHERE_SOURCE
Definition: digitalv.h:444
#define MCI_DGV_WINDOW_DEFAULT
Definition: digitalv.h:459
#define IDT_PLAYTIMER
Definition: mplay32.c:9
#define WM_SIZING
Definition: winuser.h:1783
#define TOOLBARCLASSNAME
Definition: commctrl.h:916
#define TBM_SETPAGESIZE
Definition: commctrl.h:2021
#define IDS_MODE_NOT_READY
Definition: resource.h:37
smooth NULL
Definition: ftsmooth.c:416
static VOID CleanupFileFilter(VOID)
Definition: mplay32.c:1136
DWORD_PTR dwCallback
Definition: mmsystem.h:1591
UINT cbSize
Definition: winuser.h:3154
LPTSTR szFilter
Definition: mplay32.c:24
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
#define MCI_OPEN
Definition: mmsystem.h:646
#define IDS_MODE_OPEN
Definition: resource.h:31
void DisableMenuItems(void)
Definition: mplay32.c:76
HINSTANCE hInstance
Definition: commdlg.h:331
switch(r->id)
Definition: btrfs.c:2676
#define TBICON_FORWARD
Definition: resource.h:65
#define TBM_SETTICFREQ
Definition: commctrl.h:2020
#define SW_SHOW
Definition: winuser.h:769
#define IDB_STOPICON
Definition: resource.h:8
#define MCI_INFO
Definition: mmsystem.h:653
static VOID OpenMediaFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpType)
Definition: mplay32.c:887
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define IDM_SWITCHVIEW
Definition: resource.h:53
BOOL bIsSingleWindow
Definition: mplay32.c:28
HBRUSH hbrBackground
Definition: winuser.h:3162
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define MCI_DGV_WINDOW_HWND
Definition: digitalv.h:453
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MIIM_ID
Definition: winuser.h:717
TCHAR szCurrentFile[MAX_PATH]
Definition: mplay32.c:23
#define PostMessage
Definition: winuser.h:5698
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
#define IDS_MODE_PLAY
Definition: resource.h:33
DWORD dwTime
Definition: solitaire.cpp:25
void EnableMenuItems(HWND hwnd)
Definition: mplay32.c:48
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1686
#define MCI_STATUS
Definition: mmsystem.h:662
#define CCS_BOTTOM
Definition: commctrl.h:2214
#define GetMenuItemInfo
Definition: winuser.h:5654
#define MF_CHECKED
Definition: winuser.h:132
#define WS_CAPTION
Definition: pedump.c:624
#define TB_SETIMAGELIST
Definition: commctrl.h:1120
#define LPTOOLTIPTEXT
Definition: commctrl.h:1860
#define CS_VREDRAW
Definition: winuser.h:653
#define LPRECT
Definition: msvc.h:30
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:1207
static const WCHAR szClassName[]
Definition: clipbrd.c:11
#define IDS_TOOLTIP_SEEKBACK
Definition: resource.h:22
#define StringCbCat
Definition: strsafe.h:334
static const TBBUTTON Buttons[]
Definition: mplay32.c:35
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SS_CENTER
Definition: pedump.c:693
#define IDS_MODE_STOP
Definition: resource.h:32
#define WS_OVERLAPPED
Definition: pedump.c:615
#define BTNS_SEP
Definition: commctrl.h:969
#define d
Definition: ke_i.h:81
#define MCI_STATUS_LENGTH
Definition: mmsystem.h:744
#define MCI_OPEN_TYPE
Definition: mmsystem.h:739
#define IDB_SEEKFORWICON
Definition: resource.h:12
#define IDS_MODE_SEEK
Definition: resource.h:36
#define WM_SIZE
Definition: winuser.h:1593
#define IDC_EJECT
Definition: resource.h:70
#define MCI_TEST
Definition: digitalv.h:32
#define IDM_OPEN_FILE
Definition: resource.h:46
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define ILC_COLOR24
Definition: commctrl.h:342
static const WCHAR szStatus[]
Definition: http.c:73
#define IDB_PAUSEICON
Definition: resource.h:14
#define StringCbPrintf
Definition: strsafe.h:544
static VOID SeekBackPlayback(HWND hwnd)
Definition: mplay32.c:705
#define MF_ENABLED
Definition: winuser.h:128
#define WM_CLOSE
Definition: winuser.h:1603
#define RGB(r, g, b)
Definition: wingdi.h:2917
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
const GLubyte * c
Definition: glext.h:8905
TCHAR szAppTitle[256]
Definition: mplay32.c:21
unsigned int UINT
Definition: ndis.h:50
unsigned short WORD
Definition: ntddk_ex.h:93
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD GetNumDevices(VOID)
Definition: mplay32.c:433
static VOID CloseMediaFile(HWND hwnd)
Definition: mplay32.c:875
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ShellAbout
Definition: shellapi.h:678
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:959
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static BOOL DeviceUsesFiles(LPTSTR lpDeviceName)
Definition: mplay32.c:494
#define MCI_STATUS_MODE
Definition: mmsystem.h:747
MCIDEVICEID wDeviceID
Definition: mmsystem.h:1522
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static DWORD GetDeviceMode(HWND hwnd)
Definition: mplay32.c:629
#define IDM_CLOSE_FILE
Definition: resource.h:47
CHAR Message[80]
Definition: alive.c:5
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
DWORD MCIERROR
Definition: mmsystem.h:958
VOID CALLBACK PlayTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: mplay32.c:751
#define FormatMessage
Definition: winbase.h:3609
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define StringCbCopy
Definition: strsafe.h:155
#define TBICON_SEEKFORW
Definition: resource.h:64
HICON hIcon
Definition: winuser.h:3160
static const WCHAR L[]
Definition: oid.c:1087
#define IDI_MAIN
Definition: resource.h:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define IDS_MODE_UNKNOWN
Definition: resource.h:30
#define COLOR_BTNFACE
Definition: winuser.h:918
#define MIIM_TYPE
Definition: winuser.h:720
#define MB_ICONERROR
Definition: winuser.h:781
#define TB_ADDBUTTONS
Definition: commctrl.h:1241
#define IDS_TOOLTIP_PLAY
Definition: resource.h:18
#define IDC_FORWARD
Definition: resource.h:74
#define ILC_MASK
Definition: commctrl.h:336
#define IDS_TOOLTIP_PAUSE
Definition: resource.h:25
#define TB_CHANGEBITMAP
Definition: commctrl.h:1114
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:232
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
GLdouble s
Definition: gl.h:2039
#define MessageBox
Definition: winuser.h:5688
#define MCI_GETDEVCAPS_ITEM
Definition: mmsystem.h:758
#define WS_TABSTOP
Definition: pedump.c:634
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
static const WCHAR szDeviceName[]
Definition: provider.c:53
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static const WCHAR Cleanup[]
Definition: register.c:80
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define IDS_ALL_TYPES_FILTER
Definition: resource.h:26
#define WINAPI
Definition: msvc.h:20
#define GetFileAttributes
Definition: winbase.h:3629
#define LoadCursor
Definition: winuser.h:5678
#define OFN_SHAREAWARE
Definition: commdlg.h:119
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
#define IDS_DEFAULTMCIERRMSG
Definition: resource.h:28
#define HTCAPTION
Definition: winuser.h:2430
static VOID StopPlayback(HWND hwnd)
Definition: mplay32.c:646
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static DWORD GetDeviceFriendlyName(LPTSTR lpDeviceName, LPTSTR lpFriendlyName, DWORD dwFriendlyNameSize)
Definition: mplay32.c:464
#define RegOpenKeyEx
Definition: winreg.h:520
RECT PrevWindowPos
Definition: mplay32.c:30
#define TBICON_BACKWARD
Definition: resource.h:62
#define SW_SHOWNORMAL
Definition: winuser.h:764
HINSTANCE hInst
Definition: dxdiag.c:13
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
#define WS_MINIMIZEBOX
Definition: pedump.c:631
DWORD_PTR dwCallback
Definition: mmsystem.h:1521
LPSTR lpstrFile
Definition: commdlg.h:336
static VOID SeekForwPlayback(HWND hwnd)
Definition: mplay32.c:728
#define MCI_PUT
Definition: mmsystem.h:666
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
#define MM_MCINOTIFY
Definition: mmsystem.h:55
#define IDC_PLAY
Definition: resource.h:68
#define TBICON_SEEKBACK
Definition: resource.h:63
LPCSTR lpstrDeviceType
Definition: mmsystem.h:1523
static VOID SeekPlayback(HWND hwnd, DWORD dwNewPos)
Definition: mplay32.c:681
#define MCI_OPEN_ELEMENT
Definition: mmsystem.h:735
#define SS_SUNKEN
Definition: winuser.h:358
#define MCI_MODE_SEEK
Definition: mmsystem.h:698
#define SetWindowText
Definition: winuser.h:5723
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define WM_HSCROLL
Definition: winuser.h:1719
#define MB_OK
Definition: winuser.h:784
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetMessage
Definition: winuser.h:5656
#define IDM_EXIT
Definition: resource.h:27
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCI_GETDEVCAPS
Definition: mmsystem.h:654
#define MAX_MCISTR
Definition: mplay32.c:13
#define DragQueryFile
Definition: shellapi.h:672
#define StringCbCopyEx
Definition: strsafe.h:192
#define IDB_EJECTICON
Definition: resource.h:9
#define TBICON_STOP
Definition: resource.h:60
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define IDM_VOLUMECTL
Definition: resource.h:50
#define IDS_TOOLTIP_FORWARD
Definition: resource.h:24
#define SendMessage
Definition: winuser.h:5709
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
#define TBSTATE_ENABLED
Definition: commctrl.h:944
#define WM_CREATE
Definition: winuser.h:1590
CONST GLfloat m[16]
Definition: m_xform.h:144
#define IDM_DEVICE_FIRST
Definition: resource.h:56
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
#define MCI_PAUSE
Definition: mmsystem.h:652
#define MCI_MODE_OPEN
Definition: mmsystem.h:700
#define MCI_FROM
Definition: mmsystem.h:731
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define MAKELANGID(p, s)
Definition: nls.h:15
LONG bottom
Definition: windef.h:299
#define MCI_DGV_RECT
Definition: digitalv.h:232
#define MCI_DEVTYPE_WAVEFORM_AUDIO
Definition: mmsystem.h:689
static DWORD InsertDeviceMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, UINT uItemID, DWORD dwDeviceIndex)
Definition: mplay32.c:908
#define malloc
Definition: debug_ros.c:4
#define IDS_TOOLTIP_BACKWARD
Definition: resource.h:21
#define SM_CYMENU
Definition: winuser.h:966
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define LoadImage
Definition: winuser.h:5681
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:528
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
LONG RegEnumValue(HKEY Key, ULONG Index, PWCHAR ValueName, ULONG *NameSize, ULONG *Type, PUCHAR Data, ULONG *DataSize)
#define LoadIcon
Definition: winuser.h:5679
#define MCI_SYSINFO_NAME
Definition: mmsystem.h:770
#define MF_GRAYED
Definition: winuser.h:129
DWORD nFilterIndex
Definition: commdlg.h:335
#define MIIM_DATA
Definition: winuser.h:721
#define MCI_STATUS_TIME_FORMAT
Definition: mmsystem.h:749
LONG_PTR LRESULT
Definition: windef.h:209
#define MCI_NOTIFY
Definition: mmsystem.h:729
static VOID ShowDeviceProperties(HWND hwnd)
Definition: mplay32.c:862
TCHAR szDefaultFilter[MAX_PATH]
Definition: mplay32.c:22
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define UINT
Definition: msvc.h:27
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
HMENU WINAPI GetMenu(_In_ HWND)
LPCSTR lpstrElementName
Definition: mmsystem.h:1524
LPSTR dwTypeData
Definition: winuser.h:3193
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static VOID OpenFileDialog(HWND hwnd, DWORD dwFilterIndex, LPTSTR lpType)
Definition: mplay32.c:1142
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define LoadString
Definition: winuser.h:5685
#define MCI_SEEK
Definition: mmsystem.h:650
#define TBSTYLE_FLAT
Definition: commctrl.h:962
#define MCI_TO
Definition: mmsystem.h:732
#define WM_NOTIFY
Definition: richedit.h:61
struct Rect Rect
WCHAR WndClass[]
Definition: capicon.c:23
#define InsertMenuItem
Definition: winuser.h:5670
#define IDS_MODE_PAUSE
Definition: resource.h:34
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
#define mciGetErrorString
Definition: mmsystem.h:2855
#define IDS_MODE_RECORD
Definition: resource.h:35
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1676
DWORD_PTR dwCallback
Definition: mmsystem.h:1573
void UpdateWindowCaption(HWND hwnd)
Definition: mplay32.c:96
#define MCI_SYSINFO
Definition: mmsystem.h:659
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static MCIERROR CloseMciDevice(VOID)
Definition: mplay32.c:526
DWORD Flags
Definition: commdlg.h:342
#define TBM_SETLINESIZE
Definition: commctrl.h:2023