get the current mouse cursor type

I am setting up a custom application i would like to get the user current mouse type,before changing it to a custom cursor type so i can restore it when the application closes.
Who is Participating?
ste5anConnect With a Mentor Senior DeveloperCommented:
Use Screen.MousePointer. E.g.

Public Sub YourMethod()

  Dim OldMousePointer As Long
  OldMousePointer = Screen.MousePointer
  Screen.MousePointer = ccHourglass
  'some code
  Screen.MousePointer = OldMousePointer

End Sub

Open in new window

with either a reference on MSComctLib or

Public Enum MousePointerConstants

  ccDefault = 0  '&H0

  'Arrow mouse pointer
  ccArrow = 1  '&H1

  'Cross mouse pointer
  ccCross = 2  '&H2

  'I-Beam mouse pointer
  ccIBeam = 3  '&H3

  'Icon mouse pointer
  ccIcon = 4  '&H4

  'Size mouse pointer
  ccSize = 5  '&H5

  'Size NE SW mouse pointer
  ccSizeNESW = 6  '&H6

  'Size N S mouse pointer
  ccSizeNS = 7  '&H7

  'Size NW SE mouse pointer
  ccSizeNWSE = 8  '&H8

  'Size W E mouse pointer
  ccSizeEW = 9  '&H9

  'Up arrow mouse pointer
  ccUpArrow = 10  '&HA

  'Hourglass mouse pointer
  ccHourglass = 11  '&HB

  'No drop mouse pointer
  ccNoDrop = 12  '&HC

  'Arrow and Hourglass mouse pointer
  ccArrowHourglass = 13  '&HD

  'Arrow and Question mark mouse pointer
  ccArrowQuestion = 14  '&HE

  'Size all mouse pointer
  ccSizeAll = 15  '&HF

  'Custom mouse pointer icon specified by the MouseIcon property
  ccCustom = 99  '&H63
End Enum

Open in new window

crystal (strive4peace) - Microsoft MVP, AccessConnect With a Mentor Remote Training and ProgrammingCommented:
The Mouse Pointer is controlled by Windows so APIs can be used to change it.

Displaying a custom Mouse icon by Terry Kreft

Here is a page on MSDN that discusses the cursor.

Use the GetCursor function to find out about the cursor before you change anything.
SvgmassiveAuthor Commented:
OldMousePointer = Screen.MousePointer is returning Zero.not working
ste5anConnect With a Mentor Senior DeveloperCommented:
It is. It just means that the current pointer, accessed by reading Screen.MousePointer, is ccDefault = 0. Thus the normal arrow pointer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.