local lcProgram, ; > lcPath, ; > lcFileName, ; > lnBytes >lcProgram = sys(16, 0) >do case > >* In-process DLL server or Active Document. > > case atc('.VFD', lcProgram) > 0 or Application.StartMode = 3 > lcPath = home() > >* Out-of-process EXE server. > > case Application.StartMode = 2 > 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) > lcFileName = iif(lnBytes > 1, substr(lcFileName, 1, lnBytes - 1), '') > lcPath = justpath(lcFileName) > >* Standalone EXE or VFP development. > > otherwise > lcPath = justpath(lcProgram) > if atc('PROCEDURE', lcPath) > 0 > lcPath = substr(lcPath, rat(':', lcPath) - 1) > endif atc('PROCEDURE', lcPath) > 0 >endcase >return addbs(upper(lcPath))Thanks Doug. I'd forgotten about this post. Much appreciated.