Home > database >  How GlobalMemoryStatusEx in VFP call?
How GlobalMemoryStatusEx in VFP call?

Time:10-29

When the memory is not more than 4 g, with GlobalMemoryStatus can get memory size
Declare GlobalMemoryStatusEx In kernel32 string @ test
Test=Replicate (CRH (0), 64)
The CLEAR
? GlobalMemoryStatus (@ test)
FOR I=1 TO 64
? ASC (SUBSTR (test, I, 1))
Endfor
Will value multiplied by a certain Numbers together is the memory size

When memory is more than 4 g, using GlobalMemoryStatus access memory size is wrong, get the memory, but to switch to GlobalMemoryStatusEx function after the success, why still in the test string is empty?
Declare GlobalMemoryStatusEx In kernel32 string @ test
Test=Replicate (CRH (0), 64)
The CLEAR
? GlobalMemoryStatusEx (@ test)
FOR I=1 TO 64
? ASC (SUBSTR (test, I, 1))
endfor

CodePudding user response:


Problem solving, and learning ten beans three warrior code,
But GlobalMemoryStatusEx before execution to set up the structure length
Declare long GlobalMemoryStatusEx IN kernel32;
String @ lpBuffer

PRIVATE cBuffer
CBuffer=bintoc (64, '4 rs) + replicate (CRH (0), 60)/write/structure length buffer
The clear
=GlobalMemoryStatusEx (@ cBuffer)


?" The length of the structure, must be initialized before using the function the value: "+ Transform (buf2num (substr (cBuffer, 1, 4)))
?" Physical memory usage integer (0 ~ 100) : "+ TRANSFORM (buf2num (substr (cBuffer, 5, 4)))
?" The amount of physical memory, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 9, 8)))
?" Physical memory of the remaining amount, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 17, 8)))
?" System page file size, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 25, 8)))
?" System available page file size, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 33, 8)))
?" The amount of virtual memory, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 41, 8)))
?" Residual amount of virtual memory, MB: "+ TRANSFORM (buf2num (substr (cBuffer, 49, 8)))
?" Retention value "+ TRANSFORM (buf2num (substr (cBuffer, 57, 8)))

The function buf2num
The PARAMETERS cBuf
RETURN ICASE (LEN (CBUF)=8, round (MTON (CTOBIN (CBUF, "YRS")) * 10000/1024/1024, 0), LEN (CBUF)=4, round (MTON (CTOBIN (CBUF, the "4 rs")), 0))
ENDFUNC

CodePudding user response:

VFP still has a master
  •  Tags:  
  • VFP
  • Related