Results 1 to 3 of 3

Thread: Playing AVI through MCI [resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    Playing AVI through MCI [resolved]

    Ok, here is the problem...
    I am playing with playing an AVI file through the MCI, and ran into a problem when it comes to the video.

    The video has a background that's transparent, which keeps appearing at Magenta on my form.

    Is there way to show it actually transparent?

    Here is my code....
    On a form, add:

    3 command buttons
    1 picture box
    1 timer

    Code:
    Private Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
        lpstrCommand As String, ByVal lpstrReturnString As String, _
        ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
    
    Dim sAlias As String
    Dim rReturn As Long
    
    
    Private Sub Command1_Click()
    Dim mssg As String * 255
    
        sTheFile = "c:\filecopy.avi"
        sAlias = Right$(sTheFile, 3) & Minute(Now)
        nReturn = mciSendString("Open " & sTheFile & " ALIAS " & sAlias & " TYPE AviVideo wait parent " & Picture1.hWnd & " Style " & &H40000000, "", 0, 0)
    
        nReturn = mciSendString("set " & sAlias & " time format ms", 0&, 0, 0)
    
        nReturn = mciSendString("status " & sAlias & " length", mssg, 255, 0)
        Timer1.Interval = mssg + 500
        Me.Caption = mssg
    
    End Sub
    
    Private Sub Command2_Click()
        nReturn = mciSendString("play " & sAlias, 0&, 0, 0)
        Timer1.Enabled = True
    End Sub
    
    Private Sub Command3_Click()
        nReturn = mciSendString("stop " & sAlias, 0&, 0, 0)
        nReturn = mciSendString("close " & sAlias, 0&, 0, 0)
        Timer1.Enabled = False
    End Sub
    
    Private Sub Timer1_Timer()
        nReturn = mciSendString("play " & sAlias & " from 0", 0&, 0, 0)
    End Sub

    The video is the FILECOPY.AVI from the Microsoft Visual Studio\Common\Graphics\Videos folder.

    Any help would be greatly appreciated....
    Last edited by JasonC; Jun 5th, 2004 at 08:25 AM.

  2. #2
    Addicted Member
    Join Date
    May 2004
    Location
    China
    Posts
    228
    All the program I opened it in showed the magneta, not sure what call you need to make it transparent. Can you use a gif instead?

    Google turned up this for me:
    http://www.programmersheaven.com/zone1/cat372/207.htm
    http://www.vbaccelerator.com/home/VB...er/article.asp
    http://www.vbcodemagician.dk/resources/vcanim.htm (seperate control)

    Let me know if any of these work! Otherwise, you got the gif!
    Attached Images Attached Images  
    You know the best way to find the answer to your question? SEARCH!
    www.google.com
    www.planet-source-code.com
    www.msdn.com
    http://www.vbforums.com/search.php?s=
    P.S. Its faster than waiting for replies too!

    [vbcode]
    If InStr(1, Message, "FIX MY CODE") <> 0 Then Reply = False
    If AnswerIn(Google, VB_Forums, PSC, MSDN) = True Then Reply = False
    [/vbcode]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135
    Thanks

    I downloaded the gif (incase) but so far the 12kb control from vbcodemagician is appearing to be the best solution.


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