Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319027 - [OLE] Not possible to connect to a running instance of an OLE component.
Summary: [OLE] Not possible to connect to a running instance of an OLE component.
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-06 11:55 EDT by Christopher Deckers CLA
Modified: 2022-01-04 20:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Deckers CLA 2010-07-06 11:55:35 EDT
Build Identifier: 3.6

Excel and other OLE components allow to be connected to, rather than creating a new instance.

The OleAutomation API does not allow to specify whether we should try to connect to an existing instance.

For example, there could be such constructor:
new OleAutomation(String progId, boolean connectToExisting);

if(connectToExisting) {
  // Native call currently missing from SWT definitions
  COM.GetActiveObject(appClsid, NULL, ppvObject)
} else {
  COM.CoCreateInstance(appClsid, 0, COM.CLSCTX_LOCAL_SERVER | COM.CLSCTX_INPROC_SERVER, COM.IIDIUnknown, ppvObject);
}

Such a feature is important when piloting Excel and such APIs because we don't want to create a new instance. A work around for Excel seems to work, but it is not enough because if an instance cannot be found it will create one rather than throwing an Exception that can be caught and acted upon. This workaround is:
  // Note: the next line works with patch from bug 318942
  OleAutomation sheet = new OleAutomation("Excel.Sheet");
  OleAutomation application = sheet.getProperty(sheet.getIDsOfNames(new String[] {"Application"})[0]).getAutomation();


Reproducible: Always

Steps to Reproduce:
new OleAutomation("Excel.Application", true)
Comment 1 Eclipse Webmaster CLA 2019-09-06 15:35:31 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 2 Eclipse Genie CLA 2022-01-04 20:12:32 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.