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!

How can you know the name of the exe-file you're executing?

Status
Not open for further replies.

INFORMAT

Programmer
Jan 3, 2001
121
BE
Now I use the function ADIR to get some information about our running exe-file 'student.exe':

dimension lExeInfo(1)
lProgName='student.exe'
=adir(lExeInfo,'&lProgName')
thisform.txtDatInstal.value=dtoc(lExeInfo[1,3])+' - '+lExeInfo[1,4]

To try things in the field before publishing it to the real users, I like to compile to a file name 'student1.exe'. In that case the upper code wil not work, because the exe-file name isn't 'student.exe' but 'student1.exe'...

I need VFP-code to use in my application to know the name of the exe-file that is currently executing. In that case I don't have to hard-code the variabel lProgName.

Who can help me?

 
Hi!

Use sys(16) function in the topmost program. For example, when your startup module in project is a program file 'main.prg', add following lines there:

public gcAppPath
gcAppName = JUSTFName(sys(16))

gcAppName variable will contain 'SOMEFILE.EXE' if your exe file named 'SOMEFILE' and you running it as standalone EXE application. If you run just 'main.prg' from development environment, you will get 'MAIN.FXP'

Note that you can get a full path to the application, that is useful too in many cases.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi,
Does Application.Servername help. It returns full path VFP EXE.

Jimmy
Jimmy Le
nhan_tiags@yahoo.com
 
Hi,
Does Application.Servername help.? It returns full path VFP EXE.

Jimmy
Jimmy Le
nhan_tiags@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top