|
|
|
If you want to play an AVI movie from VB you can use MCI functions. The main MCI function is mciSendString, that sends command strings to the system and execute them: |
The first argument is the command string, lpstrReturnString receives return information (if needed), uReturnLength indicates the size, in characters, of lpstrReturnString, and hwndCallback is used for system notification. Remember that every command string described in this tip must be sent to the system with: |
First you must open the AVI device with |
Notice that FileName must be in the short format 8.3 characters; lpstrReturnString is null because you don't need any return information. "AVIFile" is an arbitrary name that you'll use in subsequent command strings as an alias of the filename. Once you've opened the file you you can start playing it with the following command: |
You can also play it full screen with: |
The execution is synchronous, but you can play the file asynchronously and receive notifications with one of these commands: |
where MyForm is the form you are using. The system sends your form a MM_MCINOTIFY message when the playback is finished. To intercept this message you have to create a custom window procedure and use a subclassing technique. By default playback begins at the current position and stops at the end of the content, but you can play only a part of the file with: |
X and Y are two different positions. It's often useful to specify X and Y in milliseconds, so before Play command you might use this command: |
With asynchronous executions, you can pause / resume and stop playback with |
To play a movie without the audio send this string before the play command: |
and you can also play just the audio track: |
When you have finished to work with the AVI device, you must close it with |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|