Hand cursor/icon like with Internet Explorer hyperlink

P

Paul Martin

Hi all

I have found an alternative solution to the problem of a suitable
cursor to emulate a hyperlink. I have a label with a Click event, and
I want the cursor to look like the hand over a hyperlink in Internet
Explorer.

I've tried the hyperlink cursor solution provided by John Walkenbach
and others, but I don't really like the cursor image (nor have I been
able to find one I like).

I found another solution on Google that others might find useful,
because the cursor appears to be the IE cursor.
The first block of code goes into a module:

Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&

Public Sub SetHandCur(Hand As Boolean)
If Hand = True Then
SetCursor LoadCursor(0, IDC_HAND)
Else
SetCursor LoadCursor(0, IDC_ARROW)
End If
End Sub
_________________________________________________________

Then, on the UserForm for the label (or relevant control) MouseMove
and MouseDown events:

SetHandCur True

When the cursor is over the control, the cursor changes, and using the
MouseDown event ensures that the cursor does not revert to default
when clicking a mouse button.

Regards

Paul Martin
Melbourne, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top