The calling process must have WINSTA_READATTRIBUTES access to the window station.
The input desktop must be the current desktop when you call
GetCursorPos
. Call
OpenInputDesktop
to determine whether the current desktop is the input desktop. If it is not, call
SetThreadDesktop
with the HDESK returned by OpenInputDesktop to switch to that desktop.