Link to home
Start Free TrialLog in
Avatar of finster
finster

asked on

VB6 and version numbers

If you compile a VB6 exe, there is an option to increment the version number. If you look at the app in Wondows Explorer, there is a properties tab, which will display the version number without having to run the program and interrogate the app.major, app.minor, app.revision properties.

Is there an API call that can be used in VB6 that will work with Win95, Win98, and WinNT that can interrogate the app and bring back the version numbers?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of MTroutwine
MTroutwine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of finster
finster

ASKER

Hi there,

This works brilliantly!

The only change I would make is in the GetFileVersionInformation function, I would change:
====================================
....
For i = 0 To 7
   buffer = String(255, 0)
   strTemp = "\StringFileInfo\" & Lang_Charset_String & "\" & strVersionInfo(i)
   
   lRet = VerQueryValue(sBuffer(0), strTemp, lVerPointer, lBufferLen)

   If lRet = 0 Then
      GetFileVersionInformation = eNoVersion
      Exit Function
   End If
   ... [rest of code]
next i
====================================

TO

====================================
....
For i = 0 To 7
   buffer = String(255, 0)
   strTemp = "\StringFileInfo\" & Lang_Charset_String & "\" & strVersionInfo(i)
   
   lRet = VerQueryValue(sBuffer(0), strTemp, lVerPointer, lBufferLen)

   If lRet > 0 Then

      ... [rest of code]
   end if
next i
====================================

this way the whole UDT can be filled, and the function does not end if there is no tFileInfo.FileDescription returned.