Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/21/d38531796/htdocs/jose/smfforum/Sources/Subs.php on line 3825
SDL: Enumerating CDROM Drives

Author Topic: SDL: Enumerating CDROM Drives  (Read 2580 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2487
  • User-Rate: +204/-0
SDL: Enumerating CDROM Drives
« on: July 27, 2008, 10:21:28 PM »
 
The following example enumerates the CDROM drives installes in your computer.

Code: [Select]
#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
« Last Edit: August 07, 2011, 08:07:56 PM by José Roca »