Solved

Possible to run Windows Media Player in command line?

Posted on 2004-10-20
3
208 Views
Last Modified: 2008-01-09
I'm going to write a program that is to press a 'start' button and then open the Windows Media Player with a specific video/audio file.  I'm not sure if Windows Media Player can accept parameter that is to execute the Player with the video/audio file?
0
Comment
Question by:kwkaan
3 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12367060
You can do that, this will open Media Player and play the file Logo1.avi

        Shell("C:\Program Files\Windows Media Player\mplayer2.exe C:\Logo1.avi", AppWinStyle.NormalFocus)

Argument after a space
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12367416
This is the .net way

        System.Diagnostics.Process.Start("C:\Program Files\Windows Media Player\mplayer2.exe","c:\logo1.avi")

if you want to run the media player inside your program look at this article

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/playingdigitalmediainavisualbasicnetapplication.asp
0
 
LVL 6

Accepted Solution

by:
The_Biochemist earned 500 total points
ID: 12389220
Inside your application you can simply add a reference to the WMPLib.dll COM component

then using it is as simple as :

1)        Imports WMPLib

2)        Dim WMP as new WindowsMediaPlayer

3)        With WMP
            .URL = "C:\Logo1.avi"
            .controls.play()
           End With

OR

You can add the WMPLib.dll to your Toolbox and then drag it onto the form and have a nice Media player 9 window on your form directly rename it to WMP and then use the code in (3) above to play it.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

713 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