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

Hi can anyone explain about the synchronization objects types and where we are using in the code.

1 Answers  


Explain Doc/View architecture

6 Answers   Huawei,


What is userdefine Messages in MFC?

1 Answers   HCL,


What?s the difference between Modal and Modeless Dialog?

12 Answers   Jekson, Usl India,


2.create for 10 batch: Employee_Number Employee_name Employee_Dateofjoining Employee_address Employee_salary 1.select the employee name who deriving more than 10 thousand salary and joined before august 08. use structure and pointers

0 Answers   TCS,






if no message handler is available for a message then will deal with the message ? does window proving any default mechanism?

2 Answers   Patni,


What is CArchive class dowes?

4 Answers  


what if we provide two message handler for same message ?

1 Answers  


if both base and derived class have the constructors if i create an object for derive class which class constructor is executed first

10 Answers   Siemens, Symphony,


What is the difference between Struts and JSF? Pls list some most suitable differences.

0 Answers  


1)how to Display the File Dialog Box, in MFC ?

1 Answers  


In SDI how many view's are attached to document object and in MDI how many view's are attached to Document object?

2 Answers   Wipro,


Categories