Event Loop Vs Message Loop

Apr 29, 2012 at 12:13pm
Hi, sometimes these two concept make me confused,
Are Event and message the same meaning ? If not ,what is the
the difference?
In OOP these two words are frequently being used. Need some explaination.

anyone can help me?

thanks in advance.
Apr 29, 2012 at 12:30pm
I don't know exactly...
Messages IMO are generaly received from OS and similar while events are hapening inside a program (event driven programing) or by user inervention such as mouse click.

In windows programing main message loop is in the WinMain() function and it is dispached by windows procedure.

In general msg loop or event loop is runing trough whole life of program witing for action.

maybe someone else has better gramar knoweledge about that :)
Apr 29, 2012 at 1:15pm
In my oppinion, I think an event just a specific type of things triggered at the certain moment, and a message is an entity contains some infomation of this type of event. 

Is that right or wrong?

keep on confusing...mm

need guru to show the ropes. :)
Apr 29, 2012 at 1:23pm
Actually I think you will find that all the confusing acronyms, and names and other confusing issues in programming are caused by so called gurus :-)
Apr 29, 2012 at 1:24pm
you mean msg loop and event loop are the same thing on OS level ?
Apr 29, 2012 at 2:22pm
You could use "Message" and "Event" and mean the same thing. You shouldn't do that when programming in Smalltalk though.
Last edited on Apr 29, 2012 at 2:23pm
Apr 29, 2012 at 3:12pm
oh, I see.
thanks
Apr 29, 2012 at 3:17pm
Now I stick to message

Object only passes message to each other.

no confusion any more !

hooray
Apr 29, 2012 at 3:51pm
Everything that happens in a GUI system triggers an event. Most often from the keyboard or mouse. Even when the battery goes low, or the systems tick count rolls over, an event is triggered. These events are processed by the operating system and an appropriate message is generated. As an example, when the mouse is moved, its x,y coordinates and time it was moved are put into a message. These messages are continually stacked in a cue and this is where the application designed message pump or loop reads them one by one. The message number is compared against an application (programmer) designed message map, an if they match, program executes that event handler, otherwise message is discarded.

So in a technical sense, events are being triggered whether there is a loop or not, but without processing the messages, you can't even close, click or do anything with the window.

Therefor, an event driven system requires a message pump (loop) in order to determine if there is a corresponding application designed event handler.
Apr 29, 2012 at 4:04pm
what TightCoder said is really guru level tips

now I get further understanding about those 2 words.

thanks. :-)
Apr 29, 2012 at 5:21pm
Verry well explained..
Always good to learn new stuff, thanks good we live in a future and have a forums and internet :D
Topic archived. No new replies allowed.