How Do I Check What The Mouse Position is when I move the mouse in Ncurses. I have tried searching but couldnt find any answer. I have seen the use of getmouse()
, but getting the mouse co-ordinates from that function requires enabling an event first. I want to get the position of the mouse without clicking the mouse.
You get the cursor position by calling GetCursorPos.
POINT p;
if (GetCursorPos(&p))
{
//cursor position now in p.x and p.y
}
This returns the cursor position relative to screen coordinates. Call ScreenToClient to map to window coordinates.
if (ScreenToClient(hwnd, &p))
{
//p.x and p.y are now relative to hwnd's client area
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.