What is the difference between GetMessage and PeekMessage ?
Answers were Sorted based on User's Feedback
Answer / girish tryambake
The major difference between the two is that GetMessage()
doesn't return until it finds a message to retrieve from the
Application Queue, this allows us to free up precious CPU
usage for other programs to use. PeekMessage() returns
immediately weather there are any messages or not, this
allows us to utilize the time between messages, for example
to render a 3D scene.
| Is This Answer Correct ? | 29 Yes | 4 No |
Answer / sandeep
GetMessage essentially waits for any message to be placed in
the queue
before it returns. On other hadn, PeekMessage function does
not wait.
That means GetMessage can block until the message appears in
the queue.
| Is This Answer Correct ? | 21 Yes | 1 No |
Answer / amol lande
GetMessage:
a. It retrieves the message from the calling thread's message queue.
b. It blocks until it gets a message or an error occurs.
c. It can filter message as per specified filter.
PeekMessage:
a. It checks for the message in the calling thread's message queue and it retrieves the message if any present.
b. As specified in the argument, it may or may not removes the message from message queue.
c. It returns immediately if there is no message found in the message queue.
| Is This Answer Correct ? | 2 Yes | 0 No |
How you find memory leaks?
WHAT IS DIFFERENT BETWEN RELEASE MODE & DEBUGGING MODE
4 Answers Google, Microsoft, TCS,
1)How to change a text of a button as Dynamically?
how to give colour for dialog button or static buuto?any one explain full code ?pls pls
What is the difference between Extension DLL and Regular DLL?
What is the use of CObject::Dump function ?
how does the UIThread and worker thread communicates and handle events
What function is used to retrieve the currently selected index in a list box?
What is stack size in win32 program?
1)To Remove WS_MINIMIZEBOX in a Frame ?
Why not virtual functions to handle messages?
What types of threads are supported by MFC framework?