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

By , About.com Guide

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

Explore Delphi Programming
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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

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

All rights reserved.