Option ExplicitPublic Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As LongPublic 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 TypePublic Type OSVersion osvOSName As Long '操作系统类型 osvOSVerMajor As Long '主版本号 osvOSVerMinor As Long '次版本号 osvOSVerRevision As Long '修正号 End TypePublic Const gc_lngPlatformID_Win3X As Long = 0 Public Const gc_lngPlatformID_Win9X As Long = 1 Public Const gc_lngPlatformID_WinNT As Long = 2Public Function GetOSVersion() As OSVersion
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 TypePublic Type OSVersion
osvOSName As Long '操作系统类型
osvOSVerMajor As Long '主版本号
osvOSVerMinor As Long '次版本号
osvOSVerRevision As Long '修正号
End TypePublic Const gc_lngPlatformID_Win3X As Long = 0
Public Const gc_lngPlatformID_Win9X As Long = 1
Public Const gc_lngPlatformID_WinNT As Long = 2Public 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
Windows XP 是 NT 5.1
Windows Server 2003 是 NT 5.2
我已在components找到控件-SYSINFO
其属性就有osplatform, osversion,osbuild,所以在FORM中放入这个控件就可以了.
但你给我的程序对我搞其他东西有很好帮助.谢谢拉.
另外,我只找到查IP的控件,无法查到SUB MASK,和DNS SERVER IP, 你有建议吗?还有如何给你20分?