Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get the current mouse cursor type

Posted on 2016-10-01
5
Medium Priority
?
40 Views
Last Modified: 2016-11-09
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.
0
Comment
Question by:Svgmassive
  • 2
5 Comments
 
LVL 36

Accepted Solution

by:
ste5an earned 1336 total points
ID: 41824935
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

  'Default
  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

1
 
LVL 23

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 664 total points
ID: 41824937
The Mouse Pointer is controlled by Windows so APIs can be used to change it.

Displaying a custom Mouse icon by Terry Kreft
http://access.mvps.org/access/api/api0044.htm

Here is a page on MSDN that discusses the cursor.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648379(v=vs.85).aspx

Use the GetCursor function to find out about the cursor before you change anything.
0
 

Author Comment

by:Svgmassive
ID: 41824989
OldMousePointer = Screen.MousePointer is returning Zero.not working
0
 
LVL 36

Assisted Solution

by:ste5an
ste5an earned 1336 total points
ID: 41824993
It is. It just means that the current pointer, accessed by reading Screen.MousePointer, is ccDefault = 0. Thus the normal arrow pointer.
1

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question