Hi Chris,
Thanks for the prompt reply but
I can see the fileversion and other version in the details section of properties of the executable
but not able to get the fileversion information . Always getting 0.0.0.0 for fileversion
The following code works for the 32 bit application but not for the 64 bit Pcode . the runtime environment is 64 bit created from Powerbuilder runtime package 2022 R3
// as_filename represent exe file name built on 64 bit runtime
try
ulong dwHandle, dwLength
string ls_Buff, ls_key, ls_versioninfo
uint lui_length
long ll_pointer
integer li_rc
runtimeerror le_ex
le_ex = create runtimeerror
// Get version info length
dwLength = GetFileVersionInfoSize( as_filename, dwHandle )
IF dwLength <= 0 THEN
Throw le_ex
END IF
// Get version info text
ls_Buff = Space( dwLength )
li_rc = GetFileVersionInfo( as_filename, dwHandle, dwLength, ls_Buff )
IF li_rc = 0 THEN
Throw le_ex
END IF
// the strange numbers below represents the country and language
// of the version resource.
ls_key = "\StringFileInfo\040904e4\FileVersion"
IF NOT VerQueryValue( ls_buff, "\\", ll_pointer, lui_length ) OR lui_length <= 0 THEN
// Failed to find the version
Throw le_ex
ELSE
// Extract verson from the text
ls_versioninfo = Space( lui_length*2 ) // times 2 for unicode characters
CopyMemory( ls_versioninfo, ll_pointer, lui_length*2)
END IF
catch (runtimeerror err1)
ls_versioninfo = "0.0.0.0" // Unknown
end try
Thanks