求助,怎样才能判断本机是否安装IE以及判断相应的IE版本?

cleogo 2005-09-21 12:41:49
请问怎样才能判断本机是否安装了IE, 并且判断相应的IE版本? 需要用代码实现, 谢谢!
(IE 指的是Microsoft Internet Explorer)
...全文
266 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2005-09-21
  • 打赏
  • 举报
回复
完整代码 [先引用Registry Access Functions library(RegObj.dll)]:

Option Explicit

Private Type DllVersionInfo
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
End Type
Private Declare Function DllGetVersion Lib "Shlwapi.dll" (dwVersion As DllVersionInfo) As Long

Sub ShowIE()
Dim myReg As New Registry, KeyFound As Boolean
Dim HasIE As Boolean, msg As String
msg = ""

KeyFound = myReg.GetKeyValue(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "Path", msg)

If KeyFound Then HasIE = (msg <> "")
If HasIE Then
msg = "Your system has installed Internet Explore" & vbCrLf & vbCrLf & "Path: " & msg
Dim udtVersionInfo As DllVersionInfo
udtVersionInfo.cbSize = Len(udtVersionInfo)
DllGetVersion udtVersionInfo
msg = msg & vbCrLf & vbCrLf & "Version: " & udtVersionInfo.dwMajorVersion & "." & udtVersionInfo.dwMinorVersion & "." & udtVersionInfo.dwBuildNumber
Else
msg = "Your system has not installed Internet Explore"
End If
Set myReg = Nothing
MsgBox msg, 4096, "Internet Explore Information"
End Sub

Private Sub Form_Load()
ShowIE
End Sub
northwolves 2005-09-21
  • 打赏
  • 举报
回复
Option Explicit

Private Type DllVersionInfo
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
End Type
Private Declare Function DllGetVersion Lib "Shlwapi.dll" (dwVersion As DllVersionInfo) As Long

Sub ShowIEVersion()
Dim udtVersionInfo As DllVersionInfo, IEVersion As String
udtVersionInfo.cbSize = Len(udtVersionInfo)
DllGetVersion udtVersionInfo
IEVersion = "Internet Explorer " & _
udtVersionInfo.dwMajorVersion & "." & _
udtVersionInfo.dwMinorVersion & "." & _
udtVersionInfo.dwBuildNumber
MsgBox IEVersion
End Sub

Private Sub Form_Load()
ShowIEVersion
End Sub
唐古拉山 2005-09-21
  • 打赏
  • 举报
回复

Private Type DLLVERSIONINFO
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformID As Long
End Type

Private Declare Function DllGetVersion Lib "Shlwapi.dll" (dwVersion As DLLVERSIONINFO) As Long

Public Function GetIEVersion() As String
Dim tDLLVerInfo As DLLVERSIONINFO
Dim lMajor As Long, lMinor As Long, lBuild As Long
Dim r As Long
tDLLVerInfo.cbSize = Len(tDLLVerInfo)
r = DllGetVersion(tDLLVerInfo)
If r = 0 Then
With tDLLVerInfo
lMajor = .dwMajorVersion
lMinor = .dwMinorVersion
lBuild = .dwBuildNumber
End With
GetIEVersion = lMajor & "." & lMinor & "." & lBuild
Else
GetIEVersion = ""
End If
End Function


'调用
Private Sub Form_Load()
MsgBox "IE Ver:" & GetIEVersion
End Sub


crycoming 2005-09-21
  • 打赏
  • 举报
回复
// This function returns Internet Explorer's major version number,
// or 0 for others. It works by finding the "MSIE " string and
// extracting the version number following the space, up to the decimal
// point, ignoring the minor version number
<SCRIPT LANGUAGE="JavaSCRIPT">
function msieversion()
{
var ua = window.navigator.userAgent
var msie = ua.indexOf ( "MSIE " )

if ( msie > 0 ) // If Internet Explorer, return version number
return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
else // If another browser, return 0
return 0

}
</SCRIPT>
fishzone 2005-09-21
  • 打赏
  • 举报
回复
http://www.thousandvb.com/html/gb/weekly/day000307.htm

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧