January 1, 2005

WinTask - GlobalMemoryStatus

'
' GlobalMemoryStatus
'
' Author: Joe Strazzere
'

' "kernel32.dll" alias "GlobalMemoryStatus"          (lpBuffer as MEMORYSTATUS)
'
'type MEMORYSTATUS
'    dwLength        as long
'    dwMemoryLoad    as long
'    dwTotalPhys     as long
'    dwAvailPhys     as long
'    dwTotalPageFile as long
'    dwAvailPageFile as long
'    dwTotalVirtual  as long
'    dwAvailVirtual  as long
'end type
dim ptr as unsigned
dim ptr2 as unsigned
ptr=allocate(32)
ret=External("kernel32.dll","GlobalMemoryStatus",ptr)
ptr2=ptr+4
var=peekinteger(ptr2,4)
msgbox("Memory Load % ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+8
var=peekinteger(ptr2,4)
msgbox("Total Physical Memory ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+12
var=peekinteger(ptr2,4)
msgbox("Avail Physical Memory ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+16
var=peekinteger(ptr2,4)
msgbox("Total Page File Size ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+20
var=peekinteger(ptr2,4)
msgbox("Avail Page File Size ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+24
var=peekinteger(ptr2,4)
msgbox("Total Virtual ="+str$(var),,"GlobalMemoryStatus")
ptr2=ptr+28
var=peekinteger(ptr2,4)
msgbox("Avail Virtual ="+str$(var),,"GlobalMemoryStatus")