Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect Word?
Message
From
17/09/1999 13:14:42
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00265981
Message ID:
00266017
Views:
23
>I am looking for a way to reliably detect (in the Registry) the installation of Word'97 so I can use its spell-checker in my app. The best suggestion I have seen so far is to use the app associated with .doc via the code at the bottom of this post. The downside
>
>
> declare long FindExecutable in "shell32.dll" ;
> string cFile, string cDirectory, string @cResult
> cBuffer = space(255)
> nRetVal =
> FindExecutable("testit.doc",getenv('temp') , @cBuffer)
> if nRetVal < 32
>   messageBox("You don't have Word installed.",64,;
>    'File Opening Problem')
>   return
> endif
>
>
>The problem is that if a user has the Word Viewer installed, it will still return true; the same could be said if someone has WordPro installed....

Instead of checking the return value, check the value of cBuffer after the call is made. It will contain the full path to the executable registered as the default viewer. So you can:

nRetVal = FindExecutable("c:\somedoc.doc",getenv('temp') , @cBuffer)
llHasWord = LOWER(JUSTFNAME(cBuffer)) = "winword.exe"
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform