I am trying to use the GlobalMemoryStatus() function to find out memory avilability in a PC.
I am not having much success. Could anybody explain its usage with an example?
Many thanks
Bazz
This is a discussion on Memory status within the C++ Programming forums, part of the General Programming Boards category; I am trying to use the GlobalMemoryStatus() function to find out memory avilability in a PC. I am not having ...
I am trying to use the GlobalMemoryStatus() function to find out memory avilability in a PC.
I am not having much success. Could anybody explain its usage with an example?
Many thanks
Bazz
PHP Code:#include <windows.h>
#include <stdio.h>
int main()
{
MEMORYSTATUS MemStat;
GlobalMemoryStatus( &MemStat );
printf( "%ld %% of Memory in use.\n", MemStat.dwMemoryLoad );
printf( "\n" );
printf( "%ld bytes of physical memory.\n", MemStat.dwTotalPhys );
printf( "%ld bytes of physical memory available.\n", MemStat.dwAvailPhys );
printf( "\n" );
printf( "%ld bytes of pagefile memory.\n", MemStat.dwTotalPageFile );
printf( "%ld bytes of pagefile memory available.\n", MemStat.dwAvailPageFile );
printf( "Note that this number does not represent the actual physical size of the paging file on disk.\n" );
printf( "\n" );
printf( "%ld bytes of virtual memory.\n", MemStat.dwTotalVirtual );
printf( "%ld bytes of virtual memory available.\n", MemStat.dwAvailVirtual );
return 0;
}
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.