Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execute microsoft word from a visual foxpro program
Message
 
To
18/07/2007 14:19:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01241684
Message ID:
01241690
Views:
18
>How I execute Microsoft word from with in a vfp 9 program? I would need to also check that user has winword program.
>
>Is this possible? If so how.
>
>
>TIA
IF _IsClassRegistered([Word.Application])
   **** Do whatever you want to do 
   **** the MS Word is installed
ELSE
  MessageBox([You have to install MS Word here])
ENDIF


FUNCTION _IsClassRegistered(tcClass)                          && If some class is registered

   LOCAL lnKey
   #define HKEY_CLASSES_ROOT    -2147483648
   #define ERROR_SUCCESS	 	0	&& OK

   DECLARE INTEGER RegOpenKey IN Win32API ;
           INTEGER nHKey, STRING @cSubKey, INTEGER @nResult

   DECLARE INTEGER RegCloseKey IN Win32API ;
           INTEGER nHKey

   lnKey    = 0
   llRetVal = (RegOpenKey(HKEY_CLASSES_ROOT, tcClass, @lnKey) = ERROR_SUCCESS)

   IF llRetVal
      RegCloseKey(lnKey)
   ENDIF

RETURN llRetVal
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform