• ### Popular Now

• 13
• 18
• 19
• 27
• 10

#### Archived

This topic is now archived and is closed to further replies.

# CWnd->SendMessage

This topic is 6255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Okay... here is an MFC problem for all the gurus out there: If I use Send Message to send a WM_LBUTTONDOWN message, where do I place the Y coordinate?
  this->SendMessage(WM_LBUTTONDOWN, nFlags, point.x); 
is what I have to work with. I think I may have to use HI/LO words.. but i am unsure how to set them I have tried as such UINT place; place |= point.x; place |= (point.y << 16); but to no avail... could someone correct me as to the errors of my ways? thanks

##### Share on other sites

Check out the MAKELPARAM macro.

##### Share on other sites
There are a few different ways you can do it. You can either pass it in one unsigned 32bit value using MAKELPARAM and retrieve those values using HIWORD and LOWORD, or you can pass a pointer to a Point structure containing those values (as long as that structure is not local, unless of course you only use SendMessage and never PostMessage) and then typecast it back to a Point structure in your function.

- Houdini

##### Share on other sites

LRESULT SendMessage(
UINT message,
WPARAM wParam = 0,
LPARAM lParam = 0 );

SendMessage(WM_LBUTTONDOWN, (WPARAM) point.x, (LPARAM) point.y);

-Lucas

##### Share on other sites
Syntax / Lucas:

LRESULT SendMessage(
UINT message,
WPARAM wParam = 0,
LPARAM lParam = 0 );

While this _is_ the syntax, the wParam is used for varius flags, not the x/y position... so yes I need that MAKELPARAM macro.

And everyone - sorry for posting twice... but I didn''t see those little numbers at the bottom of the screen (1 2 3 4 ) and so I thought my message didn''t really get posted... even when I check all messages in the past 60 days i only got i small page....