MCI: MCI_CLOSE needed if the CD has been ejected?

David L 161 Reputation points
2021-02-17T09:47:11.747+00:00

Hello

I have read that sending MCI_CLOSE command is important to get access again to the device later on.

If I handle the CD player opening message DBT_DEVICEREMOVECOMPLETE, check that this is the right player (in case there are several ones) and then try to send the "mciSendCommandW(deviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&mgp);" (deviceID is the same than the one I used successfully for MCI_PLAY), I get a "0xC0000008: An invalid handle was specified" exception.

Does the ejection close the device on its own before sending DBT_DEVICEREMOVECOMPLETE ?

Thanks
David

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,428 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. David L 161 Reputation points
    2021-02-17T18:46:29.417+00:00

    I'm going to look at that. Thanks a lot for your time.

    0 comments No comments