Hi,
Ages ago I used the code provided below. Sometimes it worked, sometimes not really (maybe, because of some context switching).
My personal preference, unless there is a requirement to check exactly the cursor state, is to rely not on cursor shape, but wait for the target object/control and continue with it.
'------------------------------------------------------------------------------
'From: http://www.sqaforums.com/showflat.php?Cat=0&Number=533710&an=0&page=0&gonew=1
Function GetMouseCursor()
Dim nHandle
Dim nProcessID
Dim nThreadID
Dim nCursor
GetMouseCursor = -1
nHandle = Win32API.GetForegroundWindow()
nProcessID = Win32API.GetWindowThreadProcessId(nHandle, null)
nThreadID = Win32API.GetCurrentThreadId()
Call Win32API.AttachThreadInput(nProcessID, nThreadID, true)
nCursor = Win32API.GetCursor()
Call Win32API.AttachThreadInput(nProcessID, nThreadID, false)
GetMouseCursor = nCursor
' Call Log.Message(nCursor)
' Some of common mouse cursor types:
'var c_nMouse_Pointer = 65555;var c_nMouse_Hourglass = 65559;var c_nMouse_Text = 65557;var c_nMouse_Hand = 65583;
End Function
'------------------------------------------------------------------------------
Related Content
- 4 months ago
- 10 years ago
- 3 years ago
- 4 years ago