Results 1 to 3 of 3

Thread: Can an *.mpg play looped in VB6?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    17

    Smile Can an *.mpg play looped in VB6?

    Can an *.mpg play looped using the MMControl (Multimedia Control)? What is the code? Or would I have to use the API in order to have this happen and use a Command button to control it.
    Any help with the code would be greatly appreciated.
    Thanks Ron L

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    There is a simple way by using Windows Media Player.

    You just add Windows Media Player to your VB project, and then
    Put one on form, put a Timer.
    Now settings are:
    Set MediaPlayer1.Filename to your requested file.
    Set the Timer interval to 100.
    Now code in the Timer:
    VB Code:
    1. If MediaPlayer1.PlayStatus = vbStopped Then
    2.    MediaPlayer1.Play
    3. End If

    That's it with Media Player, in other way it's much harder, and much longer.

    I hope that helps,
    Arie.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    17
    Thanks for your reply. I'm putting together a complete program where the lesson will be displayed. This what I have so far(The Code Is Below).
    The problem that I am now having is the lesson just continues to loop and when I press stop it just goes back to the beginning and starts over again.
    Also, there is a delay when it starts to replay.
    Thanks again...Ron L (rluka)



    Here is the code:

    Private Sub Command1_Click()
    MMControl1.FileName = (App.Path & "\SlapBass1.mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub Command2_Click()
    MMControl1.FileName = (App.Path & "\SlapBass2.mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub Command3_Click()
    MMControl1.FileName = (App.Path & "\SlapBass3.mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub Command4_Click()
    MMControl1.FileName = (App.Path & "\SlapBass4.mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub Command5_Click()
    MMControl1.FileName = (App.Path & "\Slapbass5.mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub Command6_Click()
    MMControl1.FileName = (App.Path & "\Slapbass6 .mpg")
    MMControl1.hWndDisplay = Picture1.hWnd
    MMControl1.Command = "Open"
    End Sub

    Private Sub MMControl1_PlayClick(Cancel As Integer)
    1 MMControl1.Command = "Open"
    MMControl1.Notify = True
    MMControl1.Command = "play"
    DoEvents
    Do
    DoEvents
    Loop Until MMControl1.Mode = mciModeStop
    MMControl1.Command = "Close"
    GoTo 1
    End Sub

    Private Sub MMControl1_StatusUpdate()
    Dim strMode As String
    strMode = ""

    Select Case MMControl1.Mode

    Case mciModeReady
    strMode = "Ready"

    Case mciModeStop
    strMode = "Stopped"

    Case mciModeSeek
    strMode = "Seeking"

    Case mciModePlay
    strMode = "Playing"

    Case mciModePause
    strMode = "Paused"

    End Select

    Label1.Caption = strMode

    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    MMControl1.Command = "Stop"
    MMControl1.Command = "Close"

    End Sub

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