At 07:17 2009-08-03, Dave Crozier <[email protected]> wrote:
>Hi guys and Gals,
>I think I'm being a wee bit stupid here, but how can you get the name of the
>currently executing .exe from code running within that .exe. Obviously
>Program() and Sys(16) only give you the program levels within the .exe but I
>want the actual name as I am trying to catch if the .exe is renamed.
>
>I'm sure I have done this before in the dark distant past but I can't
>remember the API call I used.

      I have seen a number of solutions posted, but which one is it 
depends what you want the .exe name for.  I needed it for teling 
Adobe Acrobat to generate a PDF using the Adobe PDF printer.  The 
relevant code:

***** Start of Included Code *****
       * What is the name of executable that CBS2 is running under?
       * This is needed by the PDF reporting code.
       local sys16name, apptype, underruntime, vfpexename
       sys16name=sys(16,1)
       apptype=upper(right(sys16name,4))
       underruntime=version(2)=0
       vfpexename=_vfp.fullname
       do case
       case apptype=".FXP"     && .FXP under VFP development
          this.appexename=vfpexename
       case apptype=".EXE" and !underruntime     && .EXE under VFP development
          this.appexename=vfpexename
       case apptype=".EXE" and underruntime     && .EXE under VFP runtime
          this.appexename=sys16name
       otherwise     && unknown
          this.appexename=vfpexename
          endcase
***** End of Included Code *****

Sincerely,

Gene Wirchenko



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to