[Last Call] Learn how to a build a cloud-first strategyRegister Now


Foxpro Can't Seem to Find Word 2007 under Windows 7

Posted on 2010-01-05
Medium Priority
Last Modified: 2012-05-08
Guys, I have a snippit of code that I have used for years to detect if a application exists under Windows, but it does not see to work with Windows 7.  Am I missing something.

If is look for a return from Checksserver('Word.application'), under Windows Vista and back on my machine it returns .T., but under Windows 7, .F.:

FUNCTION Checkserver
      LPARAMETER cServerName
      LOCAL oRegistry, cClassID, cEXEName, lEXEExists, ;
            aClassIDValues, aClassIDValues, aServerNameValues

      IF VERSION() = "Visual FoxPro 06" .OR. .T.
            oRegistry = NEWOBJECT("Registry", "Registry.vcx")
            SET PROCEDURE TO HOME() + "samples\classes\registry.prg" ADDITIVE
            oRegistry = CREATEOBJECT("Registry")
      lEXEExists = .F.
      DECLARE aClassIDValues[1], aServerNameValues[1]
      WITH oRegistry
            * Find the CLSID of the server. First, look for
            * the Class's Key.
            IF .OpenKey(cServerName + "\CLSID") = 0
                  * The Class's Key is open, now enumerate its values
                  * The data portion of the first (only) value returned
                  * is the CLSID. Find the LocalServer32 key for the CLSID
                  IF .OpenKey("CLSID\" + aClassIDValues[1,2] + "\LocalServer32") = 0
                        * Enumerate the LocalServer32 values
                        * The EXE file is stored in the first (only) data value returned.
                        cEXEName = aServerNameValues[2]
                        * The value that's returned may have " -Automation" or " /Automation" or
                        * " /AUTOMATION" & other trailing stuff at the end. Strip it off.
                        IF "AUTO" $ UPPER(cEXEName)
                              cEXEName = LEFT(cEXEName, ATC("AUTO", UPPER(cEXEName)) - 2)
                        * Verify that the file exists
                        lEXEExists = FILE(cEXEName)
      RETURN lEXEExists

Question by:fmoore0001
LVL 14

Accepted Solution

tusharkanvinde earned 2000 total points
ID: 26187464
You can try something like

RETURN llWordExists
LVL 27

Expert Comment

ID: 26188970
It could be that the registry checker is not working fine.

What I do is the same as tusharkanvinde. I try to run the automation object and trap the error and I don't include version numbers.
I use Excel.Application vs. Excel.Application.12.

I use VAL(VERSION(4)) to get a version number of FoxPro.

Author Closing Comment

ID: 31673286
Thanks.  You let me to a variation that was able to detect Word from Windows Server 2000 to Windows 7.  Thanks!

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question