How To Play an AVI File w/ an API Call to 16-bit Mmsystem.dllLast reviewed: October 18, 1996Article ID: Q136763 |
The information in this article applies to:
SUMMARYThere are several ways to play AVI (audio-visual interleave) files from Visual FoxPro. These include:
MORE INFORMATIONThe API function MCIEXECUTE can be used to access a variety of MCI devices including those required to play AVI files. MCIEXECUTE is located in the Windows file MMSYSTEM.DLL (typically located in the Windows System directory). Since MMSYSTEM is a 16 bit Dynamic Link Library, you must use the REGFN and CALLFN statements in FOXTOOLS.FLL to register this function (the DECLARE statement in Visual FoxPro can only be used with 32 bit DLL's). Once the MCIEXECUTE function has been registered, you can use it to send a variety of MCI commands to open, play and close an AVI file. The syntax of the MCI command string allows you to control many attributes of the AVI playback window such as it's size, position, speed and direction (forward or reverse). The following procedure describes how to create a Form that can be used to play an AVI file.
are a number of things you can do to control how the playback windowappears. For example adding the line:
nRESULT = CALLFN(MCIEXE, "put wind window at 300 200 164 147")just prior to the line:
nRESULT = CALLFN(MCIEXE, "play wind wait")in the click event of the Command Button allows you to control where the playback window will appear, and what it's dimensions will be. In this example the upper left hand corner of the window will be at pixel position 300, 200 (where the upper left hand corner of the screen is the origin of 0,0) and will have a width of 164 pixels and a height of 147 pixels. Another example that demonstrates modifying the play back window is:
nRESULT = CALLFN(MCIEXE, "SET WIND SPEED 500")Adding this line immediately prior to the line:
nRESULT = CALLFN(MCIEXE, "play wind wait")in the click event of the Command Button allows you to control the speed at which the AVI file will play. In this example it will play a one half of its original speed (1 second to 500 milliseconds). You can also control the direction in which the AVI file will play. Replace the code in the Click event of the Command Button with the following to demonstrate this ability:
cAVIFile = SYS(2004) + "TEST.AVI" && Specifies the path to, and ; the name of the AVI file to be played nRESULT = CALLFN(MCIEXE, "open " + cAVIFile + " TYPE AVIVIDEO alias ; wind style popup") && Opens an instance of the MCI device type; AVIVIDEO and gives it the alias name 'wind' nRESULT = CALLFN(MCIEXE, "SET wind TIME FORMAT MILLISECONDS") && Sets; the playback format to milliseconds (as opposed to frames) nRESULT = CALLFN(MCIEXE, "PLAY wind WINDOW FROM 5000 TO 0 WAIT") ; && Note that the above line specifies to play the AVI file from time ; position 5000 (milliseconds) to time position 0 (Beginning of the ; file). If your AVI file is less than 5000 milliseconds in length, ; adjust this line accordingly nRESULT = CALLFN(MCIEXE,"close wind") && Closes the instance of the ; MCI device driver specified by the alias 'wind'There are many other things you can do to control the playback of AVI files using MCI Command Strings. For more information on these see Appendix F of the Microsoft Video for Windows User's Guide.
|
Additional reference words: 5.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |