Microsoft
Software
Hardware
Network
Question : Foxpro Can't Seem to Find Word 2007 under Windows 7
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.applica
tion'), 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")
ELSE
SET PROCEDURE TO HOME() + "samples\classes\registry.
prg" ADDITIVE
oRegistry = CREATEOBJECT("Registry")
ENDIF
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
.EnumKeyValues(@aClassIDVa
lues)
* 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
.EnumKeyValues(@aServerNam
eValues)
* 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)
ENDIF
* Verify that the file exists
lEXEExists = FILE(cEXEName)
ENDIF
ENDIF
ENDWITH
RETURN lEXEExists
ENDFUNC
Answer : Foxpro Can't Seem to Find Word 2007 under Windows 7
You can try something like
llWordExists=.T.
TRY
loWord=CREATEOBJECT('Word.
Applicatio
n')
loWord.quit
CATCH
llWordExists=.F.
ENDTRY
RETURN llWordExists
Random Solutions
How to configure license for terminal services on Windows 2008 if we have Volume License
how to import multiple contacts into office communicator 2007?
cursor location
Microsoft, Office, 2003, "There is not enough free disk space in the echo directory. Please delete one or more files from the echo directory before procedding."
Lock down website usine web.config file
The process could not execute 'sp_replcmds'
OWA 2007 Password Change Working with ISA 2006 When it Should Not.
access 2007 "Invalid field definition 'CustomerID' in definition of index or relationship
Pass user-defined table name to another form and run DoCmd.CopyObject
Progress meter on an append query