Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003

    Unanswered: Anybody know how to change the mouse cursor?

    Anybody know how to change the mouse cursor in the mouse move event?
    I would like to change the cursor to a pointer when the mouse moves over a particular label.

  2. #2
    Join Date
    Sep 2003
    In VB you can set the MouseIcon Property to a custom icon and then set the mousepointer = 99 or vbCustom.

    in Access VB the mouseicon property doesn't seem to exist.

  3. #3
    Join Date
    Sep 2003
    After an insane amount of googling, I found this gem:

    API: Displaying a custom Mouse icon
    Terry Kreft

    Access allows us to display specific mouse pointers by controlling the MousePointer property of the Application object. However, it does not have the hand pointer (for example) pre-defined.

    Given a local ICO (icon) file, we can assign it to the Mouse pointer by using the LoadCursor and SetCursor API functions.

    '*********** Code Start ************
    ' This code was originally written by Terry Kreft.
    ' It is not to be altered or distributed,
    ' except as part of an application.
    ' You are free to use it in any application,
    ' provided the copyright notice is left unchanged.
    ' Code Courtesy of
    ' Terry Kreft
    Public Const IDC_APPSTARTING = 32650&
    Public Const IDC_HAND = 32649&
    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

    Function MouseCursor(CursorType As Long)
    Dim lngRet As Long
    lngRet = LoadCursorBynum(0&, CursorType)
    lngRet = SetCursor(lngRet)
    End Function

    Function PointM(strPathToCursor As String)
    Dim lngRet As Long
    lngRet = LoadCursorFromFile(strPathToCursor)
    lngRet = SetCursor(lngRet)
    End Function
    '*********** Code End ************

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts