Using this code, i almost always got to open the cd door, except when a few programs are playing (i.e.: MMJB):

retvalue = mciSendString("open CDAudio SHAREABLE", returnstring, 127, 0)
retvalue = mciSendString("Stop CDAudio", 127, 0)
retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0)
retvalue = mciSendString("close CDAudio", returnstring, 127, 0)

when MMJB is playing a cd audio, the first function returns 291 error:

MCIERR_MUST_USE_SHAREABLE 291

is there any other way to force open cd door, no matter which program is playing a cd?