瑞文文摘
返回首页 | 手机用户请点此访问手机版
关键字:delphi源码 | 时间:2012/9/24

【delphi源码】获取驱动器的容量信息

获取驱动器容量信息的delphi源码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;
type
TForm1 = class(TForm)
DriveComboBox1: TDriveComboBox;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
procedure DriveComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DriveComboBox1Change(Sender: TObject);
var
driver:Char;
userFreeBytes,totalBytes,freeBytes:Int64;
begin
driver:=self.DriveComboBox1.Drive;
GetDiskFreeSpaceEx(PChar(driver+':\'),userFreeBytes,totalBytes,@freeBytes);
Edit1.Text:=Formatfloat('###,##0',totalBytes)+'字节';
Edit2.Text:=Formatfloat('###,##0',freeBytes)+'字节';
end;
end.




上一篇:【delphi源码】删除文件到回收站

下一篇:同课异构 感触颇丰

Copyright © 瑞文软件工作室 冀ICP备17033643号 联系我们