home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / MCI2.PRG < prev    next >
Text File  |  1995-06-27  |  2KB  |  78 lines

  1. ////////////////////////////
  2. //
  3. //    Clip-4-Win video MCI sample
  4. //
  5. //    Copyright (C) 1994 Skelton Software, Kendal Cottage, Hillam, Leeds, UK.
  6. //    All Rights Reserved.
  7. //
  8. ////////////////////////////
  9.  
  10.  
  11. #include "windows.ch"
  12. #include "dll.ch"
  13. #define    NO_C4WCLASS
  14. #include "commands.ch"
  15.  
  16. static    lOpen := .f.
  17.  
  18.  
  19. function main()
  20. local    hWnd := WinSetup("mci", "Clip-4-Win Media Control Interface")
  21.  
  22. DoVideo(hWnd)
  23.  
  24. return 0
  25.  
  26.  
  27. static function DoVideo(hWnd)
  28. local    oDlg
  29.  
  30. CREATE DIALOG oDlg  TITLE "Clip-4-Win AVI Sample"  AT 10,10 SIZE 200,150
  31.  
  32. @ ID IDCANCEL  BUTTON        TEXT "&Cancel"      AT 150,10  SIZE 40,12  IN oDlg
  33. @ ID 101       BUTTON  Open  TEXT "&Open Video"  AT 150,30  SIZE 40,12  IN oDlg
  34. @ ID 102       BUTTON  Play  TEXT "&Play Video"  AT 150,50  SIZE 40,12  IN oDlg
  35.  
  36. SHOW DIALOG oDlg
  37.  
  38. if lOpen
  39.     mciExecute("close TheVid")
  40. endif
  41.  
  42. return nil
  43.  
  44.  
  45. static function Open(hWnd)
  46. local    cFile, cCmd, nRet
  47.  
  48. if lOpen
  49.     mciExecute("close TheVid")
  50. endif
  51.  
  52. if (cFile := GetOpenFileName(hWnd, "*.AVI", "Select a video to play",    ;
  53.                              {{"Video Files (*.AVI)", "*.AVI"}})) == nil
  54.     return nil
  55. endif
  56.  
  57. cCmd = "open " + cFile + " type avivideo alias TheVid style child"        ;
  58.        + " parent " + ltrim(str(hWnd))
  59.  
  60. nRet = mciExecute(cCmd)
  61.  
  62. nRet = mciExecute("put TheVid window at 10 10 280 280")
  63.  
  64. lOpen = .t.
  65. return 1
  66.  
  67.  
  68. static function Play()
  69. if lOpen
  70.     mciExecute("seek TheVid to start")
  71. endif
  72. mciExecute("play TheVid")
  73. return 1
  74.  
  75.  
  76. _DLL function mciExecute(cCmd AS STRING) AS INT Pascal:MMSystem.mciExecute
  77.  
  78.