Jump to content

Recommended Posts

Posted

Oop, Neglected to say Windows 10.
To see where the mouse pointer is located, press <ctrl> and upon release, a ring appears around the mouse pointer and shrinks away.
I would like to have it appear when ever the mouse is moved and disappear when the mouse stops.

Posted (edited)
I think OP is talking about Windows visibility configuration (found on all Windows OS's I guess) where you can display a circle around the mouse cursor (by hitting Ctrl) or leave a vanishing trace of several mouse cursors while the cursor is moving etc... I just checked these possibilities to test them :

mouse-pointer-options.png Edited by pixelsearch

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted (edited)

Something like that?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>

Local $hGui = GUICreate("", 100, 100, 0, 0, $WS_POPUp, $WS_EX_TRANSPARENT)
GUISetBkColor(0xFFEA00) ;       * <-- set the color
WinSetTrans($hGui, '', 100) ;   * <-- transparency 255 = Solid, 0 = Invisible.
GUISetState(@SW_SHOW, $hGui)

Local $aPos = WinGetPos($hGui)
Local $iWidth = $aPos[2]
Local $iHeight = $aPos[3]

$hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth, $iHeight, $iWidth, $iHeight)
_WinAPI_SetWindowRgn($hGui, $hRgn)

; Loop until the user exits.
While 1
    $aMpos = MouseGetPos()
    WinMove($hGui, "", $aMpos[0] - 50, $aMpos[1] - 50)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    Sleep(10)
WEnd

 

Edited by ioa747
Correction

I know that I know nothing

Posted

This is a good start. However, it needs to activate when the mouse is moved and disappear when the mouse stops..
Is AutoIt capable of generating a TSR program?

Posted (edited)
1 hour ago, Emerogork said:

Is AutoIt capable of generating a TSR program?

yes

PS: ok, here's some code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <Misc.au3>

Local $hGui = GUICreate("", 100, 100, 0, 0, $WS_POPUp, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TRANSPARENT)) ; close this GUI by the tray icon
GUISetBkColor(0xFFEA00) ;       * <-- set the color
WinSetTrans($hGui, '', 100) ;   * <-- transparency 255 = Solid, 0 = Invisible.
GUISetState(@SW_SHOW, $hGui) ; https://www.autoitscript.com/forum/topic/210715-special-effect-for-the-mouse-cursor/?do=findComment&comment=1523181
WinSetOnTop($hGui, "", 1)

Local $aPos = WinGetPos($hGui)
Local $iWidth = $aPos[2]
Local $iHeight = $aPos[3]
Global $aMposWas[5], $hTimer = 0, $bItIsPressed = False
$hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth, $iHeight, $iWidth, $iHeight)
_WinAPI_SetWindowRgn($hGui, $hRgn)

; Loop until the user exits.
While 1
    $aMpos = MouseGetPos()
    If $aMposWas[0] <> $aMpos[0] Or $aMposWas[1] <> $aMpos[1] Then
        If Not $hTimer Then WinSetState($hGui, "", @SW_SHOW)
        $hTimer = TimerInit()
        $aMposWas = $aMpos
        WinMove($hGui, "", $aMpos[0] - 50, $aMpos[1] - 50)
    EndIf
    If $hTimer And TimerDiff($hTimer) > 500 Then
        $hTimer = 0
        WinSetState($hGui, "", @SW_HIDE)
    EndIf
    
    ; on click, do something. This changes the color.
    If Not $bItIsPressed And _IsPressed("01") Then
        GUISetBkColor(0xFF33AA)
        AdlibRegister(SetColorBackToNormal, 250)
        $bItIsPressed = True
        $hTimer = TimerInit()
    EndIf
    If $bItIsPressed And Not _IsPressed("01") Then
        $bItIsPressed = False
    EndIf
    

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSwitch
WEnd

Func SetColorBackToNormal()
    $hTimer = TimerInit() ; ..to extend the time it shows the circle.
    AdlibUnRegister(SetColorBackToNormal)
    GUISetBkColor(0xFFEA00) ;       * <-- set the color
EndFunc

...but you could have done this changes yourself 😕 

Edit2: hid the taskbar icon. ( Also, I like Nine's dimming effect. Looks nice. ) 

Edit3: added to change the color of the circle on click.

Edited by argumentum
better code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

  • Solution
Posted (edited)

To pursue on a nice script from @ioa747, try this :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>

Opt("MustDeclareVars", True)

HotKeySet("^!{ESC}", _Exit) ; ctrl-alt Esc
Local $hGui = GUICreate("", 100, 100, 0, 0, $WS_POPUp, $WS_EX_TRANSPARENT + $WS_EX_TOPMOST)
GUISetBkColor(0xFFEA00) ;       * <-- set the color
GUISetState()

Local $aPos = WinGetPos($hGui)

Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aPos[2], $aPos[3], $aPos[2], $aPos[3])
_WinAPI_SetWindowRgn($hGui, $hRgn)

Local $iX = $aPos[0], $iY = $aPos[1], $iCount = 0
While Sleep(20)
  $aPos = MouseGetPos()
  If $iX <> $aPos[0] Or $iY <> $aPos[1] Then
    WinMove($hGui, "", $aPos[0] - 50, $aPos[1] - 50)
    WinSetTrans($hGui, '', 100)
    $iX = $aPos[0]
    $iY = $aPos[1]
    $iCount = 0
  Else
    If $iCount = 10 Then ContinueLoop
    $iCount += 0.5  ; set speep of vanishing here
    WinSetTrans($hGui, '', 100 - ($iCount * 10))
  EndIf
WEnd

Func _Exit()
  Exit
EndFunc   ;==>_Exit

 

Edited by Nine
Posted

It is very close and it does work the way I want.
No, I could not have done this myself. I have no experience with this type of coding..
50 years of other kinds of coding, yes, but not this.

Now that I have a working program, I can explore to develop this further and
branch off to design other projects.

Thank you.

Posted

It is very close and it does work the way I want.
No, I could not have done this myself. I have no experience with this type of coding..
50 years of other kinds of coding, yes, but not this.

Now that I have a working program, I can explore to develop this further and
branch off to design other projects.

Although  I have use for it myself, I have an instructor or two that have on-line courses. Most of the time, the student has no idea where he recently clicked to go the demonstration. He is not one to remember to use the <ctrl> button to show the rings.

I suspect that he is going to ask me if I can get the concentric rings the way that Windows has it.

Thank you.

Posted
15 minutes ago, Emerogork said:

Most of the time, the student has no idea where he recently clicked to go the demonstration.

added a color change for when the left click is clicked. To have a reference that it was clicked.

16 minutes ago, Emerogork said:

I suspect that he is going to ask me if I can get the concentric rings the way that Windows has it.

if one of the above members code it. All this is above my pay grade :D

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...