Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine existence of objects (Outlook, custom App obje
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00428456
Message ID:
00429013
Vues:
24
>You should use Type("oSwitch")=="O" not VarType(oSwitch).
>

That's bad thinking - VarType() works fine for checking object existances; it only smokes if you try checking a property or method of a non-existant object. VarType() is considerably faster than Type(), and if you know what you're doing using it is quite acceptable, and often preferable, since it differentiates between operable objects and nulled object refs without a separate IsNull() call.

>Simon
>
>>>I have a couple of questions that probably have simple answer (hence, I couldn't figure them out myself :).
>>>
>>>1. I have error handling in my app that prints a report in the event of an unhandled error and then gracefully shots down the app. I would like to have the error report e-mailed to us if the user has Outlook. I know how to handle the e-mail peice, but I would like to check for the existence of Microsoft Outlook on a users P.C. - if they have Outlook, an e-mail is fired off - if not, a report is printed that would have to be faxed to us. How would I check to see if Outlook is intalled on the workstation? (I would have tried a few things here before posting this - except that all our internal P.C.'s have Outlook.)
>>
>>Probably the best (IMO) way to do this is try to create the object and trap the failure error. This will determine if its on the system and if its installed correctly so you can access it.
>>>
>>>2. I also have an application object with its own custom properties. How would I check to determine if the application object (named: oSWITCH) is active in memory?
>>
>>Check out VARTYPE(myvariable) in the VFP help.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform