VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

Browse Topics

- Getting started
- Data Types
- Modules
- Operators in VB6
- VB6 Variable
- VB6 Procedures
- VB6 Control Structures
- Loops in VB6
- VB6 Exit Do & With End With
- Arrays in VB6
- User-Defined Data Types
- VB6 Constants
VB6 Built-in Functions
- Date and Time in VB6
- VB6 Controls
- TextBox Control
- ComboBox & OptionButton
- Label & Frame
- PictureBox & ImageBox
- Timer Control
- ListBox & ComboBox
- VB6 ScrollBar
- Control Arrays in VB6
- Files controls in VB6
- VB6 CheckBox
- Forms in VB6
- Menus in VB6
- MDI Form in VB6
- InputBox
- MessageBox
- Mouse events
- Mouse Move
- Error Handling
Error Handling (2)
VB6 Database

You are here: Visual Basic > VB6 (Beginners Tutorial)

Tutorial Main Page | Previous Page | Contents | Next Page

A Bit of Multimedia

• The computer of the 90’s is the multimedia computer (graphics, sounds, video). Windows provides a set of rich multimedia functions we can use in our Visual Basic applications. Of course, to have access to this power, we use the API. We’ll briefly look at using the API to play video files with the AVI (audio-visual interlaced) extension.

• In order to play AVI files, your computer needs to have software such as Video for Windows (from Microsoft) or QuickTime for Windows (from Apple) loaded on your machine. When a video is played from Visual Basic, a new window is opened with the title of the video file shown. When the video is complete, the window is automatically closed.

• The DLL function mciExecute is used to play video files (note it will also play WAV files). The syntax for using this function is:

Dim RtnValue as Long .
RtnValue = mciExecute (Command

where Command is a string argument consisting of the keyword ‘Play’ concatenated with the complete pathname to the desired file.

Quick Example 12 - Multimedia Sound and Video

  1. Start a new application. Add a command button and a common dialog box. Copy and paste the mciExecute Declare statement from the API Text Viewer program into your application. It should read:

    Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

  2. Add this code to the Command1_Click procedure:

    Private Sub Command1_Click()
    Dim RtnVal As Long
    'Get name of .avi file to play
    CommonDialog1.Filter = "Video Files|*.avi"
    RtnVal = mciExecute("play " + CommonDialog1.filename)
    End Sub

  3. Run the application. Find a AVI file and see and hear the lovely results.


Tutorial Main Page | Previous Page | Contents | Next Page


Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved