what is message loop how mfc does it internally?

Answer Posted / sonali dongare

In Window programming Message is the main communication.The
messaes are stored in message queue.
the way you retrieve messages from the Message Queue is by
creating a Message Loop. A Message Loop is a loop that
checks for messages in the Message Queue. once a message is
received, the Message Loop dispatches the message by
calling a Message Handler, a function designed to help the
Message Loop at processing the message.

Message loop ends when WM_QUIT messae is retrived.In Mfc
WinMain is the entry point.since mfc uses event driven
programming model The Incoming messages enter in the
message queue window procedure process that messages and
send to window ,winmain create that window and enter into
message loop ,retrive messages and dispatches them to
window procedure.Messages wait in message queue untill they
are retrived.In order to retrive and dispatch the message
winmain execute simple while loop that call
GetMessage,TranslateMessage and DispathMessage API
Functions .GetMessage retrive message from message
queue ,TranslateMessage convert keyboard message to WM_CHAR
message and DispatchMessage dispatch messages to Window
procedure. Message loop end when it retrived WM_QUIT
message.

Is This Answer Correct ?    40 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does mfc stand for?

959


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

691


What is mfc class hierarchy?

615


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

1809


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

2843






List out the basic features of MFC.

13679


what message is sent to an application when the user presses the primary button?

1384


plzz tell me what we can do and dont in tally ERP & sap business one?

1878


How do I create a dialog box in mfc?

608


what is the meaning of constant FILE EXCEEDS LENGTH LIMIT while loading from ps file to vsam in the jcl?

3341


I want recent paper pattern for HP company?

1784


how to repaint when working with horizontal scroll bar

1545


what is functioning of DIalodDataXchange ..?

1190


Do you have an idea about MFC?

912