Discussion:
WM_LBUTTONUP not received
(too old to reply)
rahul
2011-05-09 09:42:43 UTC
Permalink
I have CWnd derived class which works as container

This Container has some items (which works as button, items are not
CWnd derived, it just paints itself on container, it keeps pointer to
container).

On WM_LBUTTONDOWN on item, item send WM_COMMAND to container.

Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
David Lowndes
2011-05-09 10:01:31 UTC
Permalink
Post by rahul
On WM_LBUTTONDOWN on item, item send WM_COMMAND to container.
Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
Try posting your WM_COMMAND using PostMessage rather than SendMessage.

If that doesn't work, check with Spy++ if you get the button up
notification without your button down handler present. If you then see
the button up message, it implies whatever you're doing in your
handler is preventing the default behaviour that would generate the
button up message.

Dave
rahul
2011-05-09 10:02:58 UTC
Permalink
Post by rahul
I have CWnd derived class which works as container
This Container has some items (which works as button, items are not
CWnd derived, it just paints itself on container, it keeps pointer to
container).
On WM_LBUTTONDOWN on item,  item send WM_COMMAND to container.
Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
If I don't send WM_COMMAND, then container receives WM_LBUTTONUP
rahul
2011-05-09 10:07:10 UTC
Permalink
Post by rahul
Post by rahul
I have CWnd derived class which works as container
This Container has some items (which works as button, items are not
CWnd derived, it just paints itself on container, it keeps pointer to
container).
On WM_LBUTTONDOWN on item,  item send WM_COMMAND to container.
Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
If I don't send WM_COMMAND, then container receives WM_LBUTTONUP
I just Send WM_COMMAND by PostMessage() method.
rahul
2011-05-09 10:18:48 UTC
Permalink
Post by rahul
Post by rahul
Post by rahul
I have CWnd derived class which works as container
This Container has some items (which works as button, items are not
CWnd derived, it just paints itself on container, it keeps pointer to
container).
On WM_LBUTTONDOWN on item,  item send WM_COMMAND to container.
Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
If I don't send WM_COMMAND, then container receives WM_LBUTTONUP
I just Send WM_COMMAND by PostMessage() method.
Spy++ also doesn't show WM_LBUTTONUP message on that window
Joseph M. Newcomer
2011-05-09 15:32:36 UTC
Permalink
You would have to post some code.

Note that if you say

void CMyWindow::OnLButtonDown(UINT flags, CPoint pt)
{
...do some stuff
GetParent()->SendMessage(WM_COMMAND, ...);
}

void CMyParent::OnMyCommand()
{
... stuff
}

then this is not going to help, because the omitted parts are the critical parts. While
you don't have to reveal anything proprietary, you really do have to tell us what you are
doing in terms of Windows itself. For example, popping up a dialog in the OnCommand
handler would definitely mess you over.

Also, if you care about the WM_LBUTTONUP message, really, really care, then you should
probably SetCapture in the child window handler, and do nothing along the way that could
interfere with that capture.

But without seeing what Windows APIs you are calling along the way, there is no way to
tell what is going wrong. Also show your message map entry that routes to your command
handler.
joe
Post by rahul
I have CWnd derived class which works as container
This Container has some items (which works as button, items are not
CWnd derived, it just paints itself on container, it keeps pointer to
container).
On WM_LBUTTONDOWN on item, item send WM_COMMAND to container.
Problem is : When I get WM_LBUTTONDOWN on part of container which work
as
item, I Send WM_COMMAND, but than I don't get WM_LBUTTONUP message.
(Even in PretranslateMsg() WM_LBUTTONUP doesn't comes).Why??
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Loading...