Click to See Complete Forum and Search --> : MCI not playing certain files


Don Sandros
January 4th, 2009, 09:49 AM
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

javajawa
January 4th, 2009, 10:48 AM
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.

Don Sandros
January 4th, 2009, 10:59 AM
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...

dglienna
January 4th, 2009, 05:12 PM
Either 1) Rename the file, or 2) Copy the file somewhere with a NEW name, and open that file.

Don Sandros
January 5th, 2009, 10:09 AM
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...

javajawa
January 5th, 2009, 10:16 AM
What format is the file in? Does it have some form of DRM protection?

Marraco
January 5th, 2009, 03:30 PM
...
trytry
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.

Don Sandros
January 6th, 2009, 09:06 AM
What format is the file in? Does it have some form of DRM protection?

Thx, after saving the file again it worked :D 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...)

javajawa
January 6th, 2009, 02:01 PM
Legally, no. And We're all bound by the AUP here...