VB中的API声明:
Public Declare Sub GlobalMemoryStatus Lib "kernel32" _
    (lpBuffer As MemoryStatus)Public memInfo As MemoryStatus数据结构为:
Public 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'这个数据结构在头文件“WinBase.h”中有对应的C函数定义:
'typedef struct _MEMORYSTATUS {
'    DWORD dwLength;
'    DWORD dwMemoryLoad;
'    SIZE_T dwTotalPhys;
'    SIZE_T dwAvailPhys;
'    SIZE_T dwTotalPageFile;
'    SIZE_T dwAvailPageFile;
'    SIZE_T dwTotalVirtual;
'    SIZE_T dwAvailVirtual;
'} MEMORYSTATUS, *LPMEMORYSTATUS;请问,那本参考书上有对这个API数据结构中定义的各个变量的详细解释

解决方案 »

  1.   

    就我看来,现在只有MSDN有最详尽的描述。
      

  2.   

    利用Win32 API的GlobalMemoryStatus()可以方便地获取系统中物理内存总量、虚拟内存总量、已用的虚拟内存数量和剩余的虚拟内存数量。
    Type MEMORYSTATUS '指向内存的结构体
    dwLength As Long 'MEMORYSTATUS的大小
    dwMemoryLoad As Long '内存利用百分比 
    dwTotalPhys As Long '物理内存大小
    dwAvailPhys As Long '可用物理内存的大小
    dwTotalPageFile As Long '页面文件的大小
    dwAvailPageFile As Long '可用页面文件的大小 
    dwTotalVirtual As Long '虚拟内存大小 ??
    dwAvailVirtual As Long '可用虚拟内存大小 ??
    End Type 
    具体实现内存如下:
    Dim mem As MEMORYSTATUS
    GlobalMemoryStatus mem
    MemSize.Caption = "物理内存:" & CInt(mem.dwTotalPhys / 1024 / 1024) & "M"
    MemSize.Caption = MemSize.Caption & " 可用物理内存: " & CInt(mem.dwAvailPhys / 1024 / 1024) & "M" & vbCrLf
    MemSize.Caption = MemSize.Caption & vbCrLf
    ' MemSize.Caption = MemSize.Caption & "虚拟内存大小: " & CInt(mem.dwTotalPageFile / 1024 / 1024) & 
    ' "M"
      

  3.   

    看MSDN吧,其它的不是对msdn的翻译就是msdn的搬家
      

  4.   

    to maxim(黑马)先生:您是摘自哪本参考书的?
      

  5.   

    MSDN上的说明,黑马翻译的不错.
    Members
    dwLength 
    The size in bytes of the MEMORYSTATUS data structure. You do not need to set this member before calling the GlobalMemoryStatus function; the function sets it. 
    dwMemoryLoad 
    Specifies a number between 0 and 100 that gives a general idea of current memory utilization, in which 0 indicates no memory use and 100 indicates full memory use. 
    dwTotalPhys 
    Indicates the total number of bytes of physical memory. 
    dwAvailPhys 
    Indicates the number of bytes of physical memory available. 
    dwTotalPageFile 
    Indicates the total number of bytes that can be stored in the paging file. Note that this number does not represent the actual physical size of the paging file on disk. 
    dwAvailPageFile 
    Indicates the number of bytes available in the paging file. 
    dwTotalVirtual 
    Indicates the total number of bytes that can be described in the user mode portion of the virtual address space of the calling process. 
    dwAvailVirtual 
    Indicates the number of bytes of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process.