获取RAM系统大小 [英] Get RAM system size

查看:683
本文介绍了获取RAM系统大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何通过C ++获得我的RAM大小(在Windows 7上)。

I would like to know how can I get the size of my RAM through C++ (on Windows 7).

推荐答案

使用 GetPhysicallyInstalledSystemMemory 检索计算机上物理安装的RAM数量。

读取标记在MSDN本身。它说,

Read the remarks at MSDN itself. It says,


GetPhysicallyInstalledSystemMemory
函数从
计算机检索
物理安装RAM的数量SMBIOS固件表。
这可能与GlobalMemoryStatusEx
报告的金额
不同,后者将MEMORYSTATUSEX结构的bullbys
成员
设置为物理内存量
可供操作系统
使用
。操作系统可用的
的内存量可以比在计算机中安装的物理内存的

,因为
BIOS和一些驱动程序可以预留
内存作为
内存映射设备的I / O区域,使
内存对操作
系统和应用程序不可用。

The GetPhysicallyInstalledSystemMemory function retrieves the amount of physically installed RAM from the computer's SMBIOS firmware tables. This can differ from the amount reported by the GlobalMemoryStatusEx function, which sets the ullTotalPhys member of the MEMORYSTATUSEX structure to the amount of physical memory that is available for the operating system to use. The amount of memory available to the operating system can be less than the amount of memory physically installed in the computer because the BIOS and some drivers may reserve memory as I/O regions for memory-mapped devices, making the memory unavailable to the operating system and applications.


GetPhysicallyInstalledSystemMemory
检索的物理内存
的数量必须等于或大于
GlobalMemoryStatusEx函数报告的数量
; strong>如果
更少,则SMBIOS数据格式不正确
,函数失败,
ERROR_INVALID_DATA。格式错误的SMBIOS
数据可能表明
用户的计算机出现问题。

The amount of physical memory retrieved by the GetPhysicallyInstalledSystemMemory function must be equal to or greater than the amount reported by the GlobalMemoryStatusEx function; if it is less, the SMBIOS data is malformed and the function fails with ERROR_INVALID_DATA. Malformed SMBIOS data may indicate a problem with the user's computer.

这意味着,查看 GlobalMemoryStatusEx

That means, you would also want to look at GlobalMemoryStatusEx.

这篇关于获取RAM系统大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆