I'm visually impaired and struggle to locate the mouse pointer on my multiple monitors.
The following code highlights the location of the mouse pointer but screen update too flashy for comfortable use.
Advice on how to modify this code to smooth the display greatly appreciated.
NB: Code below edited since original posting. A mistyped 'mouse' was responsible for flashy display.
Code: Select all
Global DTqty, MouseDesktop, LastMouseDesktop
Global DTxwd, DTyht, DTxog, DTyog, DTmxa, DTmyd
Global DTMouseX, DTMouseY
Global DPgap=40
Global ExitKey=#VK_F12, ExitKeyPressed=0
; Delay(2000)
; Beep_(1000, 500)
DTqty=ExamineDesktops()-1
Procedure MseDT()
DTMouseX=DesktopMouseX()
DTMouseY=DesktopMouseY()
For DTi = 0 To DTqty
If DTMouseX>=DesktopX(DTi) And DTMouseX<=DesktopX(DTi)+DesktopWidth(DTi) And DTMouseY>=DesktopY(DTi) And DTMouseY<=DesktopY(DTi)+DesktopHeight(DTi)
MouseDesktop=DTi
DTxwd=DesktopWidth(MouseDesktop)
DTyht=DesktopHeight(MouseDesktop)
DTxog=DesktopX(MouseDesktop)
DTyog=DesktopY(MouseDesktop)
ProcedureReturn
EndIf
Next DTi
EndProcedure
Procedure WIinit()
LastMouseDesktop=MouseDesktop
CreateImage(0,DTxwd,DTyht,#PB_Image_DisplayFormat)
OpenWindow(0,DTxog,DTyog,DTxwd,DTyht,"",#PB_Window_BorderLess|#PB_Window_Invisible|#PB_Window_NoActivate)
ImageGadget(0,0,0,DTxwd,DTyht,ImageID(0))
StickyWindow(0,#True)
SmartWindowRefresh(0,#True)
HideWindow(0,#False)
SetWindowLong_(WindowID(0),#GWL_EXSTYLE,GetWindowLong_(WindowID(0),#GWL_EXSTYLE)|#WS_EX_LAYERED|#WS_EX_NOACTIVATE)
SetLayeredWindowAttributes_(WindowID(0),0,0,#LWA_COLORKEY)
EndProcedure
Procedure DrwLne(lcolor)
DC=StartDrawing(ImageOutput(0))
Brush.LOGBRUSH
Brush\lbstyle=#BS_SOLID
Brush\lbcolor=lcolor
Brush\lbhatch=0
newpen=ExtCreatePen_(#PS_GEOMETRIC|#PS_SOLID|#PS_ENDCAP_FLAT|#PS_JOIN_MITER,4,@Brush,0,0)
oldpen=SelectObject_(DC,newpen)
MoveToEx_(DC,0,0,0)
; From top left to mouse
LineTo_(DC,DTmxa-DPgap,DTmyd-DPgap)
MoveToEx_(DC,DTxwd,0,0)
; From top right to mouse
LineTo_(DC,DTmxa+DPgap,DTmyd-DPgap)
MoveToEx_(DC,0,DTyht,0)
; From bottom left to mouse
LineTo_(DC,DTmxa-DPgap,DTmyd+DPgap)
MoveToEx_(DC,DTxwd,DTyht,0)
; From bottom right to mouse
LineTo_(DC,DTmxa+DPgap,DTmyd+DPgap)
LineTo_(DC,DTmxa-DPgap,DTmyd+DPgap)
LineTo_(DC,DTmxa-DPgap,DTmyd-DPgap)
LineTo_(DC,DTmxa+DPgap,DTmyd-DPgap)
LineTo_(DC,DTmxa+DPgap,DTmyd+DPgap)
SelectObject_(DC,oldpen)
DeleteObject_(newpen)
StopDrawing()
ImageGadget(0,0,0,DTxwd,DTyht,ImageID(0))
StickyWindow(0,#True)
SmartWindowRefresh(0,#True)
HideWindow(0,#False)
EndProcedure
MseDT()
WIinit()
; Delay(1000)
; Beep_(2000, 500)
Repeat
DTMouseX=DesktopMouseX()
DTMouseY=DesktopMouseY()
DTmxa=DTMouseX-DTxog
DTmyd=DTMouseY-DTyog
DrwLne($00FF00)
StillMouse=0
StartTime=ElapsedMilliseconds()
While DTMouseX=DesktopMouseX() And DTMouseY=DesktopMouseY()
WaitWindowEvent(25)
Delay(25)
If StillMouse=0 And ElapsedMilliseconds()-StartTime>2000
StillMouse=1
DrwLne($000000)
EndIf
ExitKeyPressed=GetAsyncKeyState_(ExitKey) & 32768
Wend
MseDT()
If LastMouseDesktop=MouseDesktop
DrwLne($000000)
Else
FreeImage(0)
CloseWindow(0)
WIinit()
EndIf
Until ExitKeyPressed<>0
Beep_(3000, 500)
End