I want to find whether ms office is installed and version of it... how can i do it 开发者_开发问答?
Microsoft Office Version Detector
How does it work?
The code is based on an outdated Microsoft knowledge base article Q247985 (the code in the knowledge base article does not work for Office 2003 or 2007). The code looks for a specific registry key which holds the version for each application (e.g. HKEY_CLASSES_ROOT/Excel.Application/CurVer for Excel) which contains the version encoded in a string ("Excel.Application.11" on my computer). The internal Microsoft version number (i.e. the "11" at the end of "Excel.Application.11" ) is then mapped to the external "marketing" name, that you will be more familiar with (e.g. the internal version "11" is more commonly known as "Office 2003").
Since you've tagged it as visual C++, I'm assuming you want to do it in C++.
One way is to parse through the following registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
For e.g.
Enumerate this key and find out if the value displayname
contains Microsoft Office Excel MUI (English) 2007
You may also find the version number in other values like version
, versionmajor
, verisonminor
FYI you can use this registry key to find out almost any software which 'installs' on your system.
This is only for 32 bit installation though. For 64-bit installation, you'll need to find a similar tree structure inside registry node WOW6432Node.
精彩评论