I know this totally disrupts portability, but I'm in a dire need to
communicate with a Win mfc application.
i have a swing java program with a Timer thread. In this thread I need
to set tasks and to retrieve parameters to a Windows mfc application
every time the Timer activates. I could implement a jni dll that
manages the communication with the Win application. For now i've tried
with RegisterWindowMessage, SendMessage and GetMessage sdk functions
but, as these are based on windows handlers, nothing works.
I don't like to exchange messages using a text file, is there any other
way?
Thank you very much,
Matteo
Chris Uppal - 31 Mar 2006 13:18 GMT
> i have a swing java program with a Timer thread. In this thread I need
> to set tasks and to retrieve parameters to a Windows mfc application
> every time the Timer activates. I could implement a jni dll that
> manages the communication with the Win application. For now i've tried
> with RegisterWindowMessage, SendMessage and GetMessage sdk functions
> but, as these are based on windows handlers, nothing works.
I'm not a specialist Windows programmer, but I think that you'd have to start a
separate thread (Windows not Java) with its own Windows event dispatch loop.
Your JNI code would start that thread. Later calls (via) JNI would communicate
with that thread to ask it to use the window/thread related Windows APIs.
-- chris
Roedy Green - 31 Mar 2006 19:58 GMT
>For now i've tried
>with RegisterWindowMessage, SendMessage and GetMessage sdk functions
>but, as these are based on windows handlers, nothing works.
>I don't like to exchange messages using a text file, is there any other
>way?
You use JNI to talk to some C that does what you need.
see http://mindprod.com/jgloss/jni.html
You run your Windows app in a separate address space and talk to it
with sockets.
You share a database that you each poll.
You share a flat file.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.