InstallShield How to do Excel installation or not detection

Source: Internet
Author: User

    • The traditional approach

It is common to start with the registry to detect whether an item exists in the registry to determine if Office is installed, and to determine the specific version of the installation by using the registry information.

    • Problems that exist

Because of the system, registry corruption, installation package and so on, the method of reading the registry is not reliable.

    • The Last method

When the result of the registry detection is not installed, then to create an instance of Excel, if the creation is successful, then the description is installed.

Some people will ask, why not start directly to create an instance, my answer is to create an Excel instance of memory consumption, the registry is valid when the detection is sufficient.

    • Finally put the code

//---------------------------------------------------------------------------
Doesexcelexist
Determine if Excel is installed
//---------------------------------------------------------------------------
function BOOL doesexcelexist ()
BOOL Bresult;
Begin
Regdb_options = regdb_options & ~regdb_option_wow64_64key;
Regdbsetdefaultroot (HKEY_LOCAL_MACHINE);
if (Regdbkeyexist ("Software\\wow6432node\\microsoft\\office\\excel") <0) Then
_out ("System does not has Excel, now check the system.");
if (Regdbkeyexist ("Software\\microsoft\\office\\excel") <0) Then
_out ("System does not has Excel too, now check is could create Excel object.");
if (! Createexcelobject ()) Then
_out ("So this system does not has Excel, return false.");
Bresult = FALSE;
Else
_out ("So this system has Excel, return true.");
Bresult = TRUE;
endif
Else
_out ("System has Excel, return.");
Bresult = TRUE;
endif
Else
_out ("System with Excel, return.");
Bresult = TRUE;
endif
Regdb_options = Regdb_options | Regdb_option_wow64_64key;
return bresult;
End

//---------------------------------------------------------------------------
Createexcelobject
Create an instance of Excel
Determine whether Excel is installed by success or not
//---------------------------------------------------------------------------
function BOOL Createexcelobject ()
OBJECT Excelobj;
Begin
Set excelobj = CreateObject ("Excel.Application");//Create an Excel object
if (IsObject (excelobj) = FALSE) Then
_out ("Create Excel object failed.");
Set excelobj = Nothing;
return FALSE;
endif
_out ("Create Excel object Successe.");
Set excelobj = Nothing;
return TRUE;
End

InstallShield How to do Excel installation or not detection

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.