О/З CD-ROM'a

Самый простой способ открытия и закрытия CD-ROM'a

 #include <MMSystem.hpp>
...
bool CDROMOPEN;
...
TMCI_Open_Parms OpenParm;
TMCI_Generic_Parms GenParm;
TMCI_Set_Parms SetParm;
Cardinal DI;

OpenParm.dwCallback = 0;
OpenParm.lpstrDeviceType = "CDAudio";
mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE, int(&OpenParm));
DI = OpenParm.wDeviceID;
Sleep(1000);
if (!CDROMOPEN) {
        mciSendCommand(DI, MCI_SET, MCI_SET_DOOR_OPEN, int(&SetParm));
        CDROMOPEN = true;
        Button1->Caption="Закрыть CD-ROM";
        }
else {
        mciSendCommand(DI, MCI_SET, MCI_SET_DOOR_CLOSED, int(&SetParm));
        CDROMOPEN = false;
        Button1->Caption="Открыть CD-ROM";
        }
Sleep(1000);
mciSendCommand(DI, MCI_CLOSE, MCI_NOTIFY, int(&GenParm));
...
Скачать исходники!!!

 

Главная | Программирование 




Hosted by uCoz