hello,
I have created an Event-Sink class in C++ to handle COM-Events and it
works well in a MFC-application.
But if I create a DLL to use this Event-Sink-Class with the JNI then
the callback function of the event-sink is not called. The COM-Server
tells me that it is "overloaded" when it fires the event. It seems to
me that it "hangs" somehow in the JVM.
here some pseudo code:
in Java:
class Test {
public static native void nativeFunction();
public static void main(...) {
nativeFunction();
//during sleeping I fire the "event"
Thread.sleep(30000);
}
}
in the DLL:
class EventSink : public IDispatch
{
...
HRESULT __stdcall Invoke(...) {
//just exit application
exit(0);
return S_OK;
}
...
};
JNIEXPORT void JNICALL ...nativeFunction(...)
{
//initialize COM
CoInitializeEx(NULL, COINIT_MULTITHREADED);
//create COM object with CoCreateInstance(...)
//get IConnectionPointContainer of the object
//get IConnectionPoint* connectionPoint
//advise sink to connectionPoint
EventSink* sink = new EventSink();
connectionPoint->advise(sink, &cookie);
...
}
what is wrong in the code?
thanks in advance!
Arthur
Cyril - 18 Feb 2004 20:17 GMT
See how it is made in the package at
http://www.simtel.net/product.php?url_fb_product_page=60701
> hello,
>
[quoted text clipped - 50 lines]
>
> Arthur
Gabriele Tolomei - 17 Feb 2005 16:26 GMT
Hi Artur!
I've your same problem!
I'm still not be able to create a C++ Event Sink Class to handle COM-
events...
Can you post me your C++ code for your Event Sink class, please?
Then I'll must create a DLL to use this event sink with JNI!
Have you solve your problems with callback?
Thanks,
Gabriele