Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting executable version - not working

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I have this code in my main.prg

Code:
LOCAL ARRAY  xinfo[1]
local lcExe,swversion
lcExe = 'ProjAn.exe'
Agetfileversion(xinfo,lcExe)
swversion = Alltrim(xinfo[10]) + " ver. " + Alltrim(xinfo[11])

I am using xinfo[10] and [11] from some old code I had used before.
In the debugger xinfo has no data.

What am I doing wrong please?

GenDev
 
Olaf,

Thanks.

I changed lcExe to
lcExe = ADDBS((mysystempath))+'ProjAn.exe' - which is where the exe is and all looks OK in the debugger.

I still get an empty array- sorry.

Gendev
 
Hi

I reckon the exe name is probably wrong, try using SYS(16) to be sure:

Code:
LOCAL ARRAY  xinfo[1]
local swversion
MESSAGEBOX(STR(Agetfileversion(xinfo,SYS(16))))
swversion = Alltrim(xinfo[10]) + " ver. " + Alltrim(xinfo[11]) 
MESSAGEBOX(swversion)

Works a treat for me - so long as the two values are completed on build (File Description and Version)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
I've used the example in the FAQ using foxtools. I now get the correct information which I put into a label on my form.

I am happy!

Thanks all who replied.

GenDev
 
If you get an empty array ADDBS((mysystempath))+'ProjAn.exe' can't be the correct path. Does it have the drive? full qualified path, including drive, all folders and exe file name.

Bye, Olaf.
 
That's why I suggested the SYS(16) which returns the full path and exe name.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
The other advantage of SYS(16) is that it also works if you are running in the development environment, in which case it returns the name of the root PRG file. That might be useful in some circumstances.

Keep in mind too that AGETFILEVERSION() only works if you have explicitly created a "Windows version resources" object, which you usually do in the Version dialogue. Otherwise, it returns zero and does not create the array.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Didn't know that, but indeed creating a new project all version information you enter in the Version dialog you get at from the Build dialog is empty, including the version number.
As gendev used foxtools.fll GetFileVersion() the file should have version information AGETFILEVERSION() also will get from an exe.

Anyway, if it works now, it works.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top