有什么方法能识别windows的版本号,(api|dll|读注册表?)
能够区分出(9x/Me/2k/XP/2003)以及其Service Pack的版本.
本人现在正在用InstallShield 6.22做一个安装程序,需要识别具体的windows版本.
InstallShield程序自身智能识别win2000以前的操作系统版号。
能够区分出(9x/Me/2k/XP/2003)以及其Service Pack的版本.
本人现在正在用InstallShield 6.22做一个安装程序,需要识别具体的windows版本.
InstallShield程序自身智能识别win2000以前的操作系统版号。
解决方案 »
- VB6卡死无响应(如何提高其性能)
- 请问如何测试程序的运行时间??迫切求答!
- 利用mscomm提取手机短信 老是不全或取不到,请帮忙解决
- [超紧急求助]高人们来!问个OLE控件在某些系统使用的问题
- 在mshflexgrid如何使指定的记录位于看到的记录的最后一个(只有这点分了)
- 麻烦问下怎么样用VB6 自动登录淘宝
- 请问怎么写一个拖动PICTURE控件的程序。急!
- 还是中文问题,请高手解答
- 请问有什么办法实现在一条SQL语句里同时对两个不同的数据库操作?数据库高手快来!!!!
- 如何用VB的Winsock控件在局域网中实现附送文件(Attach)的功能,不是E-Mail形式的。谢谢!
- 如何保存用户的选项设置(初学者求助)
- excel合并单元格问题?
Private Sub Command1_Click()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject
Dim msg As String
Dim dtb As String
Dim d As String
Dim t As String
Dim bias As Long
On Local Error Resume Next
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate} ").InstancesOf("Win32_OperatingSystem ")
For Each obj In wmiObjSet
MsgBox "你当前使用的系统是 " & obj.Caption
Next
End Sub
or:
Public Function getVersion() As Long
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
getVersion = osinfo.dwPlatformId
End FunctionPrivate Sub Command1_Click()
ttt = getVersion()
If ttt = 1 Then
MsgBox ("98")
Else
MsgBox ("xp")
End If
End Sub
Public Function GetWinVersion() As String
Dim Ver As Long, WinVer As Long
Ver = GetVersion()
WinVer = Ver And &HFFFF&
'retrieve the windows version
GetWinVersion = Format((WinVer Mod 256) + ((WinVer \ 256) / 100), "Fixed")
End Function
Private Sub Form_Load()
MsgBox "Windows version: " + GetWinVersion
End Sub或者
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
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
(2). (API)GetVersionEx
还有其他方法吗?我是要写到InstallScript中的。我想能够有多种方案,来对比一下,哪种方法更容易在InstallScript中实现。