Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Access Java app message loop from ActiveX control running in JNI

843829Aug 25 2010
Anyone know how to access a Java application's message loop from inside JNI code?

Through the (JNIEnv *env) or (jobject obj) parameters maybe?

I've got an ActiveX dll that I'm running via JNI. The ActiveX dll creates an IP server on a separate thread. When another process connects to the IP server I need to PostMessage (MS Windows term) from this IP server thread to the thread that the Java application is running on.

It appears the Java application's message loop is not present / available in the JNI code and consequently the message is never posted from the IP thread to the JNI / Java App thread.

Of course I can manually add a message loop to the JNI code and the PostMessage works just fine. But then the message loop is executing and the Java application is effectively blocked and becomes unresponsive because the JNI method call never returns as its busy running this while loop doing a GetMessage --- DispatchMessage inside the ActiveX dll.

Maybe JNI is not really intended or this purpose and it's just not possible?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2010
Added on Aug 25 2010
0 comments
190 views