************************************************************ * FUNCTION IsWordThere() ************************************************************ * Author............: José Constant * Project...........: Infodons * Created...........: 08/04/99 18:43:55 * Copyright.........: (c) Constant Software Systems, 1999 * Compiler..........: Visual FoxPro 05.00.00.0415 for Windows *) Description.......: Checks if Word is installed on the User PC *) : Based on a solution by George Tasker on the UT *) : Subject title 'More Fun with Excel OLE' *) : Posted April 7, 1999. *) : Assumes that FoxTools is loaded (VFP5) * Calling Samples...: IF IsWordThere() * : Do your thing * : ENDIF * Parameter List....: * Major change list.: Function iswordthere() Local lnerrfile, ; lcfile, ; lcpath, ; lcresult, ; lnresult, ; lnretval *-- Create a DUMMY.DOC file lnerrfile = FCREATE("DUMMY.DOC") If lnerrfile < 0 errormsg( cannottestforword_loc) Else Fclose(lnerrfile ) && Close file *-- find the app associated with it Declare INTEGER FindExecutable IN SHELL32; STRING @lcFile, ; STRING @lcPath, ; STRING @lcResult lcfile = "DUMMY.DOC" lcpath = JUSTPATH( FULLPATH( lcfile)) lcresult = SPACE( 260) lnresult = FindExecutable( @lcfile, @lcpath, @lcresult) Do CASE Case lnresult = 31 *-- no application associated with that file errormsg( wordnotonthispc_loc) Case lnresult > 32 If "WINWORD" $ UPPER( lcresult) lnretval = .T. Else errormsg( wordnotonthispc_loc) Endif Otherwise errormsg( wordnotonthispc_loc) Endcase Delete FILE dummy.DOC Endif Return lnretval Endfunc