how to launch media player and a selected file from within VB.Net app?

B

Bob

I have a media file Myfile.wme that I want to play within the Windows
default media player on a button or menu click event in my app. The file is
in a folder relative to my bin folder. I can defeine the full path of the
file then using that I want to launch the media player to use that file.

Any help greatly appreciated.

Bob
 
H

Herfried K. Wagner [MVP]

Bob said:
I have a media file Myfile.wme that I want to play within the Windows
default media player on a button or menu click event in my app. The file
is in a folder relative to my bin folder. I can defeine the full path of
the file then using that I want to launch the media player to use that
file.

\\\
Imports System.Diagnostics
....
Process.Start("C:\foo\bla.wmv")
///
 
B

bob

Hi,

I notice your reply to the starting message uses "Process.Start" and
only names the target file to be played, without naming the program to
play it with. Obviously, this depends on the "Type" of file (wmv) being
assigned a hosting program in Windows. Is this "Process.Start" command
now the equivalent of the Windows API "ShellExecute"??

Thanks.
 
H

Herfried K. Wagner [MVP]

I notice your reply to the starting message uses "Process.Start" and
only names the target file to be played, without naming the program to
play it with. Obviously, this depends on the "Type" of file (wmv) being
assigned a hosting program in Windows.

Yes. However, you can open the file with a certain player too:

\\\
Process.Start("C:\myplayer.exe", """C:\my files\sample.mp3""")
///
Is this "Process.Start" command
now the equivalent of the Windows API "ShellExecute"??

Yes, it is.
 
B

bob

Thanks. (I'm slowly eliminating all the "declares" I had in vb6,
replacing them with cleaner, quicker vb.net stuff. Every time I do
that, it makes me feel a little better about .net. Before long, I'm
going to be loving this language!)
 
M

Mike Lowery

Myfile.wme? WME is Windows Media Encoder and a wme file is not a multimedia
file that WMP can play.
 
C

Cor Ligthert [MVP]

Bob,

You are not the first one who does that and have the same evolution in that.

Although version 2005 has a lot of failures especial in the IDE, but that is
known and we are sure that it will be solved. Our expiriences from 2002 to
2003 version (in fact almost an SP) were great.

:)

Cor

Thanks. (I'm slowly eliminating all the "declares" I had in vb6,
replacing them with cleaner, quicker vb.net stuff. Every time I do
that, it makes me feel a little better about .net. Before long, I'm
going to be loving this language!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top