VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO

by ishom (1 Submission)
Category: Sound/MP3
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 6th February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO

API Declarations


'The principle so MPEGVideo can be played on some VB control are as follows
'1. Select DeviceType i.e., "MPEGVideo" that has been registered in SYSTEM.INI in section [MCI]
'2. Select filename of MPEGVideo
'3. Select VB Control to display MPEGVideo (PictureBox, Form etc)
'4. Open file of MPEGVideo
'5. PLAY/PAUSE/STOP
'6. Close file of MPEGVideo

Rate BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO



'-------------------------------------------------------------------------------
Private Sub Form_Load()
    MCI1.DeviceType="MPEGVideo"
       'It must be registered in SYSTEM.INI section [MCI]
    MCI1.Filename="e:\mpegav\avseq01.dat"
       'Assumed that your CDROM drive is "E" and VCD has already inserted
    MCI1.HwndDisplay=Me.hWnd
       'It will display the movie on Form, If you want to play on picturebox
       'replace MCI1.hwndDisplay=Picture1.hWnd
    MCI1.Command="Open"
       'Now Your VCD is ready to play, just click PLAY button of MCI Control
End Sub

'How to know percentage of running VCD? See following code:

Private Sub MCI1_StatusUpdate()
    Dim nPCTG
    nPCTG=MCI1.Position/MCI1.Length*100
    Me.Caption= "Playing " & MCI1.filename & ": " & Format(nPCTG,"00.0") & " %"
    'The Percentage displays on Title Form Bar
End Sub

'Preventing error after application ending, MPEGVideo file must be closed

Private Sub Form_QueryUnload()
    MCI1.Command="Close"
End Sub

'How easy is it?
'More?? Contact me.

Download this snippet    Add to My Saved Code

BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO Comments

No comments have been posted about BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO. Why not be the first to post a comment about BASIC PRINCIPLE: USE OF MCI32.OCX FOR PLAYING MPEGVIDEO.

Post your comment

Subject:
Message:
0/1000 characters