• 13
• 18
• 19
• 27
• 9

# [win32]WM_NCHITTEST and HTCAPTION problem

This topic is 2808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Using the WM_NCHITTEST WndProc message, I'm trying to determine if the mouse is inside the actual drawing area of the window, or on a board/caption/etc. So I use this code in my WndProc:

case WM_NCHITTEST:	{		static LRESULT r;		r = DefWindowProc(hWnd, WM_NCHITTEST, wParam, lParam);		if (r==HTCLIENT && r!=HTCAPTION)		{			app->mouse->bInsideClient=true;		}		else			app->mouse->bInsideClient=false;		return r;	}	break;

I set a break point on the line that sets bInsideClient to false to test this, and it works on everything except the caption. Mousing over the caption does not return a HTCAPTION result. I even tried adding code like this:

if (r==HTCAPTION)	DebugBreak();

inserted into the above, but it never triggered the debugbreak.

Anyone have any idea why it's never receiving a HTCAPTION result?

##### Share on other sites
When you move the mouse in the caption of the window, it sends NC_MOUSEMOVE messages instead. You should be able to use:

case NCMOUSEMOVE:if(wParam == HTCAPTION) // Do somethingreturn 0;