Solved

Get description of drives on the computer

Posted on 2003-11-26
5
217 Views
Last Modified: 2010-04-05
I have a function that gives me all of the drives in the computer including the remote drives. I need a function that gives me it´s media type (FAT,FAT32,NTFS,etc), it´s path if it´s a remote drive, it´s volume label, and if possible it´s serial number.
0
Comment
Question by:barbalho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:TheLeader
ID: 9825576
0
 
LVL 17

Accepted Solution

by:
geobul earned 125 total points
ID: 9825622
Hi,

Use GetVolumeInformation API. All you need is there:

procedure DriveInfo(Drive: Char);
var
 x: integer;
 VSize, VFree: int64;
 VLabel, FSys: array[0..$FF] of char;
 SNr, FL, SysFlag: DWord;
begin
  if not(GetVolumeInformation(PChar(Drive+':\'), VLabel, SizeOf(VLabel), @SNr, FL, SysFlag, FSys, SizeOf(FSys)))
    then VLabel := '_None_';
  ShowMessage('VolumeLabel:'+VLabel);
  ShowMessage('FileSystem:'+string(FSys));
  ShowMessage('VolumeNumber:'+IntToStr(SNr));

  // VLabel  = Volume Label
 // SNr     = Serial Number
 // FL      = Max Filename Length
 // SysFlag = Volume Attributes
 // FSys    = File System (FAT / FAT32 / NTFS etc.)

 x := GetDriveType(PChar(Drive+':\'));
 // x       = TDriveType (See above)

 VSize := DiskSize(Ord(UpCase(Drive))-64);
 VFree := DiskFree(Ord(UpCase(Drive))-64);
 // VSize   = Volume Size
 // VFree   = Free space
end;

// usage:
DriveInfo('c');

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 9825629
Forgot this:

type
 TDriveType = (dtUnknown, dtNoDrive, dtFloppy, dtFixed, dtNetwork, dtCDROM, dtRAM);
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9825696
0
 
LVL 17

Expert Comment

by:geobul
ID: 9881636
May I ask you why I received a 'B' grade? You got full working code of what you'd asked for in less than an hour. What else could I have done for you?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question