Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WM_LBUTTONUP not received

393 views
Skip to first unread message

rahul

unread,
May 9, 2011, 5:42:43 AM5/9/11
to
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

unread,
May 9, 2011, 6:01:31 AM5/9/11
to
>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

unread,
May 9, 2011, 6:02:58 AM5/9/11
to

If I don't send WM_COMMAND, then container receives WM_LBUTTONUP

rahul

unread,
May 9, 2011, 6:07:10 AM5/9/11
to

I just Send WM_COMMAND by PostMessage() method.

rahul

unread,
May 9, 2011, 6:18:48 AM5/9/11
to

Spy++ also doesn't show WM_LBUTTONUP message on that window

Joseph M. Newcomer

unread,
May 9, 2011, 11:32:36 AM5/9/11
to
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

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

0 new messages