Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / October 2003



Tip: Looking for answers? Try searching our database.

API Call

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger - 31 Oct 2003 12:24 GMT
I am trying to get file version info. When I run the following code, VB
closes (No error, nothing .. it just goes away!) when I run the last line.
Any comments???
Otherwise, any other way of getting the file info of a file that is not
running?

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

l_sFilename = (myfilename)

l_lVersionSize = GetFileVersionInfoSize(l_sFileName, l_lHandle)  ' this
returns 1201 for my test file
l_sBuffer = String$(l_lVersionSize, Chr$(0))
l_lBufferLen = Len(l_sBuffer) 'obviously, this is 1201
l_lRet = GetFileVersionInfo(l_sFileName, l_lHandle, l_lBufferLen,
l_sBuffer)

Roger
R.Wieser - 31 Oct 2003 13:38 GMT
Roger <rogor@mweb.co.za> schreef in berichtnieuws
bntgov$kfv$1@ctb-nnrp2.saix.net...

Hello Roger,

> I am trying to get file version info. When I run the following code, VB
> closes (No error, nothing .. it just goes away!) when I run the last line.
[quoted text clipped - 8 lines]
>   ByVal dwLen As Long, _
>   lpData As Any _
--------------^^^ (1)
>) As Long

> Private Declare Function GetFileVersionInfoSize Lib "version.dll" _
>  Alias "GetFileVersionInfoSizeA" ( _
[quoted text clipped - 10 lines]
>  l_lRet = GetFileVersionInfo(l_sFileName, l_lHandle, _
>     l_lBufferLen, l_sBuffer)
------------------^^^^^^^ (2)

You're defining "as any" (1), and are going to supply it with a string (2).
You are aware that strings should be transferred "by value" ?

Two options : change (1) to "By Val sBuffer as string", *or* change (2) to
"byval l_sBuffer".   My preferred change would be the first, as it make's me
impossible to mistakingly forget the "by val" at (2) :-)

Regards,
 Rudy Wieser
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.