Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] Implementing IID_IDispatch from within Eclipse

This would work for me as well.

In my circumstance, both the Idispatch.java and OleAutomation.java
instances are unnecessary objects.  I'm just trying to generate an
IID_Idispatch instance for code outside eclipse.  To do that, I only
need to implement a subclass of COMObject, stuff the pointer into a
Variant (with proper flags set), and pass the variant to the outside
code.

When operating with Internet Explorer's APIs (esp. DHTML), the
IID_IDispatch sequence is pretty common.  Implementing IID_IDispatch by
hand - using a subclass of COMObject - is a pain, since I have to crack
the arguments to all the IID_IDispatch methods.  Perhaps the entire
sequence is worth a new Eclipse class -- something like
IDispatchImpl.java.  If you are interested, I could probably help with
such a beast.



-----Original Message-----
From: platform-swt-dev-admin@xxxxxxxxxxx
[mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of
Veronika_Irvine@xxxxxxx
Sent: Monday, February 25, 2002 10:19 AM
To: platform-swt-dev@xxxxxxxxxxx
Cc: platform-swt-dev@xxxxxxxxxxx
Subject: Re: [platform-swt-dev] Implementing IID_IDispatch from within
Eclipse



I have been debating whether I should allow the user to create an
OleAutomation object from the IDispatch address (which could be done
quite quickly because the API is already there, just not public) or
whether I should make Variant have API that would let the user create a
VT_DISPATCH variant from the IDispatch object directly.  I am inclined
toward the latter because OleAutomation creates an extra object when one
is not really required.  I think there should be a new Varaint(IDispatch
idispatch) constructor.



"Lynn Monson" <lmonson@xxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
19/02/2002 06:40 PM
Please respond to platform-swt-dev

        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:
        Subject:        [platform-swt-dev] Implementing IID_IDispatch
from within Eclipse


I'd like to propose a small change to the SWT/OLE APIs that facilitates
more sophisticated interactions with COM servers embedded in an SWT
application.

The setting is this: I'm building a plugin for Eclipse that needs to
interact with an embedded instance of Internet Explorer in a rather deep
way.  For example, I need to install DHTML event handlers and
"behaviors" into elements of the IE DOM.  To do this, I need to
generate, in Java, an implementation of IID_IDispatch, stuff it into a
Variant, and pass the variant into IE by way of OleAutomation.

I searched the newsgroups and couldn't find a way to do this using SWT.
However, after browsing the source, I found there was a way if the
following OleAutomation.java constructor were made public:

public OleAutomation(int address)

This allows me to create my own IID_IDispatch implementation using
COMObject.java

mydisp = new COMObject(new int[]{2, 0, 0,1,3,5,8}) {
  ...

  // GetTypeInfoCount
  public int method3(int[] args) {...}

  // GetTypeInfo
  public int method4(int[] args) {...}

  // GetIDsOfNames
  public int method5(int[] args) {...}

 // Invoke
 public int method6(int[] args) {...}
};

I can then send this IID_IDispatch to IE's DHTML model by saying:

oleAutoForIE.setProperty(
    dispIDOnMouseMove,
    new Variant(
       new OleAutomation( mydisp.getAddress() )
    )
);



_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev




Back to the top