Thursday, February 21, 2008

MSG STRUCTURE

This is a structure, which is created by the windows operating system for every window as soon as a window is created.

It consists of 6 variables the declaration of the structure is as follows.

Struct tagMSG
{
HWND hWnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;




PARAMETERS:

HWND hWnd = It specifies a handle to the window for which the message is generated.

UINT message = It specifies the actual message about the event that got generated.

WPARAM wParam and LPARAM lParam = These parameters hold some additional information about the message generated.

DWORD time
= It specifies the time the message was sent or the time when the event is raised.

POINT x, y = It specifies the x, y co-ordinate of the mouse cursor.

MSG structure is the structure, which will store the information of the messages generated.

Messages are small packets of data that windows send to a running program to let it know that an event has occurred.

Windows generates message for every hardware event.

It passes these messages to the appropriate message queue.

The running program or application pulls messages from message queue using the message loop.

The message loop uses the GetMessage function to read messages.

No comments: