4

This is what I did:

DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
mciOpenParms.lpstrDeviceType = _T("MPEGvideo");
mciOpenParms.lpstrElementName = m_tmpFileName;

dwReturn = mciSendCommand(NULL, MCI_OPEN,
                  MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
                 (DWORD)(LPVOID) &mciOpenParms);
    if (dwReturn)
    {
        wchar_t chError[100];
        mciGetErrorString(dwReturn,chError,sizeof(chError));
        //report the error here
    }

When I run the code, I see that dwReturn is 266 and chError is set to "Unknown problem while loading the specified device driver". What could be wrong?

Note: I also tried "mpegvideo" instead of "MPEGvideo"; it didn't help. Where are these things documented anyway?

Plumenator
  • 1,682
  • 3
  • 20
  • 49

2 Answers2

1

It works for me. Maybe (likely) you have the MCI register all screwed up. Or maybe the file you are opening is corrupted somehow.

As far as I know these device names are not documented anywhere. But you can find the ones configured in your system in the registry: HKLM\Software\Microsoft\Windows NT\CurrentVersion\MCI32. My system has:

  • AVIVideo
  • CDAudio
  • MPEGVideo
  • Sequencer
  • WaveAudio

And given that the MCI is not used much nowadays, I'd say that they are pretty standard.

rodrigo
  • 94,151
  • 12
  • 143
  • 190
  • Actually, the file plays fine in Windows Media Player, even the classic one. – Plumenator Aug 22 '11 at 09:12
  • If it helps, there are other people who report the same problem: http://www.google.co.in/search?q=%22Unknown+problem+while+loading+the+specified+device+driver%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a – Plumenator Aug 22 '11 at 09:14
  • I'd say that it may depend on the codecs you have installed in your machine. Can you post the contents of the registry keys I cited? – rodrigo Aug 22 '11 at 09:48
  • I also noticed that this project does work on my system: http://www.codeproject.com/KB/audio-video/MP3Example.aspx?fid=321701&fr=26 . It's a C# project, but uses mciSendString() (I use mciSendCommand()). – Plumenator Aug 22 '11 at 10:04
  • What I wanted to see was the contents of these registry keys. You linking with winmm.lib, aren't you? I don't think that you can get that wrong. – rodrigo Aug 22 '11 at 10:26
  • LOL, yea, I am. Here goes: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32] "AVIVideo"="mciavi32.dll" "CDAudio"="mcicda.dll" "Sequencer"="mciseq.dll" "WaveAudio"="mciwave.dll" "MPEGVideo"="mciqtz32.dll" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MCI32\Terminal Server] "MCICDA.DLL"="" – Plumenator Aug 22 '11 at 10:43
  • Just the same. Now, it looks like mciqtz32.dll uses the installed DirectShow filters to open the file. So maybe there is an issue with any of your MP3 DirectShow codec. But that's quite difficult to say... – rodrigo Aug 22 '11 at 10:54
1

If you're specifying MCI_OPEN_ELEMENT then mciOpenParms.lpstrDeviceType must be null.

See the Remarks section.

*To use automatic type selection (via the entries in the registry), assign the filename and file extension to the lpstrElementName member of the structure identified by lpOpen, set the lpstrDeviceType member to NULL, and set the MCI_OPEN_ELEMENT flag.*

Carey Gregory
  • 6,836
  • 2
  • 26
  • 47