Je suis en train d'écrire un gadget qui affiche une ligne x,y à l'endroit où se trouve la souris mais j'aimerais pouvoir masquer entièrement le curseur quelque soit l'endroit où il se trouve. J'ai déjà fait quelques recherches, mais tout ce que j'ai trouvé sont des fonctions masquant le curseur dans un GUI bien déterminée..
Voici mon code:
► Afficher le textecode
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
#include <Constants.au3>
AutoItSetOption ( "TrayAutoPause" ,0)
AutoItSetOption ( "TrayMenuMode",1)
HotKeySet("+{END}","Bye")
Dim $linex,$liney,$color,$color2
Menu()
Func Menu()
$Menu = GUICreate("Mouse Tracker", 225, 255)
$Label1 = GUICtrlCreateLabel("", 16, 23, 20, 20)
GUICtrlSetBkColor(-1, 0x7DB0E8)
$Label2 = GUICtrlCreateLabel("", 35, 23, 20, 20)
GUICtrlSetBkColor(-1, 0xE59C38)
$Label3 = GUICtrlCreateLabel("Firefox", 64, 24, 35, 17)
$Label4 = GUICtrlCreateLabel("", 35, 55, 20, 20)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Label5 = GUICtrlCreateLabel("", 16, 55, 20, 20)
GUICtrlSetBkColor(-1, 0x00000)
$Label6 = GUICtrlCreateLabel("Black and white", 64, 56, 82, 17)
$Label7 = GUICtrlCreateLabel("", 34, 86, 20, 20)
GUICtrlSetBkColor(-1, 0x004080)
$Label8 = GUICtrlCreateLabel("", 15, 86, 20, 20)
GUICtrlSetBkColor(-1, 0x008080)
$Label9 = GUICtrlCreateLabel("Zen", 63, 91, 23, 17)
$Label10 = GUICtrlCreateLabel("", 34, 117, 20, 20)
GUICtrlSetBkColor(-1, 0x0000FF)
$Label11 = GUICtrlCreateLabel("", 15, 117, 20, 20)
GUICtrlSetBkColor(-1, 0xFF0000)
$Label12 = GUICtrlCreateLabel("Police", 63, 122, 33, 17)
$Label10 = GUICtrlCreateLabel("", 34, 147, 20, 20)
GUICtrlSetBkColor(-1, 0x8000FF)
$Label11 = GUICtrlCreateLabel("", 15, 147, 20, 20)
GUICtrlSetBkColor(-1, 0xFF0080)
$Label12 = GUICtrlCreateLabel("Hello Kitty", 63, 152, 80, 17)
$BtnOK= GUICtrlCreateButton("Ok", 40, 215, 62, 21, $WS_GROUP)
$BtnClose = GUICtrlCreateButton("Quit", 115, 215, 62, 21, $WS_GROUP)
$pxsize = GUICtrlCreateInput("1", 17, 179, 38, 21)
$Label13 = GUICtrlCreateLabel("pixels", 59, 183, 30, 17)
$RadioFF = GUICtrlCreateRadio("", 1, 27, 14, 14)
$RadioBW = GUICtrlCreateRadio("", 1, 59, 14, 14)
$RadioZ = GUICtrlCreateRadio("", 1, 90, 14, 14)
$RadioP = GUICtrlCreateRadio("", 1, 119, 14, 14)
$RadioHK = GUICtrlCreateRadio("", 1, 149, 14, 14)
GUICtrlSetState($RadioFF,$GUI_CHECKED)
GUISetState(@SW_SHOW)
$choix = 0
While $choix = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Bye()
Case $BtnClose
Bye()
Case $BtnOK
If GUICtrlRead($RadioFF) = $GUI_CHECKED Then
$color = 0x7DB0E8
$color2 = 0xE59C38
ElseIf GUICtrlRead($RadioBW) = $GUI_CHECKED Then
$color = 0x000000
$color2 = 0xFFFFFF
ElseIf GUICtrlRead($RadioZ) = $GUI_CHECKED Then
$color = 0x008080
$color2 = 0x004080
ElseIf GUICtrlRead($RadioP) = $GUI_CHECKED Then
$color = 0xFF0000
$color2 = 0x0000FF
ElseIf GUICtrlRead($RadioHK) = $GUI_CHECKED Then
$color = 0xFF0080
$color2 =0x8000FF
Else
MsgBox(16,"","Il faut choisir une couleur")
EndIf
$px = GUICtrlRead($pxsize)
$choix = 1
GUIDelete($Menu)
EndSwitch
Sleep(1)
WEnd
$dummy = GUICreate("dummy")
$linex = GUICreate("",@DesktopWidth,$px,-1,-1,BitOR($WS_EX_TRANSPARENT,$WS_POPUP),$WS_EX_TOPMOST,$dummy)
GUISetBkColor($color)
WinSetTrans($linex,"",150)
GUISetState()
$liney = GUICreate("",$px,@DesktopHeight,-1,-1,BitOR($WS_EX_TRANSPARENT,$WS_POPUP),$WS_EX_TOPMOST,$dummy)
GUISetBkColor($color)
WinSetTrans($liney,"",150)
GUISetState()
TrayTip("Mouse Tracker","I'm over here",3)
Main()
EndFunc
Func Main()
While 1
Sleep(1)
WinMove($linex,"",1,MouseGetPos(1)+1)
WinMove($liney,"",MouseGetPos(0)+1,1)
While _IsPressed(01)
GUISetBkColor($color2,$linex)
GUISetBkColor($color2,$liney)
WEnd
GUISetBkColor($color,$linex)
GUISetBkColor($color,$liney)
If TrayGetMsg () = $TRAY_EVENT_PRIMARYDOWN Then
GUIDelete($linex)
GUIDelete($liney)
menu()
ExitLoop
EndIf
WEnd
EndFunc
Func Bye()
DllClose("user32.dll")
Exit
EndFunc


