Page 1 of 1

CDROM Spinup problems

Posted: Fri Mar 05, 2004 10:26 pm
by Johan_Haegg
Windows 2000, writeing a program that will sense if there is a CDROM in a specific drive and then try to read a file from it. For detection i use this code:

Code: Select all

Procedure WaitForCD()
  Debug "WaitForInsert"
  If CDAudioStatus() = -1
    Repeat
      CheckQ()
      Delay(300)
    Until CDAudioStatus() = 0
  EndIf
EndProcedure
When i start the program with the CD in the drive, it works like a charm, i can eject and then insert the CD and it works. BUT if i start without the CD, the drive will not go through the spinup process.

Question:
Is it possible to force a spinup?

Posted: Fri Mar 05, 2004 11:07 pm
by Dare2
Hi Johan, this might not be much help, but if you have access to the SDK, or via MSDN:

http://msdn.microsoft.com/library/defau ... string.asp

You can do something with api calls like (don't use these egs!)

mciSendString_("open cdaudio",a$,0,0)
mciSendString_("Open cdaudio alias MyCDAudio",a$,0,0)

etc.

There are commands to play, stop, track, etc. Best check out the actual options. Maybe this helps start the spinning.

Posted: Sat Mar 06, 2004 12:41 am
by Johan_Haegg
Thanks for pointing me in the right direction...
This code will NOT screw up the CDROM

Code: Select all

  mciOpenParms.MCI_OPEN_PARMS
  mciStatus.MCI_STATUS_PARMS
  a.s = "cdaudio"
  mciOpenParms\lpstrDeviceType = @a.s
  dwReturn = mciSendCommand_(0, #MCI_OPEN, #MCI_OPEN_TYPE, mciOpenParms)
  wDeviceID = mciOpenParms\wDeviceID 
  mciStatus\dwItem = #MCI_STATUS_MEDIA_PRESENT
  Repeat
    mciSendCommand_(wDeviceID, #MCI_STATUS, #MCI_WAIT | #MCI_STATUS_ITEM, mciStatus)
    Delay(100)
    CheckQ()
  Until mciStatus\dwReturn = 1
  mciSendCommand_(wDeviceID, #MCI_CLOSE, 0, 0)