please explain me windows message handler

For all of you programmers out there- please don't Trout Slap me too hard for the following explanation; coding is definitely not one of my areas of expertise...


On a very basic level, message handlers are pieces of code that tell a program (or Windows itself) what to do when different events occur in your system.

A common example of an "event" would be the action of a user clicking their mouse on a certain button within one of the program's windows. When a user does that, the program needs to know:

- that some button actually has been clicked.
- which exact button has been clicked.
- what action it should perform when that specific button is clicked.

The fact that the user has clicked a button in one of the program's windows, which exact button it was, and other information concerning the specific event, is transmitted from the program's window to the program itself via a chunk of data called a "message".

Included in (or accessible to) the program are pieces of code called "event handlers" or "message handlers" which contain instructions on what to do when the program is notified via the message that an event has occurred.
Based on the information contained in a given message, an appropriate message handler is located, and the processing of the action(s) that should occur in response to that message are then processed by the handler.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.