A problem occurred in initializing MCI

1461 views
Skip to first unread message

Gordon

unread,
Sep 17, 2003, 11:41:20 PM9/17/03
to
I've been using mciSendString Lib "winmm.dll" forever and all of sudden it
stopped playing MP3s. I keep on getting the same error and no playback: A
problem occurred in initializing MCI.

Any help is greatly appreciated.


John Eikanger [MSFT]

unread,
Sep 18, 2003, 5:17:43 PM9/18/03
to
Hi, Gordon

Did the problem occur on the same machine, or when your ran the application
on a different machine?

I spoke to the tech lead of our multimedia team, and he suggested that you
check to see if the file mciqtz.dll is on your system. If not, you should
download the latest media player from Windows Update, which should correct
the problem. If not, please reply here with more information and I will
expedite.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
"Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security."
--------------------
| From: "Gordon" <jg...@hotmail.com>
| Subject: A problem occurred in initializing MCI
| Date: Wed, 17 Sep 2003 20:41:20 -0700
| Lines: 7
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <estMMbZf...@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.win32.programmer.mmedia
| NNTP-Posting-Host: adsl-67-124-193-163.dsl.sndg02.pacbell.net
67.124.193.163
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.win32.programmer.mmedia:1963
| X-Tomcat-NG: microsoft.public.win32.programmer.mmedia

Gordon

unread,
Sep 20, 2003, 3:27:36 PM9/20/03
to
Hi,

Same machine.
I performed a search for "mciqtz.dll" and it couldn't be found. I did a
Windows Update and re-installed wmp 9, and still, file "mciqtz.dll" could
not be found.

Thanks

"John Eikanger [MSFT]" <joh...@online.microsoft.com> wrote in message
news:Yy91Upif...@cpmsftngxa06.phx.gbl...

John Eikanger [MSFT]

unread,
Sep 22, 2003, 2:29:27 PM9/22/03
to
Hi, Gordon

My mistake. I should have typed mciqtz32.dll, not mciqtz.dll.

I apologize for my error. I assume that updating MP9 did not resolve the
problem.

I was not able to reach my MM contact. I will keep trying and let you know
what he says.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
"Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security."

--------------------
| From: "Gordon" <jg...@hotmail.com>
| References: <estMMbZf...@TK2MSFTNGP09.phx.gbl>
<Yy91Upif...@cpmsftngxa06.phx.gbl>
| Subject: Re: A problem occurred in initializing MCI
| Date: Sat, 20 Sep 2003 12:27:36 -0700
| Lines: 64


| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

| Message-ID: <ugt4G16f...@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.win32.programmer.mmedia
| NNTP-Posting-Host: adsl-66-122-237-175.dsl.sndg02.pacbell.net
66.122.237.175
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.win32.programmer.mmedia:1989
| X-Tomcat-NG: microsoft.public.win32.programmer.mmedia

John Eikanger [MSFT]

unread,
Sep 23, 2003, 4:22:56 PM9/23/03
to
Hi, Gordon

I have created an escalation and assigned it to the tech lead of the MM
team. He should respond to your issue here. If you do not receive a
response by close of business, Pacific time, on Wednesday, please post here
and I will expedite.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
"Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security."
--------------------
| From: "Gordon" <jg...@hotmail.com>

| References: <estMMbZf...@TK2MSFTNGP09.phx.gbl>
<Yy91Upif...@cpmsftngxa06.phx.gbl>
| Subject: Re: A problem occurred in initializing MCI
| Date: Sat, 20 Sep 2003 12:27:36 -0700
| Lines: 64

| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

| Message-ID: <ugt4G16f...@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.win32.programmer.mmedia
| NNTP-Posting-Host: adsl-66-122-237-175.dsl.sndg02.pacbell.net
66.122.237.175

| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.win32.programmer.mmedia:1989
| X-Tomcat-NG: microsoft.public.win32.programmer.mmedia

Sameer Murudkar

unread,
Sep 24, 2003, 2:51:21 AM9/24/03
to
Hi Gordon,

1. What OS do you see the problem on?
2. What is the version and date of mciqtz32.dll on your system?
3. You mentioned that this used to work on your system. Do you recall any
changes you made that might have caused the MP3 playback to fail?

I am including a MCI sample that plays MP3 files. Can you run this on you
system and let me know if it works or not. The MP3 file name is hardcode in
the call mciPlayMP3.

Thanks,
Sameer Murudkar
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
"Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security."


// MCIPlayMP3.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "resource.h"
#include "mmsystem.h"

DWORD mciPlayMP3(HWND hWndNotify, LPSTR lpszWAVEFileName, DWORD *);
#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text

// Foward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
DWORD playWAVEFile(HWND hWndNotify, LPSTR lpszWAVEFileName);

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;

// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_MCIPLAYMP3, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);

// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MCIPLAYMP3);

// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return msg.wParam;
}

//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage is only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this
function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;

wcex.cbSize = sizeof(WNDCLASSEX);

wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MCIPLAYMP3);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCSTR)IDC_MCIPLAYMP3;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

return RegisterClassEx(&wcex);
}

//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global
variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;

hInst = hInstance; // Store instance handle in our global variable

hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

if (!hWnd)
{
return FALSE;
}

ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

return TRUE;
}

//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
TCHAR szHello[MAX_LOADSTRING];
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
DWORD dwDeviceId = 0;

switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
//DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
mciPlayMP3(hWnd, "D:\\cases\\piano.mp3", &dwDeviceId );
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
RECT rt;
GetClientRect(hWnd, &rt);
DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;
case MM_MCINOTIFY :
mciSendCommand(dwDeviceId, MCI_CLOSE, 0, NULL);
break;

case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;

case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

DWORD mciPlayMP3(HWND hWndNotify, LPSTR lpszWAVEFileName, DWORD* dwDevId)
{
UINT wDeviceID;
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;

// Open the device by specifying the device and filename.
// MCI will choose a device capable of playing the specified file.

mciOpenParms.lpstrDeviceType = "mpegvideo";
mciOpenParms.lpstrElementName = lpszWAVEFileName;
if (dwReturn = mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD)(LPVOID) &mciOpenParms))
{
// Failed to open device. Don't close it; just return error.
return (dwReturn);
}

// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;

// Begin playback. The window procedure function for the parent
// window will be notified with an MM_MCINOTIFY message when
// playback is complete. At this time, the window procedure closes
// the device.

mciPlayParms.dwCallback = (DWORD) hWndNotify;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
(DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}

return (0L);
}


Gordon

unread,
Sep 25, 2003, 9:16:00 AM9/25/03
to
I don't know VC, I tried pasting the code you provided in a VC project but
couldn't get it to compile.
Do you have a VB Sample?

Thanks
.
"Sameer Murudkar" <email7...@microsoft.com> wrote in message
news:dds5Ghmg...@cpmsftngxa06.phx.gbl...

Gordon

unread,
Sep 28, 2003, 9:03:13 PM9/28/03
to
Still not working

---------------------------
Project1
---------------------------
Invalid MCI device ID. Use the ID returned when opening the MCI device.
---------------------------
OK
---------------------------

"Sameer Murudkar" <email7...@microsoft.com> wrote in message

news:3MonCC7g...@cpmsftngxa06.phx.gbl...
> Hi Gordon,
>
> Attached is the VB code to play an MP3 file using MCI. Note that the file
> name is hardcode in
> mciOpenParms.lpstrElementName = "D:\cases\piano.mp3"
>
> The zip file containing the project is also attached.


>
> Thanks,
> Sameer Murudkar
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Microsoft highly recommends to all of our customers that they visit the
> http://www.microsoft.com/protect site and perform the three
straightforward
> steps listed to improve your computer's security."
>
>
>

> Option Explicit
> Dim wDeviceID As Integer
>
> Private Sub Form_Unload(Cancel As Integer)
> Dim dwReturn As Double
> dwReturn = mciSendCommand(wDeviceID, MCI_CLOSE, 0, Null)
> End Sub
>
> Private Sub Command1_Click()
>
> Dim dwReturn As Double
> Dim mciOpenParms As MCI_OPEN_PARMS
> Dim mciPlayParms As MCI_PLAY_PARMS
> Dim msg As String * 300
>
>
> 'Open the device by specifying the device and filename.
> 'MCI will choose a device capable of playing the
> specifiedmciPlayParms.dwCallback = (DWORD) hWndNotify; file.
>
> wDeviceID = 0
> mciOpenParms.lpstrDeviceType = "mpegvideo"
> mciOpenParms.lpstrElementName = "D:\cases\piano.mp3"
> dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE Or
> MCI_OPEN_ELEMENT, _
> mciOpenParms)
>
> If (dwReturn <> NO_ERROR) Then
> dwReturn = mciSendCommand(wDeviceID, MCI_CLOSE, 0, Null)
> mciGetErrorString dwReturn, msg, Len(msg)
> MsgBox msg
> End If
>
>
> wDeviceID = mciOpenParms.wDeviceID
> dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, 0, 0)
> If (dwReturn <> NO_ERROR) Then
> mciGetErrorString dwReturn, msg, Len(msg)
> MsgBox msg
> End If
>
> End Sub
>
>


Sameer Murudkar

unread,
Sep 30, 2003, 8:45:37 PM9/30/03
to
Hi Gordon,

Can you provided more details as to which call failed. Was the sound device
being used by any other process when this call was made.

I still haven't received a reponse from you to my original questions. I am
including them below once again. Kindly let me know the answers to the
questions below

1. What OS do you see the problem on?
2. What is the version and date of mciqtz32.dll on your system?
3. You mentioned that this used to work on your system. Do you recall any
changes you made that might have caused the MP3 playback to fail?

Thanks,

Chris Haag

unread,
Oct 19, 2003, 1:00:44 AM10/19/03
to
The following C code works when I want to play an mp3 from
disk:

mciSendString("open my.mp3 type mpegvideo alias test" ...);
mciSendString("play test" ...);


But it fails if I try this:

mmioInstallIOProc(mmioFOURCC('M', 'E', 'Y', ' '),
(LPMMIOPROC)IOProc, MMIO_INSTALLPROC | MMIO_GLOBALPROC);
mciSendString("open test.MEY+ type mpegvideo alias
test" ...);
mciSendString("play test" ...)

IOProc is the exact same as defined in article 155360 from
the KB, and I made sure to assign the file data and size
in the globals used in the example. I put a breakpoint at
the very beginning of IOProc, and it was never hit in the
debugger. It will stop at the breakpoint; however, if I
change "mpegvideo" to "avivideo".


Any ideas?

ston...@telusplanet.net

unread,
Jul 16, 2016, 11:35:53 AM7/16/16
to
My player gets the same error if there is an embedded jpg.

Who on Earth had that idea?

I'll make some changes to identify those files and convert them so there is no JPG.


Reply all
Reply to author
Forward
0 new messages