It can be done with MCI (Multimedia Command Strings): mciSendCommand, mciSendString and other API functions.
Communication with MCI Deviceshttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_communication_with_mci_devices.aspVFP example (members area):
Accessing a CD device (cdaudio) with Multimedia Command Stringshttp://www.news2news.com/vfp/?example=279&function=435Some MCIs:
set cdaudio door open wait
set cdaudio door closed wait
open cdaudio shareable
stop cdaudio wait
close cdaudio
capability cdaudio can eject
capability cdaudio can play
capability cdaudio can record
capability cdaudio can save
capability cdaudio compound device
info cdaudio identity
info cdaudio upc
status cdaudio current track
status cdaudio length
status cdaudio media present
status cdaudio mode
spin cdaudio down
spin cdaudio up
play cdaudio from 2
pause cdaudio wait
resume cdaudio wait