Hi
How we can find out the version of internet explorer using VB6 ?
With regards,
Nasreen
Printable View
Hi
How we can find out the version of internet explorer using VB6 ?
With regards,
Nasreen
You can get it from the registry - see attached image.
For sample code to read registry search forum.
As Rhino said just do like this .... Add a module coded by Edgemeal:
VB Code:
Option Explicit Private Const READ_CONTROL = &H20000 Private Const STANDARD_RIGHTS_READ = (READ_CONTROL) Private Const STANDARD_RIGHTS_WRITE = (READ_CONTROL) Private Const KEY_QUERY_VALUE = &H1 Private Const KEY_SET_VALUE = &H2 Private Const KEY_CREATE_SUB_KEY = &H4 Private Const KEY_ENUMERATE_SUB_KEYS = &H8 Private Const KEY_NOTIFY = &H10 Private Const KEY_CREATE_LINK = &H20 Private Const SYNCHRONIZE = &H100000 Private Const STANDARD_RIGHTS_ALL = &H1F0000 Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or _ KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) _ And (Not SYNCHRONIZE)) Private Const ERROR_SUCCESS = 0& Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _ Alias "RegOpenKeyExA" (ByVal hKey As Long, _ ByVal lpSubKey As String, ByVal ulOptions As Long, _ ByVal samDesired As Long, phkResult As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll" _ 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 Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_LOCAL_MACHINE As Long = &H80000002 Private Declare Function RegOpenKey Lib "advapi32.dll" _ Alias "RegOpenKeyA" _ (ByVal hKey As Long, _ ByVal lpSubKey As String, _ phkResult As Long) As Long Private Function NoNulls(ByVal Strng As String) As String Dim i As Integer If Len(Strng) > 0 Then i = InStr(Strng, vbNullChar) Select Case i Case 0 NoNulls = Strng Case 1 NoNulls = "" Case Else NoNulls = Left$(Strng, i - 1) End Select End If End Function Public Function sdaGetRegEntry(strSubKeys As String, strValName As String) As String On Error GoTo sdaGetRegEntry_Err Dim lngResult As Long, lngType As Long Dim lngHandle As Long, lngcbData As Long Dim strRet As String If Not ERROR_SUCCESS = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strSubKeys, 0&, KEY_READ, lngHandle) Then Exit Function lngResult = RegQueryValueEx(lngHandle, strValName, 0&, lngType, ByVal strRet, lngcbData) strRet = Space(lngcbData) lngResult = RegQueryValueEx(lngHandle, strValName, 0&, lngType, ByVal strRet, lngcbData) If Not ERROR_SUCCESS = RegCloseKey(lngHandle) Then lngType = -1& sdaGetRegEntry = NoNulls(strRet) sdaGetRegEntry_Exit: On Error GoTo 0 Exit Function sdaGetRegEntry_Err: lngType = -1& Resume sdaGetRegEntry_Exit End Function
Then call it:
VB Code:
Private Sub Command1_Click() IEVersion = sdaGetRegEntry("SOFTWARE\Microsoft\Internet Explorer", "version") IEv = MsgBox("Your Are Using IE version " & IEVersion, vbInformation, "Version") End Sub