Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2005, 05:33 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default GetFileVersionInfo API- call

Hi all,

I am trying to determine the version of Windows Installer using VB6. I copied the API calls code into a module, and then made the following code in Form_Load:

file = "C:\WINDOWS\System32\msiexec.exe"
Size = GetFileVersionInfoSize(file, 0)
MsgBox "size = " & Size
version = GetFileVersionInfo(file, 0, Size, 10)
MsgBox "version = " & version

The code doesn't crash uptill "version = ......". I am wondering why my code crashes (i consider a VB6 crash as a code crash, since it happens when running the code)
Also, the filesize of the file is 77KB, though my messagebox says 2324 (KB, Bytes, Bits????). Not sure this is correct either.

Any tips, or preferably solutions are very welcome!

Thanks
Max
 
Old August 3rd, 2005, 11:45 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Max

For getting the version of the file, try this

(Make a reference to the Scripting Runtime scrrun.dll)
Dim fso As New FileSystemObject
MsgBox (fso.GetFileVersion("C:\WINNT\system32\msiexec.exe "))

I get a msgbox with version 2.0.2600.1183.

I guess i understood your problem and this is the alternate
for getting the file version

Hope this helps

With Regards,
Raghavendra Mudugal
 
Old August 4th, 2005, 02:41 AM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Raghavendra Mudugal,

I tried your code, after setting a reference, and it worked perfectly.

Thank you very much

Max
 
Old December 15th, 2005, 03:45 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello guys, that's a great tip, but does it only find the version of Windows?
I'm trying to find the version of .exe files using VB6.
Any help?
Thanks
Ahmad






Similar Threads
Thread Thread Starter Forum Replies Last Post
API mallik C++ Programming 2 February 20th, 2008 04:03 AM
API Panduchandra Visual C++ 1 March 27th, 2006 11:48 PM
VBA API karen999 Excel VBA 4 August 25th, 2005 10:13 AM
its about the jni API ogriddmut Dreamweaver (all versions) 1 June 29th, 2004 03:05 AM
How to Call EnumPrinter api in VB.NET bijanpanda VS.NET 2002/2003 0 December 15th, 2003 12:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.