Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] OLE capabilities in SWT

Hi Felipe,

> 1.b Enter a bug

https://bugs.eclipse.org/bugs/show_bug.cgi?id=318942

> 1.c Can you create a OleAutomation using the constructor that takes a
> string ?

I can with my modified code. But creating an OleAutomation spawns the
process while what I need is to connect to a running instance. Typical
use case is that the user has Excel opened and you add a workbook to
that Excel.

At the native level, the idea is to call "GetActiveObject(clsid, NULL,
ppvObject)" where clsid is "Excel.Application" and create an
OleAutomation with the result.
This could be in the form of a factory method which can return null,
or a new OleAutomation constructor "OleAutomation(String progId,
boolean connectToExistingInstance)" which would throw an exception if
the application is not running (the caller could catch that exception
and decide to spawn a new one, tell the user, whatever).

> Try the patch in the bugzilla  93652, prove the patch is correct and
> complete (I don't remember what is state of it).

I ported the portions of the patch that were new to the current
version of Variant, and the code compiles. I do get a SafeArray
instance when reading the "value" property of a "Range" but I have to
work a bit more on it to extract the actual contained data. One thing
for sure is that there are still memory stuff in this API which does
not make it very high level, but I wonder if this is possible
considering the nature of SafeArrays...
I am referring to:
  int safeArrayPtr2 = 0;
  for (int j=0; j<safeArray2.rgsabound[0].cElements; j++) {
    safeArrayPtr2 = safeArray2.pvData + 16*j;
    Variant var2 = new Variant(safeArrayPtr2);
    var2.setSafeArray(safeArrayPtr2);
    ...

It is getting later here so I will try to investigate data extraction
and setting data in the coming days.

> Provide that the patch is good and doesn't break anything we should be
> able to include it for 3.7

That would be great!

> (I'd do it myself but I'm really don't have time right now, sorry)

I don't blame you, I think you do an awsome job and your answers are
very valuable. Keep up the good work!

>>Are there any plans to further improve OLE support in SWT?
>
> Nothing at this moment. Personally I'd be more interested on .Net
> Controls, see:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=135775

If the controls I had to manipulate right now were .NET controls, I
too would be supporting them :)
I'll keep an eye on this one, thanks for the link.

Cheers,
-Christopher


Back to the top