Posted By

heislekw on 11/23/08


Tagged

mouse cursor hand


Versions (?)

Change mouse cursor to hand


 / Published in: Visual Basic
 

  1. ' Enter this in on MouseMove event
  2.  
  3. =MouseCursor(32649)
  4.  
  5. ' The following must be in a global module (called basMouseCursor)
  6.  
  7. '*********** Code Start ************
  8. ' This code was originally written by Terry Kreft.
  9. ' It is not to be altered or distributed,
  10. ' except as part of an application.
  11. ' You are free to use it in any application,
  12. ' provided the copyright notice is left unchanged.
  13. '
  14. ' Code Courtesy of
  15. ' Terry Kreft
  16. '
  17. Public Const IDC_APPSTARTING = 32650&
  18. Public Const IDC_HAND = 32649&
  19. Public Const IDC_ARROW = 32512&
  20. Public Const IDC_CROSS = 32515&
  21. Public Const IDC_IBEAM = 32513&
  22. Public Const IDC_ICON = 32641&
  23. Public Const IDC_NO = 32648&
  24. Public Const IDC_SIZE = 32640&
  25. Public Const IDC_SIZEALL = 32646&
  26. Public Const IDC_SIZENESW = 32643&
  27. Public Const IDC_SIZENS = 32645&
  28. Public Const IDC_SIZENWSE = 32642&
  29. Public Const IDC_SIZEWE = 32644&
  30. Public Const IDC_UPARROW = 32516&
  31. Public Const IDC_WAIT = 32514&
  32.  
  33. Declare Function LoadCursorBynum Lib "user32" Alias "LoadCursorA" _
  34. (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
  35.  
  36. Declare Function LoadCursorFromFile Lib "user32" Alias _
  37. "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
  38.  
  39. Declare Function SetCursor Lib "user32" _
  40. (ByVal hCursor As Long) As Long
  41.  
  42. Function MouseCursor(CursorType As Long)
  43. Dim lngRet As Long
  44. lngRet = LoadCursorBynum(0&, CursorType)
  45. lngRet = SetCursor(lngRet)
  46. End Function
  47.  
  48. Function PointM(strPathToCursor As String)
  49. Dim lngRet As Long
  50. lngRet = LoadCursorFromFile(strPathToCursor)
  51. lngRet = SetCursor(lngRet)
  52. End Function
  53. '*********** Code End ************

Report this snippet  

You need to login to post a comment.