程序路径的自动查找
一般运行程序的目录并非固定不变,因此一般在程序启动时都要查询当前运行程序的目录。下面这段程序给出当前路径的查询方法:
Function SetPath()
LOCAL lcSys16, lcProgram
lcSys16 = SYS(16) &&查询当前运行程序名
lcProgram = SUBSTR(lcSys16, AT(":", lcSys16) - 1)
CD LEFT(lcProgram, RAT("\", lcProgram))
*-- If we are running MAIN.PRG directly, then
*-- CD up to the parent directory
IF RIGHT(lcProgram, 3) = "FXP"
CD ..
ENDIF
SET PATH TO PROGS, FORMS, LIBS, ;
MENU, DATA, ;
REPORTS, INCLUDE, HELP, ;
BITMAPS
SET CLASSLIB TO MAIN ,vfptool
ENDFUNC