GetPhysicallyInstalledSystemMemory (kernel32)
Last changed: -69.224.107.100

.
Summary
Retrieves the amount of RAM, in kilobytes, that is physically installed on the computer.

C# Signature:

[DllImport("kernel32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetPhysicallyInstalledSystemMemory(out ulong MemoryInKilobytes);

VB Signature:

Declare Function GetPhysicallyInstalledSystemMemory Lib "kernel32.dll" (ByRef TotalMemoryInKilobytes As ULong) As Boolean

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    [DllImport("kernel32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool GetPhysicallyInstalledSystemMemory(out ulong TotalMemoryInKilobytes);
    static void Main()
    {
    ulong l;
    GetPhysicallyInstalledSystemMemory(out l);
    Console.WriteLine((l / 1024) + "MB of RAM installed.");
    Console.ReadLine();
    }

Documentation