Get PointerPosition #3877
-
How to get PointerPosition when app starting? PointerMoved will not fire while user does not move a pointer at least on 1px, other using CoreWindow.PointerPosition also does not work for Winui3 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
GetCursorPos or Cursor.Position should get you the current mouse cursor position or potentially the pen position if it is hovering and in range. I say potentially, because I don't know for sure how pen input interacts. But it looks like it takes over the mouse cursor. What I gave are Windows desktop functions. That is because everything in the Windows App SDK is a library that runs in a desktop process. |
Beta Was this translation helpful? Give feedback.
Yes, the GetCursorPos documentation states:
"Retrieves the position of the cursor, in screen coordinates."
This is why ScreenToClient exists. Remember, because the mouse cursor is a system service, you have to be prepared for the situation where the cursor is outside of your window.