?
Solved

How to tell what the current mouse cursor is.

Posted on 2003-03-05
7
Medium Priority
?
176 Views
Last Modified: 2010-05-01
Is there a way to tell what the current mouse cursor is?
I have the cursor changeing over a image box, and I want to be able to use a timer to check what the cursor is at all times and if it's a certain cursor, do certain things. How can I achieve this???

Thanx in advance,

--Naylin

eg:

If ***how do I tell what the mouse cursor is*** Then
   Do this!
End If
0
Comment
Question by:Naylin
[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
  • 2
  • 2
  • +1
7 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 8072650
Well that could be difficult, you can obtain a handle to the current cursor and draw this onto a picturebox for example, you would then have to determine whether the image you get matches one of your expected cursor images. This is the hard part and probably needs more than 25 pts to get a good answer.

Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function GetCursor Lib "user32" () As Long
Private Sub Form_Paint()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Draw the current cursor on this form
    DrawIcon Me.hdc, 0, 0, GetCursor
End Sub
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 100 total points
ID: 8072709
What do you mean by mouse cursor? its image?
if not, maybe you don't need a timer but a MouseMove event from image box

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print Image1.MousePointer
End Sub
0
 

Author Comment

by:Naylin
ID: 8072826
I hadn't thought of using a MouseMove event! THANKYOU! After changing my code to use it, it works great! It's a bit slower than using the timer, but it works!

Thanks again,

--Naylin
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Naylin
ID: 8072837
Thanx again!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8072998
You are welcome... Glad to help.
0
 

Expert Comment

by:DanieleC88
ID: 8074212
Why don't you just use the API Call "GetCursorPos" ?
It gives you absolute X and Y coords of the pointer with a POINTAPI type. It isn't difficult. As you can use GetCursorPos, with the same sintax you can set the mouse pointer's position with SetCursorPos.
0
 

Expert Comment

by:DanieleC88
ID: 8074229
Excuse me... I just didn't read all the message... the you just have to use the MousePointer property...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

752 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