Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma comment( lib, "winmm.lib" )
- #include <Windows.h>
- #include <mmsystem.h>
- #include<iostream>
- int main()
- {
- MCI_OPEN_PARMS mPar = { 0 };
- mPar.lpstrDeviceType = reinterpret_cast<LPCWSTR>(MCI_DEVTYPE_CD_AUDIO);
- mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID, (DWORD)&mPar);
- while (1)
- {
- mciSendCommand(mPar.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0);
- // Close tray
- mciSendCommand(mPar.wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0);
- std::cout << ("\a");
- Sleep(200);
- }
- // Open device
- // Open tray
- // Close device
- mciSendCommand(mPar.wDeviceID, MCI_CLOSE, MCI_WAIT, 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement