wuxilixi
wuxilixi

Reputation: 357

Determine Excel Bitness in InstallShield 2012

I am building an installation package using InstallShield 2012 for an Excel add-in. Because MS Excel has 32-bit version and 64-bit version, I need to build installation packages separately. Ideally, the set up file should be able to detect the Excel bitness (not Windows bitness) during the first few steps of the installation before files are copied to target machine. However, after some extensive research online, I haven't found a reliable way of determining Excel bitness. Anyone with some ideas, please feel free to help. Thanks

Upvotes: 1

Views: 1339

Answers (3)

Nothing 2 Lose
Nothing 2 Lose

Reputation: 190

You should create 2 Properties to keep track of which version of Excel is installed, and then use these properties as Feature Conditions "EXCEL32_EXISTS=0". Here's the code I've used to accomplish this, initially both EXCEL32_EXISTS and EXCEL64_EXISTS are set to 0.

Excel_Installed=FALSE;
szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\excel.exe";

if (RegDBKeyExist(szKey)=1) then
        Excel_Installed=TRUE;
        RegDBGetKeyValueEx ( szKey, "Path", nvType, ExcelPath, nvSize );
        SprintfMsiLog( "Found Excel @ %s", ExcelPath );

        if ( StringContains(ExcelPath, "Office11")=TRUE ) then
            Excel_Installed=FALSE;
        elseif ( SYSINFO.bIsWow64=FALSE ) then
            MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1");
        elseif ( (StringContains(ExcelPath, "(x86)")=TRUE) || (StringContains(ExcelPath, "Office12")=TRUE) ) then
            MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1");
        else
            MsiSetProperty(hMSI, "EXCEL64_EXISTS", "1");
        endif;
endif;


export prototype BOOL StringContains(STRING,STRING);
function BOOL StringContains(szSource, szArgs)
    BOOL bContains;
begin

    if(szSource % szArgs) then
        bContains = TRUE;
    else
        bContains = FALSE;
    endif;

    return bContains;
end;

Upvotes: 0

Bogdan Mitrache
Bogdan Mitrache

Reputation: 11013

I had a similar discussion with an Advanced Installer user, you can check it out on our forums, the user wanted to detect the Office bitness.

Upvotes: 0

Charles Williams
Charles Williams

Reputation: 23520

Here is the (LUA - Setup Factory) code i use: it works even if Outlook is not installed.

-- check if 64 bit office installed

s64_14 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\14.0\\Outlook","Bitness",true);
s64_15 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\15.0\\Outlook","Bitness",true);
s64_16 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\16.0\\Outlook","Bitness",true);

bl64Bit = false;

if (s64_14=="x64" or s64_15=="x64" or s64_16=="x64") then
    bl64Bit = true
end

-- check for 64-bit OS
bl64BitOS=false;
if SessionVar.Expand("%ProgramFilesFolder%") ~= SessionVar.Expand("%ProgramFilesFolder64%") then
    bl64BitOS=true
end

Upvotes: 2

Related Questions