Solved

Set Window's Mouse Pointer dynamically

Posted on 2002-07-30
9
173 Views
Last Modified: 2010-05-01
Hi,

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.
0
Comment
Question by:trowa
9 Comments
 
LVL 4

Accepted Solution

by:
TigerZhao earned 50 total points
Comment Utility
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.
0
 
LVL 2

Expert Comment

by:manojanand
Comment Utility
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
0
 

Author Comment

by:trowa
Comment Utility
No, i just want to change the Mouse Cursor, i think both of the comments are not answering the question.
0
 

Author Comment

by:trowa
Comment Utility
Any other comments?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 33

Expert Comment

by:hongjun
Comment Utility
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


hongjun
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
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.



hongjun
0
 

Author Comment

by:trowa
Comment Utility
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.

TQ
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
0
 

Expert Comment

by:SpideyMod
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now