RSS Forums RSS
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums

Adding pictures

Join Date: Jul 2005
Posts: 31
Reputation: AlanC is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
AlanC's Avatar
AlanC AlanC is offline Offline
Light Poster

Re: Adding pictures

  #2  
Sep 12th, 2005
Hi again..

Sounds like you want to play a video or animation - such as an mpeg or avi or so on.. the trigger event isn't the difficult bit, it's how to play it that might be...

There's several ways to do what you want. The easy way is to use the mediaplayer activex control that comes with DirectX. This is different to the one that media player upgrades install (wmp.dll), which is not as flexible for us VB types. In your Windows/system folder (or system32 if you're on win2K or XP) look for the file msdxm.ocx. If it's not there, go to Microsoft's web site and download and install DirectX. If it is, on VB go to Project -> Components; in the list find Windows Media Player and tick it, and click Apply & Close.

On your control toolbar you should now see the 'old' media player icon (like a clapperboard) Click this, and add it to your form. If you drag it out to a reasonable size, you'll see it is actually a mediaplayer with a display area and controls. You can remove the controls by setting the ShowControls property to false; you might want to play with these properties to get what you want.

Now to control it programmatically, you need to open a file, and then play it.

For a quick demo add a command button and paste this code:
Private Sub Command1_Click()
   MediaPlayer1.FileName = "c:\creamedgates.mpeg"
   MediaPlayer1.play
End Sub

You'll get a more instant response if you load the file at some time before you want to play it.

(see http://www.bitstorm.org/gates/ for this video clip :cheesy: )

Hope this helps
Alan
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:54 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC