sendMessage or postMessage in Java

Posted on 2001-07-10
Last Modified: 2008-02-01
How do u send a Message to a message queue.
Send me the Source Code.
It should work like sendMessage and postMessage in MFC?
please reply me immediatelly
Question by:rajinikarthikeyan

Accepted Solution

Igor Bazarny earned 25 total points
ID: 6271166

Immediate answer--you can't. Java don't let you access to Windows message queue. There is java.awt.EventQueue class and java.awt.Toolkit.getSystemEventQueue() method which allow such low level manipulations with java event queue. You also can use JNI to call Win32 functions.

Can you provide more details? Why do you think you need sendMessage() or postMessage()?

Igor Bazarny,
Brainbench MVP for Java 1 
LVL 19

Assisted Solution

by:Jim Cakalic
Jim Cakalic earned 25 total points
ID: 6271381
Hmm. Are you speaking of the Swing Event Queue? Sounds like a job for the SwingUtilities class -- either invokeAndWait or invokeLater. Both methods take a Runnable, that is, an object of a class which implements the Runnable interface. The run method will be the action that you want to post on the Event Queue. You can find more detailed information in the following articles on the Swing Connection at the JDC:

Or perhaps you are talking about some other kind of queue?

Best regards,
Jim Cakalic
LVL 14

Expert Comment

ID: 9017699
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

[split points between bazarny and jim_cakalic]

Please leave any comments here within the next seven days.
EE Cleanup Volunteer
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven project error 5 54
java stored proc example 9 29
runtime exception 2 27
Java: How do I open the default windows program for a given file type 3 28
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question