Solved

Set Window's Mouse Pointer dynamically

Posted on 2002-07-30
9
179 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
[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
9 Comments
 
LVL 4

Accepted Solution

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

Expert Comment

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

Author Comment

by:trowa
ID: 7192780
No, i just want to change the Mouse Cursor, i think both of the comments are not answering the question.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:trowa
ID: 7204863
Any other comments?
0
 
LVL 33

Expert Comment

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


hongjun
0
 
LVL 33

Expert Comment

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



hongjun
0
 

Author Comment

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

TQ
0
 
LVL 49

Expert Comment

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

Expert Comment

by:SpideyMod
ID: 8095934
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

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!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

705 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