Make your own free website on Tripod.com

Home
Home

--- Soumis par Terry Kreft---

Afficher un icône fait maison comme curseur de souris.

    Access nous permet bien de spécifier quelques icônes de souris de par la propirété Screen.MousePointer. Cependant, nous n'avons pas la possibilité d'utiliser tous les icônes pré-définis, tel que le pointeur- main.

    Ayant une ressource fichier-point-ICO (icon), on peut le substituer à un pointeur de souris, en utilisant les fonctions de l'API LoadCursor et   SetCursor.

'*********** Code Start  ************
'Code Courtesy of
'Terry Kreft
'
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

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 ************