Login | |
|
 |
Getting the correct IE VErsion in VB6 from IEFRAME.DLL - 9/8/2008 6:28:40 PM
|
|
 |
|
| |
Vice26
Posts: 11
Score: 0
Joined: 8/18/2008
Status: offline
|
As you know, Microsoft hase changed the DLL with the version of IExplorer. With IE 4 up to 6.0.2900 (shipped with Win XP SP3) the ie version was called through SHDOCVW.DLL with the DLLGETVERSION Function. From IE7 and above SHDOCVW.DLL has changed to IEFRAME.DLL and that DLL CAN NOT be loaded in Vb6. I've searched for another method to get the file version from ANY dll or exe. Here is the code. Add in a form a command button and a text or label: Private Type VS_FIXEDFILEINFO dwSignature As Long dwStrucVersionl As Integer ' e.g. = &h0000 = 0 dwStrucVersionh As Integer ' e.g. = &h0042 = .42 dwFileVersionMSl As Integer ' e.g. = &h0003 = 3 dwFileVersionMSh As Integer ' e.g. = &h0075 = .75 dwFileVersionLSl As Integer ' e.g. = &h0000 = 0 dwFileVersionLSh As Integer ' e.g. = &h0031 = .31 dwProductVersionMSl As Integer ' e.g. = &h0003 = 3 dwProductVersionMSh As Integer ' e.g. = &h0010 = .1 dwProductVersionLSl As Integer ' e.g. = &h0000 = 0 dwProductVersionLSh As Integer ' e.g. = &h0031 = .31 dwFileFlagsMask As Long ' = &h3F for version "0.42" dwFileFlags As Long ' e.g. VFF_DEBUG Or VFF_PRERELEASE dwFileOS As Long ' e.g. VOS_DOS_WINDOWS16 dwFileType As Long ' e.g. VFT_DRIVER dwFileSubtype As Long ' e.g. VFT2_DRV_KEYBOARD dwFileDateMS As Long ' e.g. 0 dwFileDateLS As Long ' e.g. 0 End Type Private Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long Private Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As Long) As Long Private Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, ByVal Source As Long, ByVal length As Long) Public Function ReadVersion(FullFileName As String) As String Dim rc As Long, lDummy As Long, sBuffer() As Byte, lVerPointer As Long Dim lBufferLen As Long, udtVerBuffer As VS_FIXEDFILEINFO Dim lVerbufferLen As Long LeerVersion = 0 '*** Get size **** lBufferLen = GetFileVersionInfoSize(FullFileName, lDummy) If lBufferLen < 1 Then Exit Function End If '**** Store info to udtVerBuffer struct **** ReDim sBuffer(lBufferLen) rc = GetFileVersionInfo(FullFileName, 0&, lBufferLen, sBuffer(0)) rc = VerQueryValue(sBuffer(0), "\", lVerPointer, lVerbufferLen) MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer) '**** Determine Product Version number **** ReadVersion = Format$(udtVerBuffer.dwProductVersionMSh) & "." & _ Format$(udtVerBuffer.dwProductVersionMSl) & "." & _ Format$(udtVerBuffer.dwProductVersionLSh) & "." & _ Format$(udtVerBuffer.dwProductVersionLSl) End Function Private Sub Command1_Click() Dim s s = ReadVersion("c:\windows\system32\ieframe.dll") MsgBox s End Sub You can specifiy instead of the full path the windows directory
|
|
| |
|
|
|
|
|