Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation Question
Message
De
29/04/1999 05:53:36
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/04/1999 07:41:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00212770
Message ID:
00213356
Vues:
33
Ken,
oWord = Create("Word.Application")
could be substitued with :
oWord = getobject("","Word.Application") && Doesn't give error if first activation

checking isnull(oWord) doesn't help. If you make it visible (didn't try with nonvisible) then you could use winapi to check if it's alive. API calls I use are getforegroundwindow (when focus is in word) and iswindow (a do while loop). For an example check mailmerge class code in files\classes. It was written for nonVFP6 users and w95&97 compatible.
Cetin

>Erik,
>
>Thanks for reply - but in regard to #2 ... try ...
>
>oWord = Create("Word.Application")
>oWord.visible = .T.
>oWord.Activate
>? !IsNull(oWord) && returns .T. as expected
>
>Now - go to Word and close it
>
>? !IsNull(oWord) && still returns .T. - but errors any time you try to reference a property ie "oWord.name" and word is obviously, not "up".
>
>Am I missing something?
>Thanks,
>Ken
>
>
>
>>>1) Is there a way for my VFP word application object to respond to Word events? In particular a "Save", closing a document, and quitting Word? Would the new VFP COM object thing with its BindEvents() help?
>>>
>>
>>Boy are you in luck. The Word.Application object exposes exactly 2 events tat you can bind to a VFP object using the VFPCOM dll. ChangeDocument and Quit. Sounds like the 2 you need.
>>
>>
>>>2) Short of the above - I've noticed that when I create a word app object via loWord = Create("Word.Application"), and the user subsequently quits word, my object is still "an object" but trying to reference it gives an error. Is there any way short of some kludgy error trapping here to determine whether my "word object" is still up and running?
>>>
>>
>>is
>>
>>IF !ISNULL(oWord) kludgy?
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform