MouseInverter (Aprilscherz)
Verfasst: 30.03.2009 16:32
Mein kleiner Aprilscherz
Dreht die Maus um wenn man mit der Maus (physikalisch) nach links fährt, fahrt die Maus (virtuell) nach rechts und umgekehrt. Beendet wird mit Escape, Nur Windows.
Vielleicht findet ja noch wer dafür Verwendung 
MfG Tompazi
Dreht die Maus um wenn man mit der Maus (physikalisch) nach links fährt, fahrt die Maus (virtuell) nach rechts und umgekehrt. Beendet wird mit Escape, Nur Windows.
Code: Alles auswählen
; Title: MouseInverter.pb
; Demo: No
; GNU GPLv3orHigher
; PB 4.30
; Windows XP
; Description: Inverts mouse movement and swaps mousebuttons
; WinAPIs(): GetAsyncKeyState
; SwapMouseButton
; SetCursorPos
;Author(s): Tompazi,
GetAsyncKeyState_(0) ; Empty Buffer
;Examine Desktopsize
ExamineDesktops()
Width = DesktopWidth(0)
Height = DesktopHeight(0)
;Examine Mouse Position
X = DesktopMouseX()
Y = DesktopMouseY()
SwapMouseButton_(1) ;Swap Mousebuttons
Repeat
Delay(1) ;relieve CPU
;Check mouse movement
Repeat
Delay(1) ;relieve CPU
;Examine New Mouse Position
X_New = DesktopMouseX()
Y_New = DesktopMouseY()
;Calculate difference
X_DIFF = X - X_New
Y_DIFF = Y - Y_New
Until X_DIFF <> 0 Or Y_DIFF <> 0 ;Check if mouse was moved
SetCursorPos_(X + X_DIFF,Y+Y_DIFF) ;Set the mouse at the new position
;Examine New Mouse Position
X = DesktopMouseX()
Y = DesktopMouseY()
;Keep the mouse away from the borders.
If X =< 0
X = 1
ElseIf X => Width - 1
X = Width -2
EndIf
If Y =< 0
Y = 1
ElseIf Y => Height - 1
Y = Height -2
EndIf
Until GetAsyncKeyState_(#VK_ESCAPE) ;has Escape been pushed?
SwapMouseButton_(0) ;Reswap Mousebuttons
End ;END
;-----------------------------------
; ShortVersion (30 Lines):
;
; GetAsyncKeyState_(0)
; ExamineDesktops()
; Width = DesktopWidth(0)
; Height = DesktopHeight(0)
; X = DesktopMouseX()
; Y = DesktopMouseY()
; SwapMouseButton_(1)
; Repeat
; Delay(1)
; Repeat
; Delay(1)
; X_New = DesktopMouseX()
; Y_New = DesktopMouseY()
; X_DIFF = X - X_New
; Y_DIFF = Y - Y_New
; Until X_DIFF <> 0 Or Y_DIFF <> 0
; SetCursorPos_(X + X_DIFF,Y+Y_DIFF)
; X = DesktopMouseX()
; Y = DesktopMouseY()
; If X =< 0
; X = 1
; ElseIf X => Width - 1
; X = Width -2
; EndIf
; If Y =< 0
; Y = 1
; ElseIf Y => Height - 1
; Y = Height -2
; EndIf
; Until GetAsyncKeyState_(#VK_ESCAPE)
; SwapMouseButton_(0)

MfG Tompazi