【VB声明】
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long【别名】
GetVersionExA【说明】
在一个OSVERSIONINFO结构中载入与平台和操作系统有关的版本信息 【返回值】
Long,非零表示成功,零表示失败 【参数表】
lpVersionInformation - OSVERSIONINFO,用于装载版本信息的结构。在正式调用函数之前,必须先将这个结构的dwOSVersionInfoSize字段设为结构的大小(148)
示例:
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, Pid As String
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long【别名】
GetVersionExA【说明】
在一个OSVERSIONINFO结构中载入与平台和操作系统有关的版本信息 【返回值】
Long,非零表示成功,零表示失败 【参数表】
lpVersionInformation - OSVERSIONINFO,用于装载版本信息的结构。在正式调用函数之前,必须先将这个结构的dwOSVersionInfoSize字段设为结构的大小(148)
示例:
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, Pid As String
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
解决方案 »
- 多个进程可以访问同一个并口吗?
- VB 添加控件时 控件抖动
- 扫描列出局域网开放某端口的IP
- 又有200分了,散之……
- VB打印问题,内容打完了,还是要吞纸,然后打印机卡住了
- 500分求高效算法。 兑现承诺,开贴结分~ 请小马哥Come in ~
- 向数据库存入图片???
- 请大家来看一看,也许对你们个人软件宣传有帮助!
- 求教用什么函数对"%C9%BD%B5%D8%D7%D4%D0%D0%B3%B5"与"山地自行车"相互转换
- 拜托! 连接一台远程计算机函数是什么
- office chart的两个问题
- 请问用什么函数把integer类型的1,2,3,...对应转换为string类型的"1","2","3".....
Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByVal lpVersionInformation As OSVERSIONINFO) As Long
说明
在一个OSVERSIONINFO结构中载入与平台和操作系统有关的版本信息
很多程序的运行和系统的版本有关系的。有些东西是需要在特定的系统下运行的。这就是知道版本信息的用处。
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, PId As String
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
'Print the information to the form
Select Case OSInfo.dwPlatformId
Case 0
PId = "Windows 32s "
Case 1
PId = "Windows 95/98"
Case 2
PId = "Windows NT "
End Select
Print "OS: " + PId
Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))
Print "Build: " + str(OSInfo.dwBuildNumber)
End Sub