Re: Creating event objects

John Pompeii <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <LISTSERV%[email protected]>
Hi Robert, thanks for the reply.

>I'm afraid jawin does not currently support event sinking. I'm actually on
>the hook for an implementation. Unfortunately, the implementation I did for
>jSegue is based on the fact that event sinks are normally IDispatch based.

Sounds like fun!!!

>...so I can give you
>some info on how it could be done. We'd need to generate a C++ class that
>implements MbtQuotesNotify. Then each method would have to use JNI to call
a
>java method. The constructor of the C++ class should be passed the jobject
>global ref to the java object that will be the sink.

OK, I'm game.  I really appreciate the help.  I know there are a few of
these event interfaces in this package I'm using but once I get the pattern
down, it should be easy enough.

I guess what you're saying is that somehow we have to pass a "reference" to
a COM object instantiated in C++ native code as the first parameter to the
AdviseSymbol method.  Once that gets marshalled and passed, the event
method will be invoked on the C++ instance which in-turn needs to do a JNI
call to invoke it's equivalent on the Java side.  I do have some experience
doing this; that is the latter part where a C++ method calls a Java event
method.  I've got 0 experience with the C++ COM stuff. So, how to build the
C++ class, create an instance (that is, getting the right clsid to
instantiate the COM part of it); and how to marshal it...yadda, yadda... is
where I'd need some guidance.

Is doing this stuff in Visual C++ 6.0 OK?   I've been doing java instead
of .net for a while now.

Thanks Robert,
--john
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.