CWnd->SendMessage

Started by
4 comments, last by wise_Guy 23 years, 2 months ago
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
Advertisement


Check out the MAKELPARAM macro.
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
- Houdini

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

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

-Lucas
-Lucas
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....
Actually its a Win32 question, all CWnd::SendMessage(...) does is SendMessage(m_hwnd, ...)

And you may want to use PostMessage not SendMessage; SendMessage call the winproc directly, PostMessage adds the message to the queue (which is the expected behavior).
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement