Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue using relative reference with Video File and Windows Media P. 1

Status
Not open for further replies.

metalmibvbnet

Programmer
Apr 17, 2007
3
US
Hi,
I have a form created with Windows Media Player Box and I'm trying to make it so that when the program loads, the video will run automatically. If I set the URL to the absolute file path of the video, it runs fine, but I will be sending this to others so I'd like to run it from the relative file path, the only problem is that if I set the URL to the relative file path, I get... "Exception from HRESULT: 0xC00D132B". Anyone know what I can do to get around this? Using Visual Studio 2005.
Mediabox.URL = "C:\Visual Studio 2005\Projects\Myproject\Myproject\files\video.wmv"
above(absolute path works fine)
Mediabox.URL = "..\..\files\video.wmv"
Doesn't work(relative path is correct, works when i'm loading other file types for other parts of program!)
I'm very new to programming, so I've been trying other ways to get this to work...For instance, using an Openfiledialog, I have it so that all you have to do is hit enter(once the actual showdialog occurs), but is there a way to 'hit enter' from the code to the openfiledialog box? That would be amazing! Any help would be much appreciated!
 
have you msgbox()'ed the path that you are trying to access? you will usually find out that where you think you are is not where you are. If you know where you are going, then why do you need the File Dialog?

-The answer to your problem may not be the answer to your question.
 
Well, that's why I said I was new(less than 2 months programming). I've never msgbox'd a path before, I'm guessing that's a debugging technique, but I don't see how I'd place a path in a message box. And I wouldn't be using a file dialog is I could get my reference to work. As I said before, the relative reference points to the file, it is right...it's something with the media player that I haven't figured out!
 
DOH... i need to quit jumping the gun, on what i am reading.

You still need an absolute path, but how you get that path is up to your code.

Try this:
Code:
MsgBox(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\") + 1) + "files\video.wmv")



MsgBox("["+Mediabox.URL.ToString"]")

-The answer to your problem may not be the answer to your question.
 
Amazing! I played around with it a bit and it's working! Thanks Alot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top