1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| var DriveList : TStringList; LWCount : byte;
function GetDrives(DriveType:integer):byte; var Drives : array [1..255] of char; LWListe : TStringList; i : byte; Len : DWord; begin LWListe:=TStringList.Create; Len:=GetLogicalDriveStrings(255,@Drives); for i:=1 to Len-2 do if (i mod 4)=1 then LWListe.Add(copy(Drives,i,3)); Result:=0; DriveList.Clear; for i:=0 to LWListe.Count-1 do begin if GetDriveType(PChar(LWListe[i]))=DriveType then begin Result:=Result+1; DriveList.Add(copy(LWListe[i],1,2)) end; end; LWListe.Destroy; end;
DriveList:=TStringLIst.Create;
LWCount:=GetDrives(DRIVE_REMOVABLE);
LWCount:=GetDrives(DRIVE_FIXED);
LWCount:=GetDrives(DRIVE_REMOTE);
LWCount:=GetDrives(DRIVE_CDROM);
LWCount:=GetDrives(DRIVE_RAMDISK);
DriveList.Free; |