GetSystemInfo
程序代码:
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO) Private Type SYSTEM_INFO '是一个过时选项 dwOemID As Long '用于显示CPU的页面大小, 在x86CPU上这个值是4096字节,在alpha CPU上这个值是8192字节, 在IA-64上,这个值是8192 dwPageSize As Long '用于给出每个进程可用地址空间的最小内存地址. '在Windows 98上这个值是, 0x400000,在win2k/xp上,这个值是0x100000 lpMinimumApplicationAddress As Long '用于给出每个可用进行空间地址的最大内存地址 '在Windows 98 上,这个地址是0x7FFFFFFF, 在Windows xp上,这个地址是0x7FFEFFFF lpMaximumApplicationAddress As Long '位屏蔽, 指明哪个CPU是活动的. dwActiveProcessorMask As Long '计算机中CPU的数目 dwNumberOrfProcessors As Long '处理器类型 dwProcessorType As Long '保留地址空间区域的分配粒度. dwAllocationGranularity As Long '保留供将来使用 dwReserved As Long End Type Private Sub Form_Click() Dim SystemInfo As SYSTEM_INFO Call GetSystemInfo(SystemInfo) Print "OEMID:" & SystemInfo.dwOemID Print "CPU的页面大小:" & SystemInfo.dwPageSize & " byte" Print "每个进程可用地址空间的最小内存地址:" & SystemInfo.lpMinimumApplicationAddress Print "每个可用进行空间地址的最大内存地址:" & SystemInfo.lpMaximumApplicationAddress Print "CPU掩码:" & SystemInfo.dwActiveProcessorMask Print "CPU数目:" & SystemInfo.dwNumberOrfProcessors Print "CPU类型:" & SystemInfo.dwProcessorType Print "保留地址空间区域的分配粒度:" & SystemInfo.dwAllocationGranularity End Sub