Last active
November 4, 2018 03:33
-
-
Save MarkKoz/0735d5ef3acbd8b7b5802f7f62e1702a to your computer and use it in GitHub Desktop.
MCI CD Drive Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#include <Windows.h> | |
#include <mmsystem.h> | |
#include <iostream> | |
int main() | |
{ | |
MCI_OPEN_PARMS open_params; | |
::ZeroMemory(&open_params, sizeof(MCI_OPEN_PARMS)); | |
open_params.lpstrDeviceType = reinterpret_cast<LPCSTR>(MCI_DEVTYPE_CD_AUDIO); | |
open_params.lpstrElementName = "I:"; | |
const DWORD flags = MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE; | |
if (!mciSendCommand(0, MCI_OPEN, flags, reinterpret_cast<DWORD>(&open_params))) | |
{ | |
MCI_STATUS_PARMS status_params; | |
::ZeroMemory(&status_params, sizeof(MCI_STATUS_PARMS)); | |
status_params.dwItem = MCI_STATUS_MODE; | |
mciSendCommand(open_params.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, reinterpret_cast<DWORD>(&status_params)); | |
mciSendCommand(open_params.wDeviceID, MCI_CLOSE, MCI_WAIT, 0); | |
std::cout << status_params.dwReturn << '\n'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment