Solved

opening a windows media file from VB

Posted on 2001-09-08
11
188 Views
Last Modified: 2006-11-17
what is the quickest/easiest way to open a
Windows Media file (mpeg, avi)
from whithin Visual Basic?

0
Comment
Question by:system
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 6467498
Project -> Components and select Windows Media Player

Set the FileName property to point to the file to play.
0
 
LVL 17

Accepted Solution

by:
Suat Ozgur earned 200 total points
ID: 6467499
shell ("start c:\somefolders\file.avi",1)

suat
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 6467503
sorry

response=shell ("start c:\somefolders\file.avi",1)

But this will work if you have a default player for this. And this way is just start that application to run avi file. To play it in your application (i think you ask that:)) then AzraSound suggested easiest way.

'Hi Azrasound, nice to meet you again.

Regards.
suat
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6467511
Hey smozgur  :-)
0
 
LVL 27

Expert Comment

by:Ark
ID: 6467858
If you don't want to use control , use mciSendString API instead. Take a look at http://blackbeltvb.com/free/mcisamp.htm for sample

Cheers
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:system
ID: 6467952
I should have elaborated further.

The program will be running of a CD, and the path to
the video file will be relative to the drive letter,
on the specific computer (i.e. D, E, F, etc)

Is there a way to place the path to the video
somefolders\file.avi" without the drive letter?

By the way, I actually want to launch WMP not embed the video into the application, so smozgur had the right idea.


0
 
LVL 27

Expert Comment

by:Ark
ID: 6468005
Use App.Path:

Shell "Start " & App.Path & "\somefolder\file.avi"

BTW, if you're speaking about AVI, take a look on my sample at http://www.freevbcode.com/ShowCode.Asp?ID=3185 for playing AVI files

Cheers
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 6468182
You can use a file open dialog control (common dialog) then you can use shell function like below (cmdlg1 is the common dialog control name)

response=shell ("start " & cmdlg1.filename, vbHide)

Now your application runs without need to change code. You can also force cmdlg1 to open in CD as default (checking CD drive in system then setting InitDir property to drive root like this; cmdlg1.InitDir="D:\" to run cmdlg1 in D drive).

Suat

0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 6468186
But this way would run by user select action. If your file name and folder (not drive letter, folder. Because you can find the CD drive letter but if path information doesnot exist then your application would have to do a search.)

If your application runs from CD then Ark has the right focus. You can set the avi path info by using App.Path property. Because if your application is running from CD then App.Path will retrieve drive letter as CD drive letter. So you just need to put avi file into application folder (or in a subfolder in application folder; App.Path & "\aviFolder\filename.avi" also works.)

Suat


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7207761
Hi system,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept smozgur's comment(s) as an answer.

system, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7241098
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

911 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

16 Experts available now in Live!

Get 1:1 Help Now