[REBOL] Windows .dll question: getmemorystatusex
From: amicom::sonic::net at: 14-Oct-2008 0:26
I wrote the following snippet of code to try to get the size of physical
memory on a computer, but it isn't working. Does anyone know why?
It looks like it is returning a failure (value of 0).
Here's the code:
kernel32: load/library %kernel32.dll
memorystatusex: make struct! [
dwLength [int]
dwMemoryLoad [int]
ullTotalPhys [long]
ullAvailPhys [long]
ullTotalPagefile [long]
ullAvailPageFile [long]
ullTotalVirtual [long]
ullAvailVirtual [long]
ullAvailExtendedVirtual [long]
] [0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
globalmemorystatusex: make routine! compose/deep [
lpBuffer [struct! [(first memorystatusex)]]
return: [long]
] kernel32 "GlobalMemoryStatusEx"
meminfo: make struct! memorystatusex none
res: globalmemorystatusex meminfo
Thanks in advance for any info you can give me on this!
-Bo