PDA

Click to See Complete Forum and Search --> : AVI movie shows in picture box?


Dark Programmer
Feb 20th, 2001, 12:14 PM
I have to code to play a AVI useing API. But how do I move the movie into a picture box? I know it has something to do with the hwnd.

susn
Feb 22nd, 2001, 12:00 PM
You have to place a MultiMediaControl in your Form.
It is the Microsoft Multimedia Control 6.0 which is within Projects|Komponents, add it to your Project.
Set the DeviceType Property of the MMControl to AVIVideo.
Select the Filename Property set them to the file you wanna play with the Player.
Sub Form_Load:
NameOfTheMultiMediaControl.Command = "Open"
NameOfTheMultiMediaControl.hWndDisplay = NameOFThePictureBox.hWnd
End Sub
Thats the way without any API Funktion.

Dark Programmer
Feb 22nd, 2001, 02:23 PM
Im doing this useing API, not the MMControl. So how would you do it threw API?

Ryan_231
Feb 23rd, 2001, 03:10 PM
i've seen this before. post your code to play the avi and i'll see if i can't remember how it's done.

Ryan_231
Feb 23rd, 2001, 03:54 PM
here ya go i thought i still had this in amodule somewhere just had to find it

Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal _
uReturnLength As Long, ByVal hwndCallback As Long) As Long

Public Sub PlayVideo(FilePath As String, PlayIn As Object)
FilePath = UCase(FilePath)
If Right(FilePath, 3) = "AVI" Then
mciSendString "open " & FilePath & " type AVIvideo alias movie style child parent " & PlayIn.hWnd, 0&, 0, 0
Else
mciSendString "open " & FilePath & " type MPEGvideo alias movie style child parent " & PlayIn.hWnd, 0&, 0, 0
End If
mciSendString "play movie wait", 0, 0, 0
mciSendString "close movie", 0, 0, 0
End Sub

just put this in a module and it will play avi or mpeg videos wherever you want them in a form or picturebox anything with a hwnd

just call it by using the path to the file you want to play and the object you want it played in

Call PlayVideo("c:\mydocuments\sample.avi",form1)