Search Tools Links Login

Get the "Real" Hand Cursor

Visual Basic 6, or VB Classic

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 PSC (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:

Original Author: Nathanael B


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&


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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 129 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.