Reputation: 12216
I have setup spell checking through WinWord but I need to find a way to in sure that Word 2007 is installed on there systems.
I have seen the Registry Versions of this but I also read that it can provide false positives. So I am in the 'market' as it were to figure out how to accomplish this. Can it be as simple as doing a File.Exists()
on WinWord.exe in the 2007 file path?
Any other ideas?
Upvotes: 0
Views: 683
Reputation: 1245
The best way would be use a combination. Use the registry to get the installation path. Inside of that path, you should find the executable. A false positive occurs because upgrades and uninstalls will sometimes remove the file but not the registry entry.
Upvotes: 0
Reputation: 598
If you are worried about the registry and false positives you can look at the exe version. Microsoft documents how to determine the executable version here
Upvotes: 0
Reputation: 1038720
Type word = Type.GetTypeFromProgID("Word.Application");
if (word != null) {
// Word is installed
}
To check that Word 2007 in particular is installed:
Type word = Type.GetTypeFromProgID("Word.Application.12");
if (word != null) {
// Word 2007 is installed
}
Upvotes: 5