📄 main.frm
字号:
VERSION 5.00
Begin VB.Form Main
Caption = "Form1"
ClientHeight = 5625
ClientLeft = 60
ClientTop = 345
ClientWidth = 7635
LinkTopic = "Form1"
ScaleHeight = 5625
ScaleWidth = 7635
StartUpPosition = 3 '窗口缺省
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private 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
' 获取CPUI信息
Private Declare Sub GetSystemInfo Lib "kernel32" _
(lpSystemInfo As SYSTEM_INFO)
' 获取内存信息
Private Declare Sub GlobalMemoryStatus Lib "kernel32" _
(lpBuffer As MemoryStatus)
Private Sub Form_Click()
Dim System As SYSTEM_INFO
Dim Memory As MemoryStatus
GetSystemInfo System
Me.Caption = "硬件信息"
' 输出
Print "- - - - - - - - - - - - - - - - - - - - - - - - - - -"
Print "CPU信息"
Print "Oem Id: " & System.dwOemID
Print "Page Size: " & System.dwPageSize
Print "Minimum Application Address: " _
& System.lpMinimumApplicationAddress
Print "Maximum Application Address: " _
& System.lpMaximumApplicationAddress
Print "Active Processor Mask: " _
& System.dwActiveProcessorMask
Print "Number of Processors: " _
& System.dwNumberOrfProcessors
Print "Processor Type: " & System.dwProcessorType
Print "Allocation Granularity: " _
& System.dwAllocationGranularity
Print "Reserved: " & System.dwReserved
Print "- - - - - - - - - - - - - - - - - - - - - - - - - - -"
Print "内存信息"
GlobalMemoryStatus Memory '取得内存的状态
Print "MemorySize: " & Memory.dwTotalPhys
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -