发信人: delphifan()
整理人: delphifan(2000-12-05 19:52:59), 站内信件
|
检测驱动器类型 驱动器容量
当要知道所选的驱动器属于什么类型时,请看下面的程序
var x:integer;
driver:pchar;
begin
driver:='f:\';
x := GetDriveType(driver);
Case x of
2: Label1.Caption := '该驱动器是可移动驱动器';
3: Label1.Caption := '该驱动器是固定驱动器';
4: Label1.Caption := '该驱动器是网络驱动器';
5: Label1.Caption := '该驱动器是CD-ROM驱动器';
6: Label1.Caption := '该驱动器是虚拟驱动器';
Else Label1.Caption := '该驱动器无效';
End;
end;
驱动器容量
要得到驱动器的容量和剩余容量,用下面的程序
var
driver:pchar;
sec1, byt1, cl1, cl2:longword;
begin
driver:='c:\';//要显示的驱动器名
GetDiskFreeSpace(driver, sec1, byt1, cl1, cl2);
cl1 := cl1 * sec1 * byt1;
cl2 := cl2 * sec1 * byt1;
Label1.Caption := '该驱动器总共容量' + Formatfloat('###,##0',cl2) + '字 节';
Label2.Caption := '该驱动器可用容量' + Formatfloat('###,##0',cl1) + '字 节';
end;
-- =================================================
== [email protected] ==
== [一个真正有内容、较实用的Delphi网站] ==
== http://delphifan.wojia.com ==
== http://lmd.yeah.net http://lmd.126.com ==
=================================================
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.100.19.254]
|
|