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


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