Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting When a Word Object no longer exists
Message
De
06/03/1998 11:11:00
 
 
À
06/03/1998 10:53:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00082838
Message ID:
00083012
Vues:
36
>>>>>I have a Word 97 (Word.application) object that I have programatically created which opens a file in Word97. How can I have VFP keep running in a loop until the user closes/exits Word97.
>>>>>
>>>>>In other words, how can I tell when the Word97 object no longer exists.
>>>>
>>>>Hi John,
>>>>
>>>>Following function gives information of current Word instance
>>>>
>>>>GETOBJECT("", 'word.basic') returns object data type which can be stored in some global method to determine existance of Word Application
>>>>
>>>>Get back to me if you still need more information
>>>>
>>>>bye
>>>>jayesh
>>>Hi Jayesh,
>>>I couldn't understand how I could use getobject() to check if the app is exited or not. Could you show it in following example ?
>>>
>>>oWord = createobject("word.basic")
>>>with oWord
>>>  .appshow
>>>  cDSN = "DSN=Visual FoxPro Tables;UID=;PWD=;"
>>>  cSourceDb = "SourceDB=C:\Program Files\vfp50\SAMPLES\DATA\Testdata.dbc"
>>>  cSourceType = ";SourceType=DBC;"
>>>  cOther = "Exclusive=No;BackgroundFetch=No;Collate=Machine;"
>>>  cSQLStatement = "SELECT company, contact FROM customer"
>>>  .InsertDatabase(35,511,0, ;
>>>		cDSN+cSourceDb+cSourceType+cOther, ;
>>>		cSQLStatement,,,,,,,1)
>>>endwith
>>>* Here I want to check if user exited word
>>>
>>>Cetin
>>
>>Besides chcking for Word App Window (api FindWindow), you can also simply issue oWord.Visible=.t. wrapped into error trap. If Word is quited you trap the error. I test it for Excel only, but don't think that Word is much different.
>Nope Ed. Tested it before. It's somewhat like VFP visible and returns .f. when application is not visible (it could be hidden but not exited). I couldn't find a way other than findwindow yet. There are activewindow and activedocument props also but both generate error when none is active (only word itself).
>Cetin

What about wrapping oWord.Appshow? I just tested and it generates error if Word is quited manually.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform