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 Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As LongPrivate Sub Form_Load() Dim os As OSVERSIONINFO Dim retval As Long os.dwOSVersionInfoSize = Len(os) retval = GetVersionEx(os) MsgBox "Windows version number:" & os.dwMajorVersion & Chr(Asc(".")) & os.dwMinorVersion MsgBox "OS Version Info Size = " & os.dwOSVersionInfoSize MsgBox "BuildNumber = " & os.dwBuildNumber MsgBox "Platform ID = " & os.dwPlatformId MsgBox "CSD Version = " & os.szCSDVersion End End Sub 看能不能根据版本号得到
http://www.china-askpro.com/msg1/qa14.shtml
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As LongPrivate Sub Form_Load()
Dim os As OSVERSIONINFO
Dim retval As Long
os.dwOSVersionInfoSize = Len(os)
retval = GetVersionEx(os)
MsgBox "Windows version number:" & os.dwMajorVersion & Chr(Asc(".")) & os.dwMinorVersion
MsgBox "OS Version Info Size = " & os.dwOSVersionInfoSize
MsgBox "BuildNumber = " & os.dwBuildNumber
MsgBox "Platform ID = " & os.dwPlatformId
MsgBox "CSD Version = " & os.szCSDVersion
End
End Sub
看能不能根据版本号得到
http://www.mvps.org/vbnet/index.html?code/wmi/wmoperatingsystem.htm
用obj.Caption这个属性
不行,是怎么不行法?这段代码我试过的,绝对没有问题,你引用
Microsoft WMI Scripting V 1.2 Library没有