CDROM Spinup problems

Windows specific forum
Johan_Haegg
User
User
Posts: 60
Joined: Wed Apr 30, 2003 2:25 pm
Location: Västerås
Contact:

CDROM Spinup problems

Post 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?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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.
Johan_Haegg
User
User
Posts: 60
Joined: Wed Apr 30, 2003 2:25 pm
Location: Västerås
Contact:

Post 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)
Post Reply