1. Home
  2. Computing & Technology
  3. Delphi Programming

By Zarko Gajic, About.com

Here's how to get the types of drives on your computer:

~~~~~~~~~~
//Note: you will need one button and
//one memo on your form, for this tip...
procedure TForm1.Button1Click(Sender: TObject) ;
var
  Drive: Char;
  DriveLetter: String[4];
begin
  for Drive := 'A' to 'Z' do
  begin
   DriveLetter := Drive + ':\';
   case GetDriveType(PChar(Drive + ':\')) of
    DRIVE_REMOVABLE:
     Memo1.Lines.Add(DriveLetter + ' Floppy Drive') ;
    DRIVE_FIXED:
     Memo1.Lines.Add(DriveLetter + ' Fixed Drive') ;
    DRIVE_REMOTE:
     Memo1.Lines.Add(DriveLetter + ' Network Drive') ;
    DRIVE_CDROM:
     Memo1.Lines.Add(DriveLetter + ' CD-ROM Drive') ;
    DRIVE_RAMDISK:
     Memo1.Lines.Add(DriveLetter + ' RAM Disk') ;
    end;
  end;
end;

~~~~~~~~~~

Delphi tips navigator:
» Setting Paradox password automatically
« Extract an icon from an Windows application and paint on a Form

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 1999 Delphi Tips
  7. Detecting Drive Types

©2009 About.com, a part of The New York Times Company.

All rights reserved.