Solved

get the current mouse cursor type

Posted on 2016-10-01
5
33 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 34

Accepted Solution

by:
ste5an earned 334 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 21

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 166 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 34

Assisted Solution

by:ste5an
ste5an earned 334 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 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