Try this -
case WM_NCHITTEST:
{
auto result = DefWindowProc(hWnd, message, wParam, lParam);
if (result == HTMENU)
{
HMENU hBar = GetMenu(hWnd);
auto x = GET_X_LPARAM(lParam);
auto y = GET_Y_LPARAM(lParam);
auto item = MenuItemFromPoint(hWnd, hBar, POINT{ x, y });
if (item == -1)
return HTCAPTION;
else
return result;
}
else
return result;
}
break;
And these are the results -