POINT Pts; RECT WndPos; GetCursorPos(&Pts); GetWindowRgnBox(hwnd, &WndPos); while(TRUE){ Sleep(1); if(Pts.x => WndPos.left && Pts.x = WndPos.bottom){ if(Pts.y => WndPos.left && Pts.y = WndPos.bottom){ //Send the message or whatever } } }