c++winapimouseeventatlwtl

WM_XBUTTONDOWN return value difference between ATL/MSDN documented value?


From https://msdn.microsoft.com/en-us/library/windows/desktop/ms646245(v=vs.85).aspx, I extract that:

If an application processes this message, it should return TRUE. For more information about processing the return value, see the Remarks section.

In case that matters, the same holds for WM_XBUTTONUP and WM_XBUTTONDBLCLK.

I expected that I would find MSG_WM_XBUTTONDOWN to do exactly this. However, in atlcrack.h from Chromium (https://src.chromium.org/svn/trunk/src/third_party/wtl/include/atlcrack.h) , I find the following:

// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
#define MSG_WM_XBUTTONDOWN(func) \
    if (uMsg == WM_XBUTTONDOWN) \
    { \
        SetMsgHandled(TRUE); \
        func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
        lResult = 0; \
        if(IsMsgHandled()) \
            return TRUE; \
    }

Similar pieces can be found for MSG_WM_XBUTTONDOWN and MSG_WM_XBUTTONDBLCLK.

In this snippet, the line lResult = 0 confuses me. Shouldn't it be lResult = TRUE (according to the MSDN)?


Solution

  • This was a bug in WTL that has been fixed.