Link to home
Start Free TrialLog in
Avatar of trowa
trowa

asked on

Set Window's Mouse Pointer dynamically

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.
ASKER CERTIFIED SOLUTION
Avatar of TigerZhao
TigerZhao

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manojanand
manojanand

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
Avatar of trowa

ASKER

No, i just want to change the Mouse Cursor, i think both of the comments are not answering the question.
Avatar of trowa

ASKER

Any other comments?
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
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
Avatar of trowa

ASKER

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
Avatar of DanRollins
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
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange