What is the difference between GetMessage and PeekMessage ?

Answers were Sorted based on User's Feedback



What is the difference between GetMessage and PeekMessage ? ..

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

What is the difference between GetMessage and PeekMessage ? ..

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

What is the difference between GetMessage and PeekMessage ? ..

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

Post New Answer

More MFC Interview Questions

what is the difference between compiling and building?

1 Answers  


what is message Testing ?

1 Answers   L&T,


What is mfc class hierarchy?

0 Answers  


what is the use of Mutex and critical section

2 Answers  


How to update windows title bar dynamically?

7 Answers   HCL,






What is LoadLibrary function returns?

7 Answers  


How to update all the views whenver document got updated ?

1 Answers  


What is the use of UpdateData funciton ?

7 Answers  


Hi All, i am new for VC++ SDK. i want to get the IP Address of all the External device connected with my local machine.please give the code Regards, Praveer

1 Answers   TCS, Tech Mahindra,


Which CPrintInfo member variable must be set for multiple page printouts?

1 Answers  


How to setup a timer?

3 Answers   IBM,


How can server communicate with more than one client

2 Answers   Invensys,


Categories