Hier mal eine Quick and Dirty Lösung, um zu ermitteln ob
1. Microsoft Internet Explorer
2. Netscape Navigator
3. beides
installiert ist
beim Internet Explorer wird zudem noch die version und Buildnummer ausgegeben.
Wie man das beim Netscape ermittelt habe ich noch nicht rausbekommen.
Type DllVersionInfo
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
End Type
Declare Function DllGetVersion _
Lib "Shlwapi.dll" _
(dwVersion As DllVersionInfo) As Long
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
Const REG_SZ = 1 ' Unicode nul terminated string
Const REG_BINARY = 3 ' Free form binary
Const REG_DWORD = 4 ' 32-bit number
Const ERROR_SUCCESS = 0&
Declare Function RegCloseKey Lib "advapi32" (Byval hKey As Long) As Long
Declare Function RegOpenKey Lib "advapi32" Alias "RegOpenKeyA" (Byval hKey As Long, Byval lpSubKey As String, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA"(Byval hKey As Long, _
Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Sub Click(Source As Button)
If IsIexplore Then
Msgbox IEVersion
Else
Msgbox "Microsoft Internet Explorer not installed"
End If
End Sub
Function IEVersion() As String
Dim udtVersionInfo As DllVersionInfo
udtVersionInfo.cbSize = Len(udtVersionInfo)
Call DllGetVersion(udtVersionInfo)
IEVersion = "Internet Explorer " & _
udtVersionInfo.dwMajorVersion & "." & _
udtVersionInfo.dwMinorVersion & "." & _
udtVersionInfo.dwBuildNumber
End Function
Function GetRegValue(hKey As Long, strPath As String, strValue As String) As String
Dim hCurKey As Long
Dim lResult As Long
Dim lValueType As Long
Dim strBuffer As String
Dim lDataBufferSize As Long
Dim intZeroPos As Integer
Dim lRegResult As Long
GetSettingString = ""
lRegResult = RegOpenKey(hKey, strPath, hCurKey)
lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, Byval 0&, lDataBufferSize)
If lRegResult = ERROR_SUCCESS Then
If lValueType = REG_SZ Then
strBuffer = String(lDataBufferSize, " ")
lResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, Byval strBuffer, lDataBufferSize)
intZeroPos = Instr(strBuffer, Chr$(0))
If intZeroPos > 0 Then
GetRegValue = Left$(strBuffer, intZeroPos - 1)
Else
GetRegValue = strBuffer
End If
End If
Else
End If
lRegResult = RegCloseKey(hCurKey)
End Function
Function IsIexplore As Variant
IsIexplore = False
If GetRegValue ( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "Path") <> "" Then
IsIexplore = True
End If
End Function
Function IsNetscape As Variant
IsNetscape = False
If GetRegValue ( HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NETSCAPE.EXE", "Path") <> "" Then
IsNetscape = True
End If
End Function
End Sub