mirror of
https://github.com/janbodnar/Windows-API-examples.git
synced 2024-11-14 15:55:30 +00:00
Create memory.c
This commit is contained in:
parent
2ccdd2c87c
commit
fa3b88797f
24
system/memory.c
Normal file
24
system/memory.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
int wmain(void) {
|
||||||
|
|
||||||
|
MEMORYSTATUSEX mem;
|
||||||
|
|
||||||
|
mem.dwLength = sizeof(mem);
|
||||||
|
|
||||||
|
int r = GlobalMemoryStatusEx(&mem);
|
||||||
|
|
||||||
|
if (r == 0) {
|
||||||
|
wprintf(L"Failed to memory status %ld", GetLastError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
wprintf(L"Memory in use: %ld percent\n", mem.dwMemoryLoad);
|
||||||
|
wprintf(L"Total physical memory: %lld\n", mem.ullTotalPhys);
|
||||||
|
wprintf(L"Free physical memory: %lld\n", mem.ullAvailPhys);
|
||||||
|
wprintf(L"Total virtual memory: %lld\n", mem.ullTotalVirtual);
|
||||||
|
wprintf(L"Free virtual memory: %lld\n", mem.ullAvailVirtual);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user