Communicating with a Windows mfc application

M

matteo.dt

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
 
C

Chris Uppal

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
 
R

Roedy Green

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top