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
>
>>Both of those commands show "vfp.exe". I guess I did not say it right, I need the application executable name, like: payroll.exe or genSrvcs.exe.
>>
>>>>Is there any way to capture the name of the executable while the app is running. I want to use a variable for that name to use in the newobject function oObj=newobject(class,parentclass,sExe), where sExe=executablename.
>>>>
>>>>Thanks
>>>
>>>
lcExeName = SYS(16,1)
>>>* or
>>>lcExeName = _vfp.ServerName
Extreme Programming = Plan -> Design -> Code -> Test