Subj : Need help with cursor managment To : borland.public.cpp.borlandcpp From : Jeff Baker Date : Wed Jun 23 2004 07:20 pm I'm trying to get my cursor to change when it's located inside a target area. The code works with one exception...the cursor changes at incorrect locations. Does anybody have a guess; [BEGIN CODE] RECT tr; // Target rect RECT os; // Offset rect RECT wa; // Client window area rect. POINT loc; // Cursor location HCURSOR cursor; // Current cursor HCURSOR arrow; HCURSOR cross; PAINTSTRUCT paint_struct; case WM_CREATE: os.left = 100; os.top = 100; os.right = 100; os.bottom = 100; arrow = LoadCursor(NULL,IDC_ARROW); cross = LoadCursor(NULL,IDC_CROSS); break; case WM_SIZE: case WM_PAINT: { HDC hdc = BeginPaint(hwnd,&paint_struct); GetClientRect(hwnd,&wa); tr.left = wa.left + os.left; tr.top = wa.top + os.top; tr.right = wa.right - os.right; tr.bottom = wa.bottom - os.bottom; SetBkMode(hdc,TRANSPARENT); CreatePen(PS_SOLID,0,(COLORREF)RGB(0,0,0)); Rectangle(hdc,tr.left,tr.top,tr.right,tr.bottom); } break; case WM_MOUSEMOVE: cursor = GetCursor(); GetCursorPos(&loc); loc.x += wa.left; loc.y += wa.top; if (((loc.x > tr.left) && (loc.x < tr.right)) && ((loc.y > tr.top) && (loc.y < tr.bottom))) SetCursor(cross); else SetCursor(arrow); ShowCursor(TRUE); break; [END CODE] The other thing I'm wondering is if there is a better way to check if the cursor is in the target rect. - Jeff .