Am using the following code to get total physical memory in QB64.
How do I get the total physical memory of the graphics adapter?
Contents of MEM.H
#include<windows.h>
#include<stdio.h>
#include<tchar.h>
uint64 TotalPhysicalMem ();
uint64 TotalPhysicalMem () {
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
return statex.ullTotalPhys;
}
Contents of MEM.BAS
REM Mem.bas source:
DECLARE LIBRARY "mem"
FUNCTION TotalPhysicalMem~&&
END DECLARE
PRINT "Total Physical Memory: "
PRINT TotalPhysicalMem
END
ID_DEDICATEDis defined, the function simply returns 0, suggesting that it won't actually get video RAM for dedicated graphics cards. For others, I think it returns the amount of system RAM that Windows itself has dedicated to graphics processing, meaning Windows might not know the amount otherwise?Sys_GetVideoRam()appears to do the same thing as Msinfo32.exe -- returning a signedintrather than anunsigned int, meaning it might also have the bug where >2 GB of RAM results in a value less than 2 GB!