Can't open MP3s with mciSendCommand

I have searched google and MSDN for hours trying to figure this out but it would seem my code is correct as every example I found was pretty much identical to mine.

This code is supposed to have automatic type selection according to MSDN. It works for wave files but for MP3 it returns error 277(MCIERR_INTERNAL). The only thing MSDN says about the error is to try restarting windows.

1
2
3
4
5
6
7
8
9
MCI_OPEN_PARMS op = {0};
op.lpstrElementName = Path;

MCIERROR ret = mciSendCommand(
      0, 
      MCI_OPEN, MCI_OPEN_ELEMENT, 
      reinterpret_cast<DWORD_PTR>(&op));

// ret is 277 

Another "solution" I found on another board where someone had a similar problem returns error 281(MCIERR_EXTENSION_NOT_FOUND). This doesn't even work for wave files.

1
2
3
4
5
6
7
8
MCI_OPEN_PARMS op = {0};
op.lpstrElementName = Path;
op.lpstrDeviceType = reinterpret_cast<LPWSTR>(MCI_ALL_DEVICE_ID);

MCIERROR ret = mciSendCommand(
      0, 
      MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID, 
      reinterpret_cast<DWORD_PTR>(&op));

Finally the most common example I found for opening MP3s, also returns error 277. For some reason it can open wave file just fine though:

1
2
3
4
5
6
7
8
MCI_OPEN_PARMS op = {0};
op.lpstrElementName = Path;
op.lpstrDeviceType = L"MPEGVideo";

MCIERROR ret = mciSendCommand(
      0, 
      MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE, 
      reinterpret_cast<DWORD_PTR>(&op));


Any ideas what the problem might be?
Topic archived. No new replies allowed.