changing cursor to hourglass while script is waiting?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

changing cursor to hourglass while script is waiting?

Post by migro » Tue Jul 21, 2009 5:56 pm

Is there a possibility to change the cursor to an hourglass while the script is waiting (wait>10) until a other action is performed (e.g. a restart of an SQL-Server)?
regards
migro

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jul 21, 2009 6:26 pm

You can try using the SetCursor/GetCursor API functions as in the example in this thread:

http://www.mjtnet.com/forum/viewtopic.php?t=4044
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

Post by migro » Tue Jul 21, 2009 7:20 pm

Dear Marcus,

thanks for reply.

Is it possible that you have a wrong link in your reply?
In this thread I haven't found anything about SetCursor or GetCursor.
regards
migro

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 22, 2009 7:32 am

Yes, sorry. Correct link is:

http://www.mjtnet.com/forum/viewtopic.php?t=4046

Look at the second post, from me:

However, I think that is not quite complete. Try the following code:

Code: Select all

//Get current cursor and remember it in savCurs
LibFunc>user32,GetCursor,curCurs
LibFunc>user32,CopyIcon,savCurs,curCurs

//Set current system cursor to banana (look in WIN_DIR\cursors for others)
LibFunc>user32,LoadCursorFromFileA,newCurs,%WIN_DIR%\cursors\banana.ani
LibFunc>user32,SetSystemCursor,sscr,newCurs,32512
LibFunc>user32,SetCursor,scr,newCurs

//Do something
MessageModal>Press Ok to return cursor to normal ...

//Set system cursor back to original saved cursor
LibFunc>user32,SetSystemCursor,sscr,savCurs,32512
LibFunc>user32,SetCursor,scr,savCurs
It probably needs some tweaking and may not take all scenarios into account - you may want to be more specific about how you set the cursor back, rather than setting it to whatever was active to begin with (there could be a danger you set the system cursor to the text caret, or hourglass for example, depending on what was active when the code ran).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

Post by migro » Thu Jul 23, 2009 1:05 am

Dear Marcus,

thanks so much. That was exactly what I'm looking for.
regards
migro

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts