Set Window's Mouse Pointer dynamically

Posted on 2002-07-30
Medium Priority
Last Modified: 2010-05-01

How can i set the Window's Mouse Pointer dynamically (Not Screen.MouseIcon or Form.MouseIcon)?

That's go to Control Panel, then select "Mouse", go to "Pointers" and change the "Normal Select" pointer. How can i achieve that?

I want to change the Mouse Pointer when a process is started, and i want it to change back to Default when the process is finished.

Thank you.
Question by:trowa
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

Accepted Solution

TigerZhao earned 200 total points
ID: 7187536
1. Active Mouse Control Panel, use
shell "rundll32.exe shell32.dll,Control_RunDLL main.cpl",vbNormalFocus  

2. Because Window is a multi-process system, it's bad habit to do what your want.

Expert Comment

ID: 7188022
You can use the API call

Public Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long

on formload get the cursor position using

Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long

then move the cursor to the desired location using setcursor position

then  when u unload the form set the old cursor position

Author Comment

ID: 7192780
No, i just want to change the Mouse Cursor, i think both of the comments are not answering the question.
Independent Software Vendors: 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!


Author Comment

ID: 7204863
Any other comments?
LVL 33

Expert Comment

ID: 7226353
Not sure if this is the one you want. Simply add a command button named "Command1".

Private Sub Command1_Click()
    Me.MousePointer = vbNormal
End Sub

Private Sub Form_Load()
    Me.MousePointer = vbHourglass
End Sub

LVL 33

Expert Comment

ID: 7226356
some more constants

vbDefault 0 (Default) Shape determined by the object.
vbArrow 1 Arrow.
vbCrosshair 2 Cross (crosshair pointer).
vbIbeam 3 I beam.
vbIconPointer 4 Icon (small square within a square).
vbSizePointer 5 Size (four-pointed arrow pointing north, south, east, and west).
vbSizeNESW 6 Size NE SW (double arrow pointing northeast and southwest).
vbSizeNS 7 Size N S (double arrow pointing north and south).
vbSizeNWSE 8 Size NW SE (double arrow pointing northwest and southeast).
vbSizeWE 9 Size W E (double arrow pointing west and east).
vbUpArrow 10 Up Arrow.
vbHourglass 11 Hourglass (wait).
vbNoDrop 12 No Drop.
vbArrowHourglass 13 Arrow and hourglass.
vbArrowQuestion 14 Arrow and question mark.
vbSizeAll 15 Size all.
vbCustom 99 Custom icon specified by the MouseIcon property.


Author Comment

ID: 7235465
Hi hongjun,

the Me.MousePointer is only work for a single application, right? At the moment, i hope i can change the System MousePointer.

Similarly go to Control Panel, then select "Mouse", go to "Pointers" and change the "Normal Select" pointer.

i want to do this for my research application, that's is:

Change the MousePointer when the Main Program Window is minimized, then restore the MousePointer when the Main Program Window is restored.

LVL 49

Expert Comment

ID: 8049106
Hi trowa,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TigerZhao's comment(s) as an answer.

trowa, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 8095934
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 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