Jump to content

Set the mouse cursor for Windows?


jparnell8839
 Share

Recommended Posts

I'm hoping this is feasible... I made a program that resides in the system tray. One of the tray items runs a function that waits for the user to click on a window to get the window title.

I would like for the mouse cursor to change to the cross while waiting for user input. I have tried using GUISetCursor(3), but from my understanding this only changes the cursor for an AutoIt GUI window.

How could I go about changing the mouse cursor for the user's environment, not just for the AutoIt window?

Link to comment
Share on other sites

@JLogan3o13 I was a little bit confused on the $hCursor parameter, but I have gotten it to work thanks to the example in the help file:

 

Func FuncName()
       ;backs up the user's arrow cursor
   Local $hPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32512))

       ;backs up the user's ibeam cursor
   Local $iPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32513)) 

       ;changes the user's arrow cursor
   _WinAPI_SetSystemCursor(_WinAPI_LoadCursorFromFile(@ScriptDir & "\cross.cur"),32512) 
       ;changes the user's ibeam cursor
   _WinAPI_SetSystemCursor(_WinAPI_LoadCursorFromFile(@ScriptDir & "\cross.cur"),32513) 

   ; Do the code you want to execute

       ;restores the user's default cursor
   _WinAPI_SetSystemCursor($hPrev,32512) 
       ;restores the user's ibeam cursor
   _WinAPI_SetSystemCursor($iPrev,32513) 
EndFunc

Thanks for your insight!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...