>Hi All,
>I must know where is my application is running from. What function (built in or Win32Api) I must call to find out the desire thing.
> Thanks
Boris -
The code to use depends on whether your FoxPro application is an out-of-process .EXE server, an in-process .DLL server, or a stand-alone EXE. The following code was copied directly from Rick Strahl's article in the Dec-97 FoxPro advisor (page 48). Enjoy!
- Mark
----------------- code snippet below ------------------------
LOCAL ;
lcFileName, ;
lcPath, ;
lnBytes
DO CASE
*** OutOfProcess .EXE Server
CASE Application.StartMode = 2
*** Need to use API to retrieve the .EXE file name
DECLARE integer GetModuleFilename ;
IN WIN32API ;
integer hinst, ;
string @lpszFilename, ;
integer @cbFileName
lcFilename = space( 256 )
lnBytes = 255
GetModuleFileName( 0, @lcFileName, @lnBytes )
lnBytes = AT( chr(0), lcFileName )
if lnBytes > 1
lcFileName = substr( lcFileName, 1, lnBytes - 1)
else
lcFileName = ""
endif
lcPath = this.kJustPath( lcFileName )
*** InProcess .DLL Server
CASE Application.StartMode = 3
lcPath = HOME()
*** Standalone .EXE or VFP Development
OTHERWISE
lcPath = this.kJustPath( sys( 16, 0 ) )
ENDCASE
RETURN lcPath
----------
Mark Bucciarelli