Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetFileVersionInfo
Message
From
20/03/2000 15:02:29
 
 
To
All
General information
Forum:
Visual Basic
Category:
Windows API functions
Title:
GetFileVersionInfo
Miscellaneous
Thread ID:
00348050
Message ID:
00348050
Views:
48
I handled the version issue as follows. I think this will be ok after testing it on several exe's by various commercial suppliers. The HIWORD is sometimes used and sometimes the LOWORD is used. In some DLLs both the HI and LO are used so I wanted to be prepared for it. I have included the function for academia. This allows for our x.x.x standard in house and x.x.x.x for use in some rare DLL's.
ADim FileVer As String
Dim dwHandle&, BufSize&, lpvData$, R&

'*** Get Version Information If Available ****
FileVer = ""

BufSize& = GetFileVersionInfoSize(FileName, dwHandle&)
If BufSize& = 0 Then
   GetVersion = "Invalid File Name or no Version information available"
   Exit Function
End If
lpvData$ = Space$(BufSize&)
R& = GetFileVersionInfo(FileName, dwHandle&, BufSize&, lpvData$)
hmemcpy x, ByVal lpvData$, Len(x)

'**** Parse File Version Number ****
FileVer = Trim$(Str$(HIWORD(x.dwFileVersionMS))) + "."
FileVer = FileVer + Trim$(Str$(LOWORD(x.dwFileVersionMS)))

If Trim$(Str$(HIWORD(x.dwFileVersionLS))) Then
    FileVer = FileVer + "." + Trim$(Str$(HIWORD(x.dwFileVersionLS)))
End If

If Trim$(Str$(LOWORD(x.dwFileVersionLS))) Then
    FileVer = FileVer + "." + Trim$(Str$(LOWORD(x.dwFileVersionLS)))
End If

GetVersion = "Version of " & FileName & " is : " & FileVer
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Next
Reply
Map
View

Click here to load this message in the networking platform