The code will return the name of the latest called exe because program stack goes from the main program (level 1) and down calling chain.
In VFP7 you can use ASTACKINFO( ) Function to get this info into an array.
>I took the lazy way and created a class property (default="")for the application name and put a messagebox in an if for "not empty" do the newobject. I will need to test your code. You are right, I do call this app (and many others) from an executable. All names end in ".exe", even vfp. So how do I know I have the application name?
>
>>It would work if application is run as standalone EXE. If yiou're running your application from within VFP than you've to dig thru program stack. Something like
lnlevel = 2
>>lcExeName = ""
>>DO WHILE NOT EMPTY(SYS(16,lnlevel))
>> IF RIGHT( UPPER( SYS(16,lnlevel)), 4) = ".EXE"
>> lcExeName = SYS(16,lnlevel)
>> ENDIF
>> lnlevel = lnlevel + 1
>>ENDDO
>>
< snip >
--sb--