Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application version enquiry

Status
Not open for further replies.

barkerj

Programmer
Nov 4, 2002
14
AU
We are using VB6 and I would like to know whether it is possible to determine the version of an exe. When I right click on the exe and go to properties there is no version info apparent so maybe if I put the version in the title area? I do not wish to run the exe.
 
The version info is determined at compile time by the settings in Project|Properties on the Make Tab. It should then be visible under Properties for the .exe

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks johnwm for your reply. I should have worded my question better.

From my application I need to retrieve the version number of another program.
 
I would look at using version.dll

There is some sample code to get you going here:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Also the the filesytemobject has a GetFileVersion method:

MsgBox CreateObject("Scripting.FileSystemObject").GetFileVersion("C:\SomePath\SomeFile.exe")

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Thanks johnwm and DrJavaJoe. I tried both your suggestions but still not getting a version number. They only work for those files that have a version number ie if you right click on the file and choose properties, a version tab appears. The exe I am trying to get info from does not have this version info. I am wondering, if I add the version info to the title field, on the Summary tab of the file's properties, can I retrieve this value in the program that I am developing?
 
The VERSIONINFO structure (which is what the FSO and version.dll look for) is added to an executable at compile time. As you've found out, not all executables have them, in which case your program will need to gracefully degrade to comparing create-dates and filesizes.

The version information that you're seeing is provided by a shell extension, and is not stored in the file itself. I don't think it will survive the file being copied to the network & back again.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
I would check for the CreateDate or DateModified instead if the version returns ""

Dim f
Set f = CreateObject("Scripting.FileSystemObject").GetFile("C:\CDs\Test2.mp3")
MsgBox f.DateLastModified
MsgBox f.DateCreated

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
I see what you are getting at DrJavaJoe.
My problem is that I have to have our application display the version number of another program. This other application is third party software. If we install an upgraded version of the third party software I want our in-house application to automatically register the new version number of that program without us having to go in and upgrade our own application. If I use the LastModified or Created properties suggested we will still need to change our app so that it can convert this information into the appropriate version number for display.
I am beginning to think the only way that I will be able to accomplish this is to create a new file in which is the version number of the third-party app. Our application can then read this file to extract the version info. This way, it is only this new file that we need to change when upgrading the other software (our own app does not need to be changed).
 
If we install an upgraded version of the third party software I want our in-house application to automatically register the new version number of that program without us having to go in and upgrade our own application.
Or demand that the 3rd party vendor include version information in their product (as they should be doing).

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top