Announcement

Collapse
No announcement yet.

Determining if Removeable Media and Type?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Determining if Removeable Media and Type?

    Is there a way to determine whether a drive is a floppy, CD-Rom, Zip drive, hard drive, ect?

    Thanks
    -Mike

    ------------------

  • #2
    The Win32API call you need is found in the PowerBasic winapi.inc which has the following entries

    (I looked in Petzolds for the pure Win32API call but couldn't locate it.)

    DECLARE FUNCTION GetDriveType LIB "KERNEL32.DLL" ALIAS "GetDriveTypeA" (nDrive AS ASCIIZ) AS LONG

    with the following constants

    %DRIVE_UNKNOWN = 0
    %DRIVE_NO_ROOT_DIR = 1
    %DRIVE_REMOVABLE = 2
    %DRIVE_FIXED = 3
    %DRIVE_REMOTE = 4
    %DRIVE_CDROM = 5
    %DRIVE_RAMDISK = 6


    I havent used this in any code yet so I dont know how to further identify the particular removable type. Maybe the following call

    DECLARE FUNCTION DeviceIoControl LIB "KERNEL32.DLL" ALIAS "DeviceIoControl" (BYVAL hDevice AS LONG, BYVAL dwIoControlCode AS LONG, lpInBuffer AS ANY, BYVAL nInBufferSize AS LONG, lpOutBuffer AS ANY, BYVAL nOutBufferSize AS LONG, _
    lpBytesReturned AS LONG, lpOverlapped AS OVERLAPPED) AS LONG
    %IOCTL_STORAGE_GET_MEDIA_TYPES = &H00ED0000???

    My Don Applemans WIN32API book talks about (page 1023 -1028) about the various options available when using this call and particularly to an option....Determine the types of media supported by a drive. This might not have the granuality you need.

    Hope I havent confused any more than what you were when you posted your message.
    Barney

    ------------------




    [This message has been edited by Barney Winton (edited August 18, 2000).]

    Comment


    • #3
      Thanks Barney. This helps alot.
      -Mike

      ------------------

      Comment


      • #4
        you might want to check out

        hth,
        --bob

        ------------------
        "It was too lonely at the top".

        Comment

        Working...
        X