December 6th, 2012, 04:06 PM
Weird error with mciSendString when trying to open certain mp3-files
Hi! This is my first post on this forum, though I've been here quite a lot in search of answers to my problems and find these forums very helpful, but this problem I can't seem to find any solution to anywhere, so I hope you guys will be able to help me
I'm in the progress of making an Mp3-player and I'm receiving a weird error. Well, I'm not actually receiving an error message, the program just closes. I have this code:
This is pretty straightforward, and it works with most files, but with some the application just closes. I have no idea why, but common for the files that don't work is that if I open the "Properties"-window for said files in Windows Explorer they don't show any data in the "Details"-tab and I can't edit them, although they do actually contain ID3-data, cause the application finds it using TagLib Sharp. I should mention that I tried changing the Target Platform from x86 to x64 and that almost fixed it; the program didn't close and the song seemed to start, only I didn't hear any sound. Also, I'm running Windows 7 Enterprise SP1 x64.
private string _command = "close MediaFile";
private bool isOpen = false;
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public void Open(string fileName)
_command = "open \"" + fileName + "\" type MPEGVideo alias CurrentSong";
mciSendString(_command, null, 0, IntPtr.Zero);
sOpen = true;
Anyone have any idea how to fix this?
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.