Hi,
Example 3: A message which has complex parameters, and which returns
an interesting value:
/***************************************************************
* UWM_SET_COORD
* Inputs:
* WPARAM: (WPARAM)(BOOL) FALSE for absolute
* TRUE for relative
* LPARAM: (LPARAM)MAKELONG(x, y)
* Result: LRESULT
* (LRESULT)MAKELONG(x, y) previous coordinate value
* Effect:
* Sets the coordinate in the view, and returns the previous
* coordinate.
* Notes:
* The x,y values are added to the current position if
* WPARAM is TRUE, otherwise they replace the current
* position.
***************************************************************/
#define UWM_SET_COORD_MSG _T("UWM_SET_COORD-{4E7F6EC2-6ADC-11d3-BC36-006067709674}")
Note that I carefully document the casting that is required to get the
desired WPARAM and LPARAM values. Then I know when I'm writing my
method how I should cast it. Here's an example of a handler for another message,
which takes a pointer to an object.
/***************************************************************
* CMyView::OnAssignMyInfo
* Inputs:
* WPARAM: ignored, 0
* LPARAM: (LPARAM)(LPMYINFO)
* Result: LRESULT
* Logically void, 0, always
* Effect:
* Modifies the current view by the values in LPMYINFO
* Notes:
* If LPMYINFO.IsValidCount is FALSE, the count field is
* not modified
***************************************************************/
LRESULT CMyView::OnAssignMyInfo(WPARAM, LPARAM lParam)
{
LPMYINFO info = (LPMYINFO)lParam;
visible = info.visible;
if(info.IsValidCount)
count = info.count;
return 0; // value is ignored
}
refer to the below link for more informtion.
http://www.flounder.com/messages.htm
http://www.bigresource.com/VB-wParam-and-lParam-wyXIqHiILX.html#Mz8LwRev8f
Hope it helps you.