Code:
case WM_NCMOUSEMOVE://outside client area may need a call to TrackMouseEvent()
ShowCursor(TRUE);
break;
case WM_MOUSEMOVE://in window
ShowCursor(FALSE)
break;
Could also use PtInRect() and MAKEPOINTS() on the mouse coods.
Try this to restrict the mouse to smaller and smaller areas inside the dialog
Code:
case WM_MOUSELEAVE:
static RECT Rect;
static UNIT uTimer=0;
GetWindowRect(hWnd,&Rect);
ClipCursor(&Rect);
uTimer=SetTimer(hWnd, WM_USER+10001,20000,NULL);
break;
case WM_LBUTTONDOWN://each time clicked will reduce the area by 100x100
Rect.left+=50;
Rect.top+=50;
Rect.right-=50;
Rect.bottom-=50;
ReleaseCapture()
ClipCursor(hWnd,&Rect);
break;
case WM_TIMER://will release the cursor after 20 sec
if(wParam==uTimer)
{
ReleaseCapture();
KillTimer(hWnd,uTimer);
}
break;
Needs error checking for the Rect (ie if left>right)