Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- ListBox1: TListBox;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- DriveNum: Integer;
- DriveChar: Char;
- DriveBits: set of 0..25;
- DriveType: Integer;
- begin
- Integer(DriveBits) := GetLogicalDrives;
- for DriveNum := 0 to 25 do
- begin
- if not (DriveNum in DriveBits) then
- begin
- Continue;
- end;
- DriveChar := UpCase(Char(DriveNum + Ord('a')));
- DriveType := GetDriveType(PChar(DriveChar +':\'));
- case DriveType of
- DRIVE_REMOVABLE: ListBox1.Items.Add(DriveChar + ': Disco Flexível');
- DRIVE_FIXED: ListBox1.Items.Add(DriveChar + ': Disco Fixo');
- DRIVE_REMOTE: ListBox1.Items.Add(DriveChar + ': Network Volume');
- DRIVE_CDROM: ListBox1.Items.Add(DriveChar + ': CD-ROM');
- DRIVE_RAMDISK: ListBox1.Items.Add(DriveChar + ': RAM');
- end;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement