There’s another similar API which works exactly like SendMessage and that is PostMessage API. Both require same parameters but there’s a slight difference. When a message is sent to a window with SendMessage, the window procedure is called and the calling program (or thread) waits for the message to be processed and replied back, and until then the calling program does not resume its processing. One thing is wrong with this approach however, that is if the program that is busy carrying out long instructions or a program that has been hung and hence no time to respond to the message will in turn hang your program too because your program will be waiting for a reply that may never arrive. The solution to this is to use PostMessage instead of SendMessage. PostMessage on the otherhand returns to the calling program immediately without waiting for the thread to process the message, hence saving your program from hanging. Which of them you have to use depends on your requirement.
Enum Windows & SendMessage API
- Introduction
- EnumWindows
- SendMessage
- SendMessage vs PostMessage
- Conclusion
SendMessage vs PostMessage
You might also like...
About the author
Muhammad Abubakar
Nothing to say anything about me yet.
Interested in writing for us? Find out more.
C++ books
-
Programming with Microsoft Visual Basic 2008
Programming with Microsoft Visual Basic 2008, Fourth Edition by the best-selling author, Diane Zak, is designed for a first course in programming. Using the most recent version of the software, Visual Basic 2008, this book teaches individuals how to ...
C++ forum discussion
-
how can i in C++ send file to other PC over net ?
by greensqeq (7 replies)
-
CorelDRAW VBA: cdrTraceLineDrawing FAILS, producing single linear path instead of Centerline trace?
by dancemanj (0 replies)
-
client/server application using activex
by beautifulheart (0 replies)
-
System Error &H8007007E. The specifed module could not be found.
by swiftsafe (5 replies)
-
QUERY: How to control external exe & read it's process details
by swiftsafe (2 replies)
C++ podcasts
-
Stack Overflow Podcast: Podcast #45 – Keeping it Sharp
Published 7 years ago, running time 0h54m
Our guest this week is Eric Lippert – language architect extraordinaire and famous for all his work at Microsoft in developing their languages Eric joined Microsoft right out of college and was originally working on VB It’s time for everyone’s favorite game: Name the Worst Feature of that Microso.
Comments