荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: Peter (小飞侠), 信区: Program
标 题: How to tell what kind of drive is used
发信站: BBS 荔园晨风站 (Tue Jan 26 22:26:32 1999), 转信
Product: Delphi
Version: All
Platform: Windows/Win32
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;
--
※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.1.3]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店