Getting Volume Name

  • Thread starter Thread starter Jeff Gaines
  • Start date Start date
J

Jeff Gaines

I am using the 'ManagementObject' to get the volume name of each drive
on my PC. It works but it is a bottleneck.

Is there an quicker way to get this information? I am using C# but am
happy yo make API calls.

I have tried the API call 'GetVolumeInformation' which returns the
drive letter rather than the volume name and also another function
(name forgotten) which returned a string that looked like it might be
the volume 'unique' number allocated by formatting a drive.

The VB function 'Dir' looks like it might work but I have been unable
to get to it from C#.

Any help appreciated.
 
GetVolumeInformation returns the path, the volume name, and the serial
number as well as some other data.
-mike
MVP
 
Michael

Thanks for your response, I made a mess of the DLL prototype (why
aren't they built in to a 'C' based language) and all is well now.


GetVolumeInformation returns the path, the volume name, and the serial
number as well as some other data.
-mike
MVP
 
ManagementObject should be (almost) as fast as 'GetVolumeInformation' API call as it uses the same API.
What OS are you running, and how does your code looks like?

Willy.
 
Back
Top