locked
get a list of all local drives? RRS feed

  • Question

  • Anyone know how to get a list of all local hard-disk partitions using c#.net and winforms?

    Directory.GetLogicalDrives() looks like a good start but that returns a list of all drives, including floppies, CD-ROMS and mapped drives. How can I separate these out from the local fixed drives?

    It must be possible because if you go to Start->Search in windows xp there's an option for 'Local Hard Drives (C:;D:;H:)' or whatever.
    Saturday, September 10, 2005 11:43 AM

Answers

  • answered own question. need to import win32 api function GetDriveType
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp

    example source code here:
    www.codeproject.com/csharp/cdrom.asp
    Sunday, September 11, 2005 12:25 AM