[DllImport("kernel32.dll")]
static extern bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX lpBuffer);
None.
Please add some!
private void DisplayMemory()
{
string[] Drives = System.IO.Directory.GetLogicalDrives();
long tm = System.GC.GetTotalMemory(true);
UInt64 UserAvailable=0,Capacity=0,Available=0;
if(Drives!=null)
{
int retval = GetDiskFreeSpaceExA(Drives[0],ref UserAvailable,ref Capacity,ref Available);
this.lblDiskFree.Text = Available.ToString();
this.lblDiskTotal.Text = Capacity.ToString();
}
MEMORYSTATUSEX msex=new MEMORYSTATUSEX();
msex.dwLength = (uint)Marshal.SizeOf(msex);
int retval2 = GlobalMemoryStatusEx(ref msex);
this.lblMemoryFree.Text = msex.ullAvailPhys.ToString();
this.lblMemoryTotal.Text = msex.ullTotalPhys.ToString();
}
private struct MEMORYSTATUSEX
{
public uint dwLength;
public uint dwMemoryLoad;
public UInt64 ullTotalPhys;
public UInt64 ullAvailPhys;
public UInt64 ullTotalPageFile;
public UInt64 ullAvailPageFile;
public UInt64 ullTotalVirtual;
public UInt64 ullAvailVirtual;
public UInt64 ullAvailExtendedVirtual;
};
[DllImport("kernel32.dll")]
private static extern int GetDiskFreeSpaceExA( string lpDirectoryName,
ref System.UInt64 lpFreeBytesAvailable,
ref System.UInt64 lpTotalNumberOfBytes,
ref System.UInt64 lpTotalNumberOfFreeBytes
);
[DllImport("kernel32.dll")]
private static extern int GlobalMemoryStatusEx(
ref MEMORYSTATUSEX msex
);
Do you know one? Please contribute it!