Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine if MS Word is installed
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00415559
Message ID:
00416043
Vues:
38
>>>I hate the "trap error" routine for trying to make a determination such as this. I'd use the registry class and check for the existence of the Word.Application key under HKEY_CLASSES_ROOT. Then again, that's just me.
>>
>>But checking the registry only check to see if the class is registered. It doesn't ensure that the user didn't decide she likes WordStar better and delete the content of the Word folder.
>>
>>IOW, the error trapping routine is a catch-all, and checking the registry just checks the best clue...
>
>Don't buy it, Erik. Assuming that you've got an existing file name
DECLARE INTEGER FindExecutable IN Shell32;
>  STRING @lpFile, STRING @lpDirectory, STRING @lpResult
>* lcfile is the fully qualified file name of the type you're looking for
>lcbuffer = SPACE(260)
>IF FindExecutable(@lcfile, 0, @lcbuffer) > 32
>  lcbuffer = LEFT(lcbuffer, AT(CHR(0), lcbuffer) - 1)
>  ? FILE(lcbuffer)
>ENDIF
Determines both the associated application and whether or not it exists.

All that is easier than trapping the error, which does this and more?

Different strokes...
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform