Get drive capacity

Source: Internet
Author: User

Unit unit1;

Interface

Uses
Windows, messages, sysutils, variants, classes, graphics, controls, forms,
Dialogs, stdctrls, filectrl;

Type
Tform1 = Class (tform)
Drivecombox1: 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) + 'byte ';
Edit2.text: = formatfloat ('###,## 0', freebytes) + 'byte ';
End;

End.

 

Form

Object form1: tform1
Left = 1, 192
Maximum = 107
Width = 216
Height = 155
Caption = 'drives'
Color = clbtnface
Font. charset = default_charset
Font. Color = clwindowtext
Font. Height =-13
Font. Name = 'Ms sans serif'
Font. Style = []
Oldcreateorder = false
Pixelsperinch = 96
Textheight = 16
Object label1: tlabel
Left = 8
Top = 56
Width = 57
Height = 16
Autosize = false
Caption = #24635 #23481 #37327 ':'
End
Object label2: tlabel
Left = 8
Top = 88
Width = 73
Height = 16
Autosize = false
Caption = #21097 #20313 #23481 #37327 ':'
End
Object drivecombox1: tdrivecombobox
Left = 8
Top = 16
Width = 193
Height = 22
Taborder = 0
Onchange = drivecombobox1change
End
Object edit1: tedit
Left = 80
Top = 48
Width = 121
Height = 24
Taborder = 1
TEXT = 'edit1'
End
Object edit2: tedit
Left = 80
Top = 80
Width = 121
Height = 24
Taborder = 2
TEXT = 'edit1'
End
End

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.