| |

VerySource

 Forgot password?
 Register
Search
Author: cruzer

Super difficult question! How to judge whether it is a U disk according to the drive letter?

[Copy link]

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-19 17:00:02
| Show all posts
Write something up, look at the speed and see if there is data transmission on the usb port, ha ha, just talk about it
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-20 09:30:01
| Show all posts
This question seems to be as difficult as judging male or female based on their names
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-20 15:30:01
| Show all posts
Let the program be made into service, start up the monitoring function
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-20 20:15:01
| Show all posts
disksize:=0;
  for i:=99 to 122 do //'c'-'z';
    begin
      drive:=pchar(chr(i)+':\');
      x:=GetDriveType(drive);
      if x=3 then //3: The medium is a hard disk.
         begin
           GetDiskFreeSpaceEx(drive,userFreeBytes,totalBytes,@freeBytes);
           k:=1000000000;
           disksize:=totalBytes div k;
           ListItem:=ListView1.Items.Add;
           ListItem.Caption:=UpperCase(chr(i))+'drive';
           ListItem.SubItems.Add(Formatfloat('###,##0',disksize)+'G');
         end;
      if x=2 then //removable
         begin
           GetDiskFreeSpaceEx(drive,userFreeBytes,totalBytes,@freeBytes);
           disksize:=totalBytes div 1048576;

           ListItem:=ListView1.Items.add;
           ListItem.Caption:=UpperCase(chr(i))+'Removable Disk';
           ListItem.SubItems.Add(inttostr(disksize)+'M');
         end;
    end;
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list