tags:

views:

271

answers:

3

Hi, I was wondering if there is any way to figure out programatically if Microsoft Word (Word 2003) exists on the target PC. Creating this app on VS2005, C++.

Thanks

A: 

Looping over the registry keys is an option e.g: all entries under HKEY_CURRENT_USER\Software\Microsoft\Office and see what the most recent version is. Depends on your performance and exact requirements.

dirkgently
+1  A: 

You could create a new Word.Application COM object and read the Version property. Unfortunately that would take a few seconds until Word is loaded. (That is if it is installed)

If you cannot create the object, then Word is not installed. If it can be created and has a lower version number, only an old version is available.

DR
A: 

The easiest way is probably to check the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office registry keys.

Under this tree there is a node for every version of Office, and under each version the installed projects have their own sub-key (Excel, Outlook, Word etc) that specifies the path it was installed to.

Note there may be multiple versions installed on a single PC. E.g. I have;

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0
Andrew Grant
Especially the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\InstallRoot is interesting. The Office root key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0 might be created by other applications as well.
0xA3
Right - I mean check what's in these keys, not just the presence of the keys themselves.
Andrew Grant