>LOCAL lcfile, lcdir, lcbuffer, lnresult, lnpt, lcexecutable > >DECLARE INTEGER FindExecutable IN Shell32 STRING @lpfile, STRING @lpdirectory, STRING @lpbuffer >* lcfile is the file you want to find the executable for >lcfile = THIS.cFileToFindExecutableFor >lcdir = JUSTPATH(lcfile) >lcbuffer = SPACE(260) >lnresult = FindExecutable(@lcfile, @lcdir, @lcbuffer) >* There is a known bug in the find executable function that >* if the program was not installed properly with quotes around >* path names with spaces then the function will put the end of >* line character in the wrong place, so we will >* translate the chr(0) into a space and look for the char's .EXE >* which should be at the end of all our executables. >IF lnresult > 31 > lcbuffer = strtran(lcbuffer,CHR(0),' ') > *lnpt = AT(CHR(0), lcbuffer) > lnpt = AT('.EXE ', UPPER(lcbuffer))+3 > lcexecutable = LEFT(lcbuffer, lnpt) >ENDIF >RETURN lcexecutable>