Solved

Possible to run Windows Media Player in command line?

Posted on 2004-10-20
3
198 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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