case WM_VSCROLL:
switch(LOWORD(wParam))
{ case SB_LINEUP:
iVscrollPos-=1;
break;
case SB_LINEDOWN:
iVscrollPos+=1;
break;
case SB_PAGEUP:
iVscrollPos+=1;
break;
case SB_PAGEDOWN:
iVscrollPos+=1;
break;
case SB_THUMBPOSITION:
iVscrollPos=HIWORD(wParam);
break;
default:
break;
}
if(iVscrollPos != GetScrollPos(hWnd, SB_VERT))
{
SetScrollPos(hWnd, SB_VERT, iVscrollPos, TRUE);
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
I want to add the line: iVscrollPos = max(0, min(iVscrollPos, NUMLINES-1));
but when I declare the function int max(int a,int b), it shows the warning.How to handle this?