Wednesday, January 5, 2011

How to tell what kind of drive is used

{
When dealing with multiple drives, it is helpful to know
whether a drive is associated with a is attached to a letter
(A, B, C, etc), and what its type is. This code uses the API
GetDriveType function to do that. }
function ShowDriveType(DriveLetter: char): string;var
i: word;begin
if
DriveLetter in ['A'..'Z'] then {Make it lower case.}
DriveLetter := chr(ord(DriveLetter) + $20);
i := GetDriveType(ord(DriveLetter) - ord('a'));
case i of
DRIVE_REMOVABLE: result := 'floppy';
DRIVE_FIXED: result := 'hard disk';
DRIVE_REMOTE: result := 'network drive';
else result := 'does not exist';
end;end;

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum