Home » Eclipse Projects » Standard Widget Toolkit (SWT) » OLE events without id
|
Re: OLE events without id [message #451202 is a reply to message #451186] |
Thu, 24 February 2005 15:01 |
Tiberiu Caprita Messages: 68 Registered: July 2009 |
Member |
|
|
Hi Elmar,
I don't know if I got your problem or not, but if you don't know which
Event you want to listen to then you can't do something.
Normally when you set a Listener to a OleControlSite you use
addEventListener(int eventID, OleListener listener) or
addEventListener(OleAutomation automation, int eventID, OleListener
listener) (if you listen other interface than that of OleControlSite).
As you see, eventID (event that can be listen) is mandatory to be known.
But for some Applications, getDefaultEventSinkGUID() returns null (by
example Outlook) and you have to find a fix yourself.
The solution is based on the code that follow the
getDefaultEventSinkGUID() in addEventListener():
you have to find the GUID you want to listen to and call
void addEventListener(int iunknown, GUID guid, int eventID, OleListener
listener)
As summary if you see that getDefaultEventSinkGUID() returns null (make a
debug) you have to:
1. find the UUID of Event Interface you want to listen
2. Transform it in GUID
3. hack the swt in order to can call addEventListener(int iunknown, GUID
guid, int eventID, OleListener listener), and call it with your params.
Hope it helped.
Tiberiu
Elmar Bartowitsch wrote:
> Hi all.
> I need to embed an ActiveX control in my SWT app. Displaying and
> controlling it works fine, but I didn't work out a way to receive events
> from the control. As far as I know, this should be done by adding an
> OleListener to the OleControlSite. I have to provide the event's id to
> OleControlSite.addEventListener, and here's my problem: It seems the
> events of this control don't have dispatch ids. Calling
> OleAutomation.getIDsOfNames didn't bring any results; looking into the
> IDL of the component, I found that the events don't have an id tag.
> Is there a way of receiving these events using the OLE framework of SWT?
> Regards,
> eb
|
|
|
Re: OLE events without id [message #451212 is a reply to message #451202] |
Thu, 24 February 2005 15:19 |
Elmar Bartowitsch Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Thanks a lot for your reply. I'll try this approach as soon as I have
some more time. For now, I found a way to 'simulate' the event I need.
thx,
eb
Tiberiu Caprita wrote:
> Hi Elmar,
> I don't know if I got your problem or not, but if you don't know which
> Event you want to listen to then you can't do something.
>
> Normally when you set a Listener to a OleControlSite you use
> addEventListener(int eventID, OleListener listener) or
> addEventListener(OleAutomation automation, int eventID, OleListener
> listener) (if you listen other interface than that of OleControlSite).
> As you see, eventID (event that can be listen) is mandatory to be known.
>
> But for some Applications, getDefaultEventSinkGUID() returns null (by
> example Outlook) and you have to find a fix yourself.
> The solution is based on the code that follow the
> getDefaultEventSinkGUID() in addEventListener():
> you have to find the GUID you want to listen to and call void
> addEventListener(int iunknown, GUID guid, int eventID, OleListener
> listener)
>
> As summary if you see that getDefaultEventSinkGUID() returns null (make
> a debug) you have to:
> 1. find the UUID of Event Interface you want to listen
> 2. Transform it in GUID
> 3. hack the swt in order to can call addEventListener(int iunknown, GUID
> guid, int eventID, OleListener listener), and call it with your params.
>
> Hope it helped.
>
> Tiberiu
>
>
>
>
> Elmar Bartowitsch wrote:
>
>> Hi all.
>
>
>> I need to embed an ActiveX control in my SWT app. Displaying and
>> controlling it works fine, but I didn't work out a way to receive
>> events from the control. As far as I know, this should be done by
>> adding an OleListener to the OleControlSite. I have to provide the
>> event's id to OleControlSite.addEventListener, and here's my problem:
>> It seems the events of this control don't have dispatch ids. Calling
>> OleAutomation.getIDsOfNames didn't bring any results; looking into the
>> IDL of the component, I found that the events don't have an id tag.
>
>
>> Is there a way of receiving these events using the OLE framework of SWT?
>
>
>> Regards,
>> eb
>
>
>
|
|
| |
Re: OLE events without id [message #451291 is a reply to message #451202] |
Thu, 24 February 2005 17:08 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
Sometimes, the events are not directly on the activeX control you created
but on one of the inner automation objects. You may need to get something
like the "Document" automation object first before you can query for the
event ids.
Also, for some events active X controls don't use the ConnectionPoint/Advise
mechanism but instead require that you pass in an IDispatch object as a
property to be notified of changes. For example in IE, onkeydown is sent to
an IDispatch object registered against that property.
For an example see:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet123.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
Particularly, look at :
myDispatch = new EventDispatch(EventDispatch.onkeydown);
idispatch = new IDispatch(myDispatch.getAddress());
dispatch = new Variant(idispatch);
htmlDocument.setProperty(EventDispatch.onkeydown, dispatch);
and the implementation of EventDispatch (also in the snippet).
If all else fails, post some of the IDL to these newsgroup and maybe we can
figure out how you need to call the thing.
IDL from IHTMLDocument2 for onkeydown:
dispinterface IHTMLDocument2 {
properties:
methods:
....
[id(0x80011775), propput, bindable, displaybind]
void onkeydown([in] VARIANT rhs);
....
|
|
| |
Goto Forum:
Current Time: Wed Apr 24 16:20:52 GMT 2024
Powered by FUDForum. Page generated in 0.05596 seconds
|