Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long 其实上面的兄弟说的对,你去下载一个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, 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
其实上面的兄弟说的对,你去下载一个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, 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