Tutorial :MFC - Check if Microsoft Word Program Exists



Question:

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


Solution:1

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.


Solution:2

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.


Solution:3

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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »