Get hard disk spaces of windows mechine
-
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
In C++, call
GetLogicalDrives
orGetLogicalDriveStrings
to find out the drive letters that are in use. You can then useGetDriveFreeSpaceEx
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, useFindFirstVolumeMountPoint
etc. From C# and VB, if using .NET 2.0, useSystem.IO.DriveInfo.GetDrives
to find out the drives available, and the properties of the returnedDriveInfo
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 theSystem.Management
namespace to look forWin32_LogicalDisk
objects.Stability. What an interesting concept. -- Chris Maunder
-
In C++, call
GetLogicalDrives
orGetLogicalDriveStrings
to find out the drive letters that are in use. You can then useGetDriveFreeSpaceEx
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, useFindFirstVolumeMountPoint
etc. From C# and VB, if using .NET 2.0, useSystem.IO.DriveInfo.GetDrives
to find out the drives available, and the properties of the returnedDriveInfo
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 theSystem.Management
namespace to look forWin32_LogicalDisk
objects.Stability. What an interesting concept. -- Chris Maunder
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