L'apprentis said:
Hi I am trying to find a way to change the mouse pointer to the "Hyperlink" pointing finger via code. I know 2 different way to change the mouse pointer to an hourglass:
or
I have just been trying 60 different number for the value of "screen.Mousepointer"....No luck...Do you know if it's possible or not?
I'm afraid you'll need more code than that... you will also need the Hand.cur in the application working directory... here's the code:
Option Compare Database
Option Explicit
Public Const IDC_APPSTARTING = 32650&
Public Const IDC_ARROW = 32512&
Public Const IDC_CROSS = 32515&
Public Const IDC_IBEAM = 32513&
Public Const IDC_ICON = 32641&
Public Const IDC_NO = 32648&
Public Const IDC_SIZE = 32640&
Public Const IDC_SIZEALL = 32646&
Public Const IDC_SIZENESW = 32643&
Public Const IDC_SIZENS = 32645&
Public Const IDC_SIZENWSE = 32642&
Public Const IDC_SIZEWE = 32644&
Public Const IDC_UPARROW = 32516&
Public Const IDC_WAIT = 32514&
Declare Function LoadCursorBynum Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Declare Function LoadCursorFromFile Lib "user32" Alias _
"LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
Const curNAME = "\Hand.CUR"
Private mhCursor As Long
Private hCursor As Long
Private mstrCursorPath As String
Private CursorPath As String
Private Const ERR_INVALID_CURSOR = vbObjectError + 3333
Function MouseCursor(CursorType As Long)
Dim lngRet As Long
lngRet = LoadCursorBynum(0&, CursorType)
lngRet = SetCursor(lngRet)
End Function
Function PointM(strPathToCursor As String)
If mhCursor = 0 Then
mhCursor = LoadCursorFromFile(strPathToCursor)
End If
Call SetCursor(mhCursor)
End Function
Public Function GetCursor()
If Len(mstrCursorPath) = 0 Then
mstrCursorPath = CurrentDBDir() & curNAME
If Len(Dir(mstrCursorPath)) = 0 Then
mstrCursorPath = vbNullString
End If
End If
PointM (mstrCursorPath)
ExitHere:
Exit Function
End Function
Public Function GetHand()
If Len(CursorPath) = 0 Then
CursorPath = CurrentDBDir() & "hMove.cur"
If Len(Dir(CursorPath)) = 0 Then
CursorPath = vbNullString
End If
End If
PointL (CursorPath)
ExitHere:
Exit Function
End Function
Public Function PointL(PathToCursor As String)
If hCursor = 0 Then
hCursor = LoadCursorFromFile(PathToCursor)
End If
Call SetCursor(hCursor)
End Function