Registry Detection Office version

Source: Internet
Author: User

# Region Query the registry and determine whether the local machine is installed with office2003, 2007, and WPS

Public int existsregedit () {int ifused = 0; registrykey rk = registry. localmachine; // query office2003 registrykey f03 = rk. opensubkey (@ "SOFTWARE \ Microsoft \ Office \ 11.0 \ Excel \ installroot \"); // query office2007 registrykey f07 = rk. opensubkey (@ "SOFTWARE \ Microsoft \ Office \ 12.0 \ Excel \ installroot \"); // query WPS registrykey WPS = rk. opensubkey (@ "SOFTWARE \ Kingsoft \ Office \ 6.0 \ common \"); // check whether the local machine has office2003 if (f03! = NULL) {string file03 = f03.getvalue ("path "). tostring (); If (file. exists (file03 + "excel.exe") ifused + = 1;} // check whether the local machine has office2007 if (f07! = NULL) {string file07 = akey. getvalue ("path "). tostring (); If (file. exists (file07 + "excel.exe") ifused + = 2;} // check whether WPS is installed on the local machine if (WPS! = NULL) {string filewps = akeytwo. getvalue ("installroot "). tostring (); If (file. exists (filewps + @ "\ office6 \ et.exe") ifused + = 4;} return ifused ;}

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.