VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the Real Hand Cursor

by Nathanael B (3 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (11 Votes)

This small piece of code will set the cursor to the hand cursor that is shown when you hover above a hyperlink. I know you can use a .RES file to load the cursor, but the cursor can be changed in the Mouse control panel, and a .RES cursor will not reflect the changes. NOTE: This is not all my code. I found the API call on VBC (had to do quite a bit of searching), and put together a little Subroutine to make it easier to do. The original source is here: https://www.vbcoders.com/vb/scripts/ShowCode.asp?txtCodeId=31572&lngWId=1

Inputs
True/False value. If Hand=True, the hyperlink cursor will be displayed, if it is False, the standard pointer will be displayed.
API Declarations
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&

Rate Get the Real Hand Cursor

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

Download this snippet    Add to My Saved Code

Get the Real Hand Cursor Comments

No comments have been posted about Get the Real Hand Cursor. Why not be the first to post a comment about Get the Real Hand Cursor.

Post your comment

Subject:
Message:
0/1000 characters