?
Solved

Get description of drives on the computer

Posted on 2003-11-26
5
Medium Priority
?
219 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 375 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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