hi all I using GlobalMemoryStatusEx function to retrieves information about memory, but this function don't work correctly, it return 0 for all properies. I have windows 7, I think this function don't work in WIN 7.
[StructLayout(LayoutKind.Sequential)]
internal struct MEMORYSTATUSEX
{
internal uint dwLength;
internal uint dwMemoryLoad;
internal ulong ullTotalPhys;
internal ulong ullAvailPhys;
internal ulong ullTotalPageFile;
internal ulong ullAvailPageFile;
internal ulong ullTotalVirtual;
internal ulong ullAvailVirtual;
internal ulong ullAvailExtendedVirtual;
}
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX lpBuffer);
private void btnGlobalMemoryStatusEX_Click(object sender, EventArgs e)
{
MEMORYSTATUSEX statEX = new MEMORYSTATUSEX();
GlobalMemoryStatusEx(ref statEX);
double d = (double)statEX.ullTotalPhys;
}
Can any body tell me that where I wirte wrong code? tanx