Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using multimedia files in VB 4

Posted on 1998-06-11
5
336 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

860 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