📄 modosver.bas
字号:
Attribute VB_Name = "ModOSVer"
'★★★★★****************************★★★★★**********************★★★★★
'金诺VB园-收藏整理
'本站是专注于VB和VBNET编程的源码下载站
'发布日期:2008-3-16 14:31:52
'网 站:http://www.vbget.com/ (金诺VB园)
'网 站:http://www.vbget.com/daohan/ (VB编程网址导航)
'E-Mail :vbget@yahoo.cn
'QQ :158676144
'源码作者:如果您有VB商业源码需要获得收益,本站将有VIP收费下载频道可供你发布!
' 您有权定价;改价;删除;及即时查看下载量(即收益),所有收益全部归您!
' 本站将在双方协商的一个金额周期内打款到作者帐户中,您只需负责打款费用!
' 本站只作为一个平台提供最新VB源码咨讯和源码下载!
'本注释由<站长工具之智能注释>软件自动添加!金诺VB园有此软件下载!
'★★★★★****************************★★★★★**********************★★★★★
Option Explicit
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type
Public Type OSVersion
osvOSName As Long '操作系统类型
osvOSVerMajor As Long '主版本号
osvOSVerMinor As Long '次版本号
osvOSVerRevision As Long '修正号
End Type
Public Const gc_lngPlatformID_Win3X As Long = 0
Public Const gc_lngPlatformID_Win9X As Long = 1
Public Const gc_lngPlatformID_WinNT As Long = 2
Public Declare Function GetSystemDirectory Lib "kernel32" _
Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Public Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Public Function GetOSVersion() As OSVersion
'获取操作系统的名称及版本
Dim OSInfo As OSVERSIONINFO
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
Call GetVersionEx(OSInfo)
With GetOSVersion
.osvOSName = OSInfo.dwPlatformId
.osvOSVerMajor = OSInfo.dwMajorVersion
.osvOSVerMinor = OSInfo.dwMinorVersion
.osvOSVerRevision = OSInfo.dwBuildNumber
End With
End Function
Public Function GetWinDir() As String
Dim nSize As Long
Dim Tmp As String
'pad the string for the return value and
'set nSize equal to the size of the string
Tmp = Space$(256)
nSize = Len(Tmp)
'call the API
Call GetWindowsDirectory(Tmp, nSize)
'trim off the trailing null added by the API
GetWinDir = TrimNull(Tmp)
End Function
Public Function GetSystemDir() As String
Dim nSize As Long
Dim Tmp As String
Tmp = Space$(256)
nSize = Len(Tmp)
Call GetSystemDirectory(Tmp, nSize)
GetSystemDir = TrimNull(Tmp)
End Function
Public Function TrimNull(Item As String) As String
Dim Pos As Integer
'double check that there is a chr$(0) in the string
Pos = InStr(Item, Chr$(0))
If Pos Then
TrimNull = Left$(Item, Pos - 1)
Else
TrimNull = Item
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -