Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get the current mouse cursor type

Posted on 2016-10-01
5
Medium Priority
?
38 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 35

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 22

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 35

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

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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