Results 1 to 5 of 5

Thread: AVI movie shows in picture box?

  1. #1

    Thread Starter
    Banned
    Join Date
    Feb 2001
    Location
    USA
    Posts
    9

    Question

    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.

  2. #2
    Member susn's Avatar
    Join Date
    Feb 2001
    Location
    Dubai
    Posts
    48

    AVI Player

    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.

  3. #3

    Thread Starter
    Banned
    Join Date
    Feb 2001
    Location
    USA
    Posts
    9

    Thx but,

    Im doing this useing API, not the MMControl. So how would you do it threw API?

  4. #4
    New Member
    Join Date
    Jan 2001
    Location
    Ohio
    Posts
    6
    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.

  5. #5
    New Member
    Join Date
    Jan 2001
    Location
    Ohio
    Posts
    6

    Wink

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width