Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Windows .dll question: getmemorystatusex

 [1/3] 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

 [2/3] from: gregg:pointillistic at: 14-Oct-2008 10:05


Hi Bo, asn> I wrote the following snippet of code to try to get the size of physical asn> memory on a computer, but it isn't working. Does anyone know why? asn> ullTotalPhys [long] asn> ullAvailPhys [long] asn> ullTotalPagefile [long] asn> ullAvailPageFile [long] asn> ullTotalVirtual [long] asn> ullAvailVirtual [long] asn> ullAvailExtendedVirtual [long] Long is still four bytes (a DWORD). You need a 64-bit type for those params, and then to convert them to decimal values in REBOL (or wait for R3 and convince RT to add 64-bit int support to the library interface). You could also use an intermediary DLL to do it, exposing a REBOL friendly func. -- Gregg

 [3/3] from: peta::mailinator::com at: 15-Oct-2008 11:20


[REBOL] Windows .dll question: getmemorystatusex Hi Bo, REBOL [] kernel32: load/library %kernel32.dll memorystatusex: make struct! [ dwLength [int] dwMemoryLoad [int] ullTotalPhys [long] ullTotalPhys1 [long] ullAvailPhys [long] ullAvailPhys1 [long] ullTotalPagefile [long] ullTotalPagefile1 [long] ullAvailPageFile [long] ullAvailPageFile1 [long] ullTotalVirtual [long] ullTotalVirtual1 [long] ullAvailVirtual [long] ullAvailVirtual1 [long] ullAvailExtendedVirtual [long] ullAvailExtendedVirtual1 [long] ] none globalmemorystatusex: make routine! compose/deep [ lpBuffer [struct! [(first memorystatusex)]] return: [long] ] kernel32 "GlobalMemoryStatusEx" meminfo: make struct! memorystatusex none meminfo/dwLength: length? third meminfo res: globalmemorystatusex meminfo (Windows XP Pro SP 3, 2.7.6.3.1)