Now that Office also comes in a 64bit install, where in the registry do you find out if the version of Office installed is 32bit or 64bit?
Attention: querying the bitness of the Outlook Application does NOT reliably work if called in .NET environment.
Here, we use GetBinaryType() in a DLL that can be called by any application:
With exactly the same DLL code and exactly the same Outlook binary path ("c:/Program Files (x86)/...") on the same computer.
Meaning that you might need to test the binary file yourself using "IMAGE_NT_HEADERS.FileHeader.Machine" entry.
God, I hate the incorrect return values of some Windows APIs (see also GetVersion() lie).
I've previously blindly followed the answer based on the MSDN docs. Today, this turned out to be less than required. On a machine with Office Home and Student installed, which doesn't include Outlook, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Outlook
was present, but HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook
was not. I've now changed my code to first look for the "plain" non-Wow6432Node version. If that's present, it'll be used. If not, it will continue by looking at the Wow6432Node version. This is being checked in an Inno Setup-based installer - I don't know which APIs Inno Setup uses. If your app doesn't access the registry in the same way, you might see different results.
I've tested Otaku's answer and it appears that the Outlook bitness value is set even when Outlook is not installed, even though the article referenced does not clearly indicate that this would be the case.
EDIT : Solution without touching RegistryKeys - im Sorry Op.
I found out that there is a solution in C# - the original can be found here : https://blogs.msdn.microsoft.com/webdav_101/2016/07/26/sample-detecting-installed-outlook-and-its-bitness/
I modified it a bit for my needs.
just pass the correct outlookPath to GetOutlookBitness()
public enum BinaryType : uint
{
SCS_32BIT_BINARY = 0, // A 32-bit Windows-based application
SCS_64BIT_BINARY = 6, // A 64-bit Windows-based application.
SCS_DOS_BINARY = 1, // An MS-DOS – based application
SCS_OS216_BINARY = 5, // A 16-bit OS/2-based application
SCS_PIF_BINARY = 3, // A PIF file that executes an MS-DOS – based application
SCS_POSIX_BINARY = 4, // A POSIX – based application
SCS_WOW_BINARY = 2 // A 16-bit Windows-based application
}
[DllImport("kernel32.dll")]
static extern bool GetBinaryType(string lpApplicationName, out BinaryType lpBinaryType);
public int GetOutlookBitness(string FilePath)
{
int bitness = 0;
if (File.Exists(FilePath))
{
BinaryType type;
GetBinaryType(FilePath, out type);
switch (type)
{
case BinaryType.SCS_32BIT_BINARY:
bitness = 32;
break;
case BinaryType.SCS_64BIT_BINARY:
bitness = 64;
break;
}
}
return bitness;
}
This Wikipedia article states:
On 64-bit versions of Windows, there are two folders for application files; the
"Program Files"
folder contains 64-bit programs, and the"Program Files (x86)"
folder contains 32-bit programs.
So if the program is installed under C:\Program Files
it is a 64-bit version. If it is installed under C:\Program Files (x86)
it is a 32-bit installation.
Here's what I was able to use in a VBscript to detect Office 64bit Outlook:
Dim WshShell, blnOffice64, strOutlookPath
Set WshShell = WScript.CreateObject("WScript.Shell")
blnOffice64=False
strOutlookPath=WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe\Path")
If WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") = "AMD64" And _
not instr(strOutlookPath, "x86") > 0 then
blnOffice64=True
wscript.echo "Office 64"
End If