Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #pragma comment( lib, "winmm.lib" )
  2.  
  3. #include <Windows.h>
  4. #include <mmsystem.h>
  5. #include<iostream>
  6.  
  7.  
  8. int main()
  9. {
  10. MCI_OPEN_PARMS mPar = { 0 };
  11. mPar.lpstrDeviceType = reinterpret_cast<LPCWSTR>(MCI_DEVTYPE_CD_AUDIO);
  12. mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID, (DWORD)&mPar);
  13. while (1)
  14. {
  15. mciSendCommand(mPar.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0);
  16.  
  17. // Close tray
  18. mciSendCommand(mPar.wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0);
  19. std::cout << ("\a");
  20. Sleep(200);
  21. }
  22.  
  23.  
  24. // Open device
  25.  
  26.  
  27. // Open tray
  28.  
  29.  
  30. // Close device
  31. mciSendCommand(mPar.wDeviceID, MCI_CLOSE, MCI_WAIT, 0);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement