News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Conditional Messages:VC++

Started by sukishan, Jul 12, 2009, 05:57 PM

Previous topic - Next topic

sukishan

Conditional Messages

Introduction

The messages we have used so far belong to specific events generated at a particular time by a window. Sometimes in the middle of doing something, you may want to send a message regardless of what is going on. This is made possible by a function called SendMessage(). Actually, there are two SendMessage() versions available.

The Win32 API version of the SendMessage() function has the following syntax:

LRESULT SendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);The MFC version is defined as follows:

LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam);Because the Win32 version is considered global, if you want to use it, you must precede it with the scope access operator "::" as in:

::SendMessage(WhatToDo);The hWnd argument is the object or control that is sending the message.

The Msg argument is the message to be sent.

The wParam and the lParam values depend on the message that is being sent.

The advantage of using the SendMessage() function is that, when sending this message, it would target the procedure that can perform the task and this function would return only after its message has been processed.
A good beginning makes a good ending