windows API获取物理内存大于4G的方法
来源:互联网 发布:改变系统字体大小软件 编辑:程序博客网 时间:2024/05/02 18:51
函数原型:
BOOL WINAPI GlobalMemoryStatusEx(_Inout_ LPMEMORYSTATUSEX lpBuffer);
调用dll Kernel32.dll
demo:
// Sample output:// There is 51 percent of memory in use.// There are 2029968 total KB of physical memory.// There are 987388 free KB of physical memory.// There are 3884620 total KB of paging file.// There are 2799776 free KB of paging file.// There are 2097024 total KB of virtual memory.// There are 2084876 free KB of virtual memory.// There are 0 free KB of extended memory.#include <windows.h>#include <stdio.h>#include <tchar.h>// Use to convert bytes to KB#define DIV 1024// Specify the width of the field in which to print the numbers. // The asterisk in the format specifier "%*I64d" takes an integer // argument and uses it to pad and right justify the number.#define WIDTH 7void _tmain(){ MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx (&statex); _tprintf (TEXT("There is %*ld percent of memory in use.\n"), WIDTH, statex.dwMemoryLoad); _tprintf (TEXT("There are %*I64d total KB of physical memory.\n"), WIDTH, statex.ullTotalPhys/DIV); _tprintf (TEXT("There are %*I64d free KB of physical memory.\n"), WIDTH, statex.ullAvailPhys/DIV); _tprintf (TEXT("There are %*I64d total KB of paging file.\n"), WIDTH, statex.ullTotalPageFile/DIV); _tprintf (TEXT("There are %*I64d free KB of paging file.\n"), WIDTH, statex.ullAvailPageFile/DIV); _tprintf (TEXT("There are %*I64d total KB of virtual memory.\n"), WIDTH, statex.ullTotalVirtual/DIV); _tprintf (TEXT("There are %*I64d free KB of virtual memory.\n"), WIDTH, statex.ullAvailVirtual/DIV); // Show the amount of extended memory available. _tprintf (TEXT("There are %*I64d free KB of extended memory.\n"), WIDTH, statex.ullAvailExtendedVirtual/DIV);}
参考: https://msdn.microsoft.com/en-us/library/aa366589(v=vs.85).aspx
0 0
- windows API获取物理内存大于4G的方法
- delphi 获取大于2G的物理内存大小
- windows 物理内存获取
- linux下分配G级物理内存的方法-alloc_bootmem()
- fseek获取大于4G的文件大小的问题
- fseek获取大于4G的文件大小的问题
- stat获取大于2G的文件
- linux支持大于4G内存
- 局域网络大于4G的文件传递方法
- 认识物理内存4G地址空间的局限--转载
- 认识物理内存4G地址空间的局限--转载
- Windows CE下访问物理内存的方法
- Windows CE下访问物理内存的一些方法!!
- Windows CE下访问物理内存的一些方法
- Windows CE下访问物理内存的一些方法!!
- Windows CE下访问物理内存的方法
- Windows CE下访问物理内存的一些方法
- Windows CE下访问物理内存的方法
- 同一网站不同和二级域名和不同子目录的cookie
- 【阅读】《head first html5》第十章——《运用javascript》(实际上的javascript线程)
- 天声人語 20150803
- POJ3264 Balanced Lineup 线段树|ST表
- 日经春秋 20150803
- windows API获取物理内存大于4G的方法
- Genymotion+SDK+MyEclipse开发遇到adb问题解决方案
- 我的Android进阶之旅------>Android知识图谱
- 一篇故事讲述了计算机网络里的基本概念:网关,DHCP,IP寻址,ARP欺骗,路由,DDOS
- 南邮 OJ 1004 线性表操作
- LeetCode206——Reverse Linked List 反转链表
- 如何理解 MySQL 中的 <=> 操作符?
- 日经社説 20150803 「失われた20年」教訓に飛躍のとき
- iOS学习笔记1-开发的一些奇巧淫技