jparnell8839 Posted December 14, 2016 Posted December 14, 2016 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?
Moderators JLogan3o13 Posted December 14, 2016 Moderators Posted December 14, 2016 @jparnell8839 take a look at _WinAPI_SetSystemCursor in the help file. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
jparnell8839 Posted December 14, 2016 Author Posted December 14, 2016 @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!
InunoTaishou Posted December 14, 2016 Posted December 14, 2016 You might want to store the handle returned from LoadCursorFromFile and use _WinAPI_DestroyCursor so you free resources properly when your program exits. jparnell8839 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now