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 / General / March 2006

Tip: Looking for answers? Try searching our database.

Communicating with a Windows mfc application

Thread view: 
matteo.dt@gmail.com - 31 Mar 2006 11:12 GMT
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.



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.