Jump to content
Sign in to follow this  
Fay

Mouse display hourglass

Recommended Posts

Fay

Hey I looked up a few old posts, but I was having some difficulty understanding the what and why on some of the commands for this.

I want to have the mouse turn into something else( like an hourglass) so that the person using the program understands not to press anything and screw up the script.

if you could point me in the right direction, I would greatly appreciate it.

Share this post


Link to post
Share on other sites
0xdefea7

I'll try to help out. For the DllCall functions, here is what you would need to look up to figure out how everything works:

monoceres Tutorial:     '?do=embed' frameborder='0' data-embedContent>>

LoadCursorFromFile:   http://msdn.microsoft.com/en-us/library/windows/desktop/ms648392(v=vs.85).aspx

SetSystemCursor:        http://msdn.microsoft.com/en-us/library/windows/desktop/ms648395(v=vs.85).aspx

DestroyCursor:            http://msdn.microsoft.com/en-us/library/windows/desktop/ms648386(v=vs.85).aspx

;http://www.autoitscript.com/forum/topic/22214-change-activate-mouse-cursor/

_SetCursor(@WindowsDir & "\cursors\banana.ani", $OCR_NORMAL) 

;==================================================================
; $s_file - file to load cursor from
; $i_cursor - system cursor to change
;==================================================================
Func _SetCursor($s_file, $i_cursor)
   Local $newhcurs, $lResult
   $newhcurs = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $s_file) ;DllCall returns array $newhcurs - this data is stored in $newhcurs[0]
   If Not @error Then
      $lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor) ;$newhcurs[0] is used a HCURSOR argument, $i_cursor is the ID (See MSDN link)
      If Not @error Then
         Sleep(5000)
         $lResult = DllCall("user32.dll", "int", "DestroyCursor", "int", $newhcurs[0]) ;Free up our resources after sleeping for 5 seconds
      Else
         MsgBox(0, "Error", "Failed SetSystemCursor")
      EndIf
   Else
      MsgBox(0, "Error", "Failed LoadCursorFromFile")
   EndIf
EndFunc  ;==>_SetCursor

That should get you started.

Share this post


Link to post
Share on other sites
Fay

Thank you, I will see what I can do.

Share this post


Link to post
Share on other sites
somdcomputerguy

You perhaps could also get by with the ToolTip function. It's certainly not the same as changing the cursor into something else, but it may be an alright alternative..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
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
Sign in to follow this  

×