Friday, November 4, 2011

Windows Programming, a Closer Look in C programming language

There can be hundreds of ways in which the user may interact with an application. In addition to this some events may occur without any user interaction. For example, events occur when we create a window, when the window’s contents are to be drawn, etc. Not only this, occurrence of one event may trigger a few more events. Thus literally hundreds of messages may be sent to an application thereby creating a chaos. Naturally, a question comes—in which order would these messages get processed by the application. Order is brought to this chaos by putting all the messages that reach the application into a ‘Queue’. The messages in the queue are processed in First In First Out (FIFO) order.
In fact the OS maintains several such queues. There is one queue, which is common for all applications. This queue is known as ‘System Message Queue’. In addition there is one queue per application. Such queues are called ‘Application Message Queues’. Let us understand the need for maintaining so many queues.
When we click a mouse and an event occurs the device driver posts a message into the System Message Queue. The OS retrieves this message finds out with regard to which application the message has been sent. Next it posts a message into the Application Message Queue of the application in which the mouse was clicked. Refer









I think now we have covered enough ground to be able to actually start C under Windows programming. Here we go…

No comments:

Post a Comment