'C++ Ncurses , how to check what the current mouse position is
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.
Solution 1:[1]
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
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GetGetCoded |
