Solved

Using multimedia files in VB 4

Posted on 1998-06-11
5
326 Views
Last Modified: 2010-05-03
Hello everybody,
my goal is to start and stop MIDI-Music in the background and to start and stop AVI and MOV files by clicking a command button (not just by double clicking the video frame).
Who knows what to do in my case ?

Regards, Dr. Timo
0
Comment
Question by:Dr_Timo
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:cip
ID: 1463081
What version of visual basic? Try taking a look at the microsoft multimedia control.
0
 
LVL 1

Author Comment

by:Dr_Timo
ID: 1463082
It is Visual Basic Version 4.0. I did not know that it is so difficult to do this. Let's say I want to play MIDI music in the background which can be toggled on/off by Command-Buttons or within the program. And some actions or events should activate a video window to front an just play the movie (multimedia-integration). This must be possible in VB i hope.
0
 
LVL 1

Author Comment

by:Dr_Timo
ID: 1463083
It is Visual Basic Version 4.0. I did not know that it is so difficult to do this. Let's say I want to play MIDI music in the background which can be toggled on/off by Command-Buttons or within the program. And some actions or events should activate a video window to front an just play the movie (multimedia-integration). This must be possible in VB I hope.
0
 
LVL 1

Accepted Solution

by:
cip earned 100 total points
ID: 1463084
Dr_Timo,

Sure it is possibile.

Open VB, then from the menu "Tools", select "Custom controls".
From the available controls, select "Microsoft Multimedia control".
Then, draw a multimedia control on the form, together with three command buttons, name them cmdPlay, cmdStop and cmdRewind.
Paste this code in the Form_Load event and in the click events of the three buttons:

Private Sub Form_Load()
    ' Load a multimedia file into Microsoft
    ' multimedia control
    MMControl1.filename = "song.mid"
    ' Open the media, preparing to play
    MMControl1.Command = "Open"
End Sub

Private Sub cmdPlay_Click()
    ' Play media
    MMControl1.Command = "Play"
End Sub

Private Sub cmdStop_Click()
    ' Stop the media
    MMControl1.Command = "Stop"
End Sub

Private Sub cmdRewind_Click()
    ' First stop the media
    MMControl1.Command = "Stop"
   
    ' Then seek to position 0
    MMControl1.To = 0
    MMControl1.Command = "Seek"
End Sub

You can do exactly the same for a video file, simply substitute "song.mid" with the name of the video you want to play, or just use two different multimedia controls.

Cip.
0
 
LVL 1

Author Comment

by:Dr_Timo
ID: 1463085
Thank you very much, Cip! That does help me a lot !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA: Add rows to listbox based on criteria 7 80
Excel VBA, find a string in a column, update a cell 7 68
Hide vba in gp 7 83
Added a column screws up code 5 50
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now