-
January 4th, 2009, 10:49 AM
#1
MCI not playing certain files
Hi,
Im trying to create a Media Player in .NET, I use this code to open a file:
mciSendString("open " & filename & " alias music", 0, 0, 0)
and I get the filename with:
filename = Chr(34) & tbxFilename.Text & Chr(34)
But if I try to play a file with a ! or a ' in the name, it says there was a problem while initializing MCI.
Is there a way I can play these files or do I have to rename them?
Thx, Don
-
January 4th, 2009, 11:48 AM
#2
Re: MCI not playing certain files
I'm not certain exactly how that'd be fixed, but there's a chance that one of the two standard escaping methods will work: \[CHAR] or %(HEX VALUE). E.g: %20 = ' ', "\"Hello" = "Hello
Also, If you're interested, I did a lot of work on a similar project a couple of years ago - PM me if you to have some of the source code.
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
-
January 4th, 2009, 11:59 AM
#3
Re: MCI not playing certain files
Hmm, I can't get it to work by %21 or \!
Hmm, it seems it just can't play certain songs, I found a song with a ' in it and worked...
Last edited by Don Sandros; January 4th, 2009 at 01:20 PM.
-
January 4th, 2009, 06:12 PM
#4
Re: MCI not playing certain files
Either 1) Rename the file, or 2) Copy the file somewhere with a NEW name, and open that file.
-
January 5th, 2009, 11:09 AM
#5
Re: MCI not playing certain files
I tried renaming the file manually and then playing it, but this doesn't solve the problem. I just found out it has nothing to do with the filename...
-
January 5th, 2009, 11:16 AM
#6
Re: MCI not playing certain files
What format is the file in? Does it have some form of DRM protection?
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
-
January 5th, 2009, 04:30 PM
#7
Re: MCI not playing certain files
Originally Posted by Don Sandros
...
try
Code:
try
filename = """" & tbxFilename.Text & """"
mciSendString("open " & filename & " alias music", 0, 0, 0)
catch ex as exception
msgbox (ex.message)
end try
and tell what was the message error. It should give a clue on why it fails.
[Vb.NET 2008 (ex Express)]
-
January 6th, 2009, 10:06 AM
#8
Re: MCI not playing certain files
Originally Posted by javajawa
What format is the file in? Does it have some form of DRM protection?
Thx, after saving the file again it worked So I think they were DRM protected
(Is it possible to remove DRM with some kind of quick tool? Saving all my mp3's again will take lots of time and will reduce the quality of the sound...)
-
January 6th, 2009, 03:01 PM
#9
Re: MCI not playing certain files
Legally, no. And We're all bound by the AUP here...
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|