This code is easy. However, it causes flickering on Vista and 7, while on XP it is hard to notice.
I have found another way, which does not involve (almost) any MouseMove event.
vb Code:
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Put this code in MouseMove event and it will execute only once:
vb Code:
If Not HandActive Then
HandActive = True
Call SetSystemCursor(LoadCursor(0, IDC_HAND), OCR_NORMAL)
End If
This code changes (as the function name indicates) the primary cursor permanently.
In order to restore it, we have to call the same function again, using the same parameters.
vb Code:
Call SetSystemCursor(LoadCursor(0, IDC_HAND), OCR_NORMAL)
HandActive = False
There are 2 ways to "undo" the hand cursor:
1. Subclass the control and capture WM_MOUSELEAVE (most reliable).
2. Put the "undo" code in the form's MouseMove event (checking if HandActive is true).