Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TAKE 2: Contained description of an EXE file
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00582794
Message ID:
00583453
Views:
27
Hi,
I don't know why AGETFILEVERSION doesn't work with Wise Installer files, and all I can suggest is using WinAPI. The code below not fully tested, but seems to be working even with Wise Installer files:
Function FileDescr(cFile)

Declare Long GetFileVersionInfoSize in Version.dll ;
	String@ FileName, Long Handle
Declare Long GetFileVersionInfo in Version.dll ;
	String@ FileName, Long Handle, Long Len, String@ Data
Declare Long VerQueryValue in Version.dll ;
	String@ Block, String@ SubBlock, Long@ Buffer, Long@ Len
Declare RtlMoveMemory in Win32API As MoveMemory ;
	String@ Dest, Long Source, Long length
Declare Long lstrlen in Win32API Long StrPtr

Local cData, cSubBlock, nLen, nVer, cDescr
nLen = GetFileVersionInfoSize(@cFile, 0)
If nLen > 0
	cData = Replicate(Chr(0), nLen)
	GetFileVersionInfo(@cFile, 0, nLen, @cData)
	* 0409 - US English, 04e4 - 1252 code page
	* You may also try 1200 code page (04b0)
	cSubBlock = "\StringFileInfo\040904e4\FileDescription"
	nLen = 0
	nVer = 0
	If VerQueryValue(@cData, @cSubBlock, @nVer, @nLen) != 0
		nLen = lstrlen(nVer)
		cDescr = Replicate(Chr(0), nLen)
		MoveMemory(@cDescr, nVer, nLen)
		Return cDescr
	EndIf
EndIf
Return "No description"
EndFunc
>In thread # 581909, Alexander Golovlev attempted to assist me with parsing out the Windows file description contained in an EXE file using the VFP internal AGETFILEVERSION() function.
>
>Unfortunately, it only seems to work about half the time. Many EXE files, which show a Windows description in Explorer/My Computer, can't evidently be seen by the function and it returns 0 with no information in the array.
>
>These files seem to have one common "thread" (pun intended) -- they have all been created with the Wise Installer (at least, the Wise Installation Wizard comes up when I run each one separately). I have *hundreds* of these files for which I need to grab the contained description.
>
>Anybody out there know another way to get this info besides AGETFILEVERSION?
Previous
Reply
Map
View

Click here to load this message in the networking platform