home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / video / mplay / mplay.c < prev    next >
C/C++ Source or Header  |  1997-10-05  |  2KB  |  77 lines

  1. /**************************************************************************
  2.  *
  3.  *  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4.  *  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5.  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6.  *  PURPOSE.
  7.  *
  8.  *  Copyright (C) 1992 - 1997 Microsoft Corporation.  All Rights Reserved.
  9.  *
  10.  **************************************************************************/
  11. /**************************************************************************
  12.  * MPLAY.C - Movie Player App using MCIWnd window class
  13.  *
  14.  *************************************************************************/
  15.  
  16. #define  STRICT
  17. #include <windows.h>
  18. #include <mmsystem.h>
  19. #include <vfw.h>
  20.  
  21. #include "mplay.h"
  22.  
  23. //----------------------------------------------------------------------------
  24.  
  25. #define BUFSIZE 260
  26.  
  27. //----------------------------------------------------------------------------
  28.  
  29. int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
  30. {
  31.     HWND          hwndApp;
  32.     MSG           msg;
  33.     WORD          wVer;
  34.     static char   szBuffer[BUFSIZE];
  35.  
  36.     /* first let's make sure we are running on 1.1 */
  37.     wVer = HIWORD(VideoForWindowsVersion());
  38.     if (wVer < 0x010a) {
  39.         char szTitle[BUFSIZE];
  40.         char szMessage[BUFSIZE];
  41.  
  42.         LoadString( hInst, IDS_APPERR, szTitle, BUFSIZE );
  43.         LoadString( hInst, IDS_OLDVFW, szMessage, BUFSIZE );
  44.         /* oops, we are too old, blow out of here */
  45.         MessageBeep(MB_ICONHAND);
  46.         MessageBox(NULL, szMessage, szTitle, MB_OK|MB_ICONSTOP);
  47.         return FALSE;
  48.     }
  49.  
  50.     /* create the window */
  51.     hwndApp = MCIWndCreate(NULL,
  52.                            hInst,
  53.                        MCIWNDF_SHOWNAME            |
  54.                        MCIWNDF_SHOWMODE            |
  55.                        WS_OVERLAPPEDWINDOW         |
  56.                        WS_VISIBLE,
  57.                        NULL);
  58.  
  59.     if (hwndApp == NULL)
  60.         return -1;
  61.  
  62.     LoadString( hInst, IDS_DIALOGNAME, szBuffer, BUFSIZE );
  63.     SetWindowText(hwndApp, szBuffer);
  64.  
  65.     //Polling messages from event queue
  66.     while (GetMessage(&msg,NULL,0,0)) {
  67.  
  68.         TranslateMessage(&msg);
  69.         DispatchMessage(&msg);
  70.  
  71.         if (!IsWindow(hwndApp))
  72.             PostQuitMessage(0);
  73.     }
  74.  
  75.     return msg.wParam;
  76. }
  77.