Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Getting the correct IE VErsion in VB6 from IEFRAME.DLL

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,64130
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Getting the correct IE VErsion in VB6 from IEFRAME.DLL
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 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
 
 
Post #: 1
 
 RE: Getting the correct IE VErsion in VB6 from IEFRAME.DLL - 9/9/2008 6:53:36 AM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Vice26,

Or - to cut a long VBA story to short VBS code:


      

No offense/criticism of your carefully crafted code meant - I just see this as an example
for the rule "time spent on choosing the right tool is well spent".

Regards

ehvbs

(in reply to Vice26)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Getting the correct IE VErsion in VB6 from IEFRAME.DLL Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts