WM_NCHITTEST and secondary monitor to left of primary monitor

Posted by AlanKley on Stack Overflow See other posts from Stack Overflow or by AlanKley
Published on 2010-05-06T15:31:17Z Indexed on 2010/05/06 16:28 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

The described setup with 2nd monitor to left of primary causes WM_NCHITTEST to send negative values which is apparently not supported according to this post.

I have a custom control written in win32 that is like a Group control. It has a small clickable area. No MOUSE events are coming to my control when the window containing the custom control lies on a second monitor to the left of the primary monitor. SPY++ shows WM_NCHITTEST messages but no Mouse messages. When window is moved to primary monitor or secondary monitor is positioned to right of primary (all points are positive) then everything works fine. Below is how the WM_NCHITTEST is handled in my custom control. In general I need it to return HTTRANSPARENT so as not to obscure other controls placed inside of it. Anybody have any suggestions what funky coordinate translation I need to do and what to return in response to WM_NCHITTEST to get Mouse messages translated and sent to my control in the case where it is on a 2nd monitor placed to the left of the primary monitor?

case WM_NCHITTEST:
    {
        POINT Pt = {LOWORD(lP), HIWORD(lP)};
        int i;
        ScreenToClient (hWnd, &Pt);
        if (PtInRect (&rClickableArea, Pt))
        {
            return(DefWindowProc( hWnd, Msg, wP, lP ));
        }
    }
    lReturn = HTTRANSPARENT;
    break;

© Stack Overflow or respective owner

Related posts about c++

Related posts about win32