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

习题答案
考试通关必备网站

【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源码】获取驱动器的容量信息

我来解答

匿名发表
  • 验证码: