main.frm

来自「很好的教程原代码!」· FRM 代码 · 共 78 行

FRM
78
字号
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 + =
减小字号Ctrl + -
显示快捷键?