获得系统版本.frm
来自「Windows API函数,希望大伙有用哦」· FRM 代码 · 共 102 行
FRM
102 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2040
ClientLeft = 60
ClientTop = 345
ClientWidth = 4335
LinkTopic = "Form1"
ScaleHeight = 2040
ScaleWidth = 4335
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Height = 270
Left = 1710
TabIndex = 5
Text = "Text3"
Top = 1470
Width = 1695
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
Height = 270
Left = 1710
TabIndex = 4
Text = "Text2"
Top = 810
Width = 1695
End
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Height = 270
Left = 1710
TabIndex = 3
Text = "Text1"
Top = 240
Width = 1695
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "内部版本号:"
Height = 180
Left = 600
TabIndex = 2
Top = 1500
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "版本编号:"
Height = 180
Left = 600
TabIndex = 1
Top = 885
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "操作系统:"
Height = 180
Left = 600
TabIndex = 0
Top = 270
Width = 900
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'API 函数声明
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
'结构型变量说明
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Sub Form_Load()
Dim OSInfo As OSVERSIONINFO, V As String
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
GetVersionEx OSInfo
Select Case OSInfo.dwPlatformId
Case 0
V = "Windows 32s "
Case 1
V = "Windows 95/98"
Case 2
V = "Windows NT "
End Select
Text1 = V
Text2 = Str$(OSInfo.dwMajorVersion) + "." + LTrim(Str(OSInfo.dwMinorVersion))
Text3 = Str(OSInfo.dwBuildNumber)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?