Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. Get hard disk spaces of windows mechine

Get hard disk spaces of windows mechine

Scheduled Pinned Locked Moved Hardware & Devices
csharpc++
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manoj753
    wrote on last edited by
    #1

    I need c++, VB or c# sample code to get free disk space and related info. If u have an idea please reply me!:((

    Manoj

    M 1 Reply Last reply
    0
    • M manoj753

      I need c++, VB or c# sample code to get free disk space and related info. If u have an idea please reply me!:((

      Manoj

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      In C++, call GetLogicalDrives or GetLogicalDriveStrings to find out the drive letters that are in use. You can then use GetDriveFreeSpaceEx to find out how much disk space is free. A complication is that in Windows 2000 and later, a volume can be mounted below another path and may not have a separate drive letter. If you decide to handle this, use FindFirstVolumeMountPoint etc. From C# and VB, if using .NET 2.0, use System.IO.DriveInfo.GetDrives to find out the drives available, and the properties of the returned DriveInfo objects to determine the free space available. For .NET 1.x, you have to either P/Invoke the C++ APIs mentioned above, or use WMI via the System.Management namespace to look for Win32_LogicalDisk objects.

      Stability. What an interesting concept. -- Chris Maunder

      realJSOPR 1 Reply Last reply
      0
      • M Mike Dimmick

        In C++, call GetLogicalDrives or GetLogicalDriveStrings to find out the drive letters that are in use. You can then use GetDriveFreeSpaceEx to find out how much disk space is free. A complication is that in Windows 2000 and later, a volume can be mounted below another path and may not have a separate drive letter. If you decide to handle this, use FindFirstVolumeMountPoint etc. From C# and VB, if using .NET 2.0, use System.IO.DriveInfo.GetDrives to find out the drives available, and the properties of the returned DriveInfo objects to determine the free space available. For .NET 1.x, you have to either P/Invoke the C++ APIs mentioned above, or use WMI via the System.Management namespace to look for Win32_LogicalDisk objects.

        Stability. What an interesting concept. -- Chris Maunder

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        Man, you went to a lot of trouble for nothing...

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups