topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:14 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: change cursor depending on program  (Read 8568 times)

miva2

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
IDEA: change cursor depending on program
« on: February 26, 2012, 08:49 AM »
Hello everyone, i would like my cursor to change depending on the program I'm using.

For me personally: I was playing Realm of the Mad God and noticed my cursor is not very visible in the game. So i want to have a different cursor when I am playing that game and go back to my old cursor when I quit playing (or when i alt+tab to a browser for example)
Or is it possible to make a small batchfile that changes my cursor to a predefined cursor and when i execute it again it goes back to my previous one?
I have never really looked in the power of batchfiles so I don't know if that is possible.

I'm sorry i didn't research in too much detail. I searched for "cursor" and found some interesting things but not exactly what I was looking for. My apologies If i missed the answer.

Also, Thank you very much to all programmers who make free software. Very much appreciated   :Thmbsup:

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #1 on: February 26, 2012, 05:34 PM »
I haven't done much in this area. But it's my impression the application that owns the window under the mouse can capture the mouse and control the cursor. You may find it simpler to substitute custom cursors for the standard Windows ones.

Something like this may work:

http://www.softpedia...imated-Cursors.shtml


miva2

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #2 on: February 28, 2012, 02:50 PM »
I haven't done much in this area. But it's my impression the application that owns the window under the mouse can capture the mouse and control the cursor. You may find it simpler to substitute custom cursors for the standard Windows ones.

Something like this may work:

http://www.softpedia...imated-Cursors.shtml



Unfortunately, that is not really what I am looking for but thank you for your input.
I'm currently using a standard windows yellow cursor and i think the default white one will do the job well for me. I just need to find a way to quickly change it, whenever I see fit. Without needing to go through all the menus.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #3 on: February 28, 2012, 03:39 PM »
Found this AHK tool on thebitguru, that, with some twiddling (if you can handle AHK), could be forced into auto-switching depending on the current active executable. Without twiddling it can switch on a keypress, if some hotkey is associated with the shortcut.

Needs a scheme name to be set in the script, and probably a fix for Win7 if desired, but it could be a start.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #4 on: February 28, 2012, 03:52 PM »
You can use my Mat application to change the cursor via a batch file, shortcut, script or whatever.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #5 on: February 28, 2012, 03:54 PM »
This looks simpler using AutoIt3. Although if the program that owns the window keeps changing it to what it wants, you may be out of luck:

http://www.autoitscr...ons/GUISetCursor.htm

also see the function WinGetHandle to get the handle of the Window that you want to override the cursor for.  You may be able to use "[Active]" (which is the window with the keyboard focus at the time you hit the hotkey) where GuiSetCursor asks for handle. You have to try it and see.


You can download AutoIt3 tools here:
http://www.autoitscript.com/site/


edit: Many of the AutoIt3 "Gui" functions work on regular windows if you just put the window handle.  Seems this one does not. At least I couldn't get it to work.  Some things depend on the innards of AutoIt3 Gui code.  There's no way to know for sure until you try it. :(


« Last Edit: February 28, 2012, 04:37 PM by MilesAhead »

miva2

  • Supporting Member
  • Joined in 2009
  • **
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
Re: IDEA: change cursor depending on program
« Reply #6 on: March 06, 2012, 10:56 AM »
Thanks for the suggestions!
i'll try them now! I've been busy the past week, no time to check DC :-[

Edit: I've chosen to use Mat. Thanks Skwire!
It does perfectly what I want it to do and now i've finally found a use for batchfiles, something i've wanted to be looking into.

The AHK script looks useful too but I have to start it before i'm able to use the shortcut and then it keeps running in my system tray?
I already have enough programs running simultaneously and don't need even more unnecessary icons in my tray :/
Thanks for the tip though.
AutoIt looks kind of similar to AHK from what I've seen. Right?
AHK and AutoIt are things to look into later.


Just one issue with Mat:
I wrote this small batchfile
C:\Users\Michael\Documents\MouseAccelToggler\MouseAccelToggler.exe cursor="C:\Windows\Cursors\aero_arrow_xl.cur"
It works perfectly but when I execute it I get an error message saying "Invalid parameter passed" and then it lists the valid parameters.(using Vista 32 bit)
I don't see any mistake in the parameter and it works perfectly.

also, I've wrote a second command with a different cursor, to change back.
Can I write both commands in one file and make it use the correct command, depending on my current cursor? so, like this:
If(currentCursor == yellowCursor)
setCursor(whiteCursor)
else if (currentCursor == whiteCursor)
setCursor(yellowCursor)

Well, it gets the point across. Is there some kind of getCurrentCursor() method or some other way?
That's something I'll look into another day...

Besides those 2 little details, my problem is solved :)
Thanks again MilesAhead, Ath and skwire.
« Last Edit: March 06, 2012, 03:37 PM by miva2 »