SDL: Enumerating CDROM Drives

Started by José Roca, July 27, 2008, 10:21:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca

 
The following example enumerates the CDROM drives installes in your computer.


#COMPILE EXE
#DIM ALL
#INCLUDE "SDL.INC"

FUNCTION PBMAIN () AS LONG

   ' Initialize SDL
   IF SDL_Init(%SDL_INIT_CDROM) < 0 THEN
      ? "Couldn't initialize SDL" & SDL_GetError
      #IF %DEF(%PB_CC32)
         WAITKEY$
      #ENDIF
      EXIT FUNCTION
   END IF

   ' Find out how many CD-ROM drives are connected to the system
   LOCAL nDrives AS LONG
   LOCAL i AS LONG

   nDrives = SDL_CDNumDrives
   FOR i = 0 TO nDrives - 1
      ? "Drive" & STR$(i) & " " & SDL_CDName(i)
   NEXT

   ' Shut down SDL
   SDL_Quit

   #IF %DEF(%PB_CC32)
      WAITKEY$
   #ENDIF

END FUNCTION

  •