Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / February 2005

Tip: Looking for answers? Try searching our database.

JNI: COM event sinks in a DLL

Thread view: 
Arthur Brack - 18 Feb 2004 11:58 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.