14/11/2008, 01:46
|
| | | Fecha de Ingreso: agosto-2007
Mensajes: 1.338
Antigüedad: 17 años, 3 meses Puntos: 18 | |
Respuesta: Cambiar puntero raton en formulario de Access97 Yo siempre uso el "truquillo" de la macro dedito (asi la llamo yo). Pero por aportar, dejo esto por si alguien quiere poner otro cursor:
Esto copiado en un modulo:
'************************************************* ***************
Option Compare Database
Option Explicit
'Para cambiar el tipo de cursor.
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
'Para cursores animado extension .ani
'Para cursores normales extension .cur
Const curNAME = "harrow.cur" '<-- Aqui el nombre del cursor(que ha de estar en la carpeta"C:\WINDOWS\Cursores\"), aunque tambin se le puede indicar una ruta
Private mhCursor As Long
Private mstrCursorPath As String
Private Const ERR_INVALID_CURSOR = vbObjectError + 3333
Public Function mc_GetCursor()
'Para cambiar el tipo de cursor.
On Error GoTo ErrHandler
If Len(mstrCursorPath) = 0 Then
'Directorio predeteminado donde están los cursores
mstrCursorPath = "C:\WINDOWS\Cursores\"
mstrCursorPath = mstrCursorPath & curNAME
If Len(Dir(mstrCursorPath)) = 0 Then
mstrCursorPath = vbNullString
End If
End If
If Len(mstrCursorPath) = 0 Then
Err.Raise ERR_INVALID_CURSOR
Else
PointM (mstrCursorPath)
End If
ExitHere:
Exit Function
ErrHandler:
With Err
If .Number = ERR_INVALID_CURSOR Then
MsgBox "Error: " & .Number & vbCrLf & "Invalid Cursor type", _
vbCritical Or vbOKOnly, "Cursor Function"
Else
MsgBox "Error: " & .Number & vbCrLf & .Description, _
vbCritical Or vbOKOnly, "Cursor Function"
End If
End With
Resume ExitHere
End Function
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
************************************************** ***************
Luego, en el evnto MouseMove del control que sea, esto:
Private Sub NombreControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call mc_GetCursor
End Sub
Un saludo |