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 long MemoryInKilobytes);

VB Signature:

Declare Function GetPhysicallyInstalledSystemMemory Lib "kernel32.dll" (TODO) 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:

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

Documentation