Ejecting CDRom Drive without hardcoding drive letter using Win32 Visual C++
问题 I am trying to eject my CDRom Drive at the click of a button. This works when the CDRom drive letter is hardcoded, but I am wanting to do it without hardcoding the CDRom Drive. If I find the CDRom drive on my computer and save it to 'TCHAR drive_letter', how can I pull that in to the code below? For some reason, it does not allow me to do 'EjectCdTray(drive_letter);'. The code is shown below: #include <tchar.h> #include <windows.h> #include <mmsystem.h> // for MCI functions // Link to winmm