(Gast)
n/a Beiträge
|
Re: Number of disks?
23. Aug 2007, 20:03
Delphi-Quellcode:
Procedure TForm1.GetHDDcount (Sender: TObject);
var f, i: integer;
begin
i := 0;
repeat
f := FileOpen('\\.\PHYSICALDRIVE' + IntToStr(i), fmOpenRead or fmShareDenyNone);
if f = -1 then break;
// Listbox1.Items.Add('PHYSICALDRIVE'+IntToStr(i));
inc (i);
until false;
HDDcount1.Caption := IntToStr(i)+' HDD';
end;
// or
function GetHDDCount: integer;
var f, i: integer;
begin
i := 0;
repeat
f := FileOpen('\\.\PHYSICALDRIVE' + IntToStr(i), fmOpenRead or fmShareDenyNone);
if f = -1 then break;
inc (i);
until false;
result := i;
end;
|
|
Zitat
|