zoukankan      html  css  js  c++  java
  • Delphi实现获取磁盘空间大小的方法

    unit Unit1;
    interface
    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls;
    type
    TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;
    var
    Form1: TForm1;
    implementation
    {$R *.DFM}
    procedure TForm1.Button1Click(Sender: TObject);
    var
    driver:pchar;
    sec1, byt1, cl1, cl2:longword;
    begin
    driver:=pchar(edit1.text);//要显示的驱动器名
    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;
    end.

  • 相关阅读:
    [luoguP2622] 关灯问题II(状压最短路)
    [luoguP2016] 战略游戏(DP)
    FileUpload
    Mysql -- JDBC
    Mysql优化
    Mysql锁
    Mysql索引
    Mysql事务
    Mysql基本语句
    Listener
  • 原文地址:https://www.cnblogs.com/blogpro/p/11446118.html
Copyright © 2011-2022 走看看