Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361543

Summary: Can't call 32-bit Outlook with OleClientSite() to open message window on 64-bit Windows 7
Product: [Eclipse Project] Platform Reporter: M. Vossi <mail>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, thomas.klambauer
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description M. Vossi CLA 2011-10-20 09:37:11 EDT
Build Identifier: 20110916-0149

Trying to open Outlook with OleClientSite() always throws an SWTException returning "-2147221164" (I googled some forums and it probably means "class not registered").

MS Outlook is a 32-bit application. Using 64-bit Java to start the 64-bit application.

It works fine on 32-bit systems.

We need this feature to attach files automatically to the created mail.

Reproducible: Always

Steps to Reproduce:
Trying to open Outlook via
  Shell shell = HandlerUtil.getActiveShell(event);
  OleFrame frame = new OleFrame(shell, SWT.NONE);
  // This should start outlook if it is not running yet
  OleClientSite site =
    new OleClientSite(frame, SWT.NONE, "OVCtl.OVCtl");

or

  OleClientSite site2 =
    new OleClientSite(frame, SWT.NONE, "Outlook.Application");

always throws an SWTException returning "-2147221164".
Comment 1 Tom K CLA 2012-01-11 04:45:08 EST
OleClientSite should call somewhere CoCreateInstance:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686615%28v=vs.85%29.aspx
which is returning REGDB_E_CLASSNOTREG
//
// MessageId: REGDB_E_CLASSNOTREG
//
// MessageText:
//
//  Class not registered
//
#define REGDB_E_CLASSNOTREG              _HRESULT_TYPEDEF_(0x80040154L)

(http://msdn.microsoft.com/en-us/library/ms819775.aspx)
which is exactly "-2147221164".

So it seems the underlying COM components of Office are not registered in the 64bit branches of the registry. The question is whether Office32bit comes with 64bit versions of its COM component, which doesn't seem the case.

Just as a note, I think this problem has nothing to do with eclipse, it should occur with any 64bit application trying to use 32bit office through ole/com.

----

I had the same problem using OVCtl of a 64bit office from a 32bit Java/Eclipse app. However when using a 64bit JRE, it works just fine.
Comment 2 M. Vossi CLA 2012-01-11 05:24:59 EST
OK, when I got it right this the problem is that the Office has not registered its 32-bit components in the 64-bit registry branch. So, the OLE component can't be found from a 64-bit application.

This seems to be a conceptual problem. But how to solve it? I wouldn't expect Microsoft to fix it.

I can understand that Office is registering its components in only one registry branch - either 32 or 64 bit. Then, there should be a fall-back mechanism when in the 64-bit branch no registered component could be found, it should look for something in the 32-bit branch and vice versa?

Are there any issues to implement a fall-back solution in that way?
Comment 3 Tom K CLA 2012-01-11 06:12:09 EST
Probably the reason is that these 64bit components simply don't work with 32bit applications and therefore not "visible"/registered to/for them. Such that this fallback might not work if implemented. Maybe there are some more ressources on the Internet about using 64bit office through ole/com with a 32bit app.
Comment 4 Felipe Heidrich CLA 2012-01-11 15:40:20 EST
Thank you for the investigation.
closing as not Eclipse, agreed ?
Comment 5 Tom K CLA 2012-01-12 08:49:37 EST
I agree.

Also tested it with a quick C# program that uses the same COM component and had the same problem. As I said, it seems not directly possible to use (this outlook view control from) Office 64 bit through COM out of a 32 bit application, which seems to be Microsoft's intention, the way that the components are installed.

Vossi's comment and original bug report suggests that the same problem exists from 64->32 office (which I myself cannot verify here).