Código: Seleccionar todo
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("ExpandEnvStrings", 1)
Opt("ExpandVarStrings", 1)
Global $WIN_X = @DesktopWidth
Global $WIN_Y = @DesktopHeight
Global $MOUSE_X
Global $MOUSE_Y
_GDIPlus_Startup()
Global $GUI = GUICreate("TEST", $WIN_X, $WIN_Y, 0, 0, $WS_POPUP)
Global $GUI_GRAPH = _GDIPlus_GraphicsCreateFromHWND($GUI)
Global $PEN_WHITE = _GDIPlus_PenCreate(0xFF999999)
GUISetBkColor(0x0,$GUI)
MouseMove($WIN_X/2,$WIN_Y/2,0)
GUISetState(@SW_SHOW,$GUI)
_MouseDraw($WIN_X/2,$WIN_Y/2,$GUI_GRAPH,$PEN_WHITE)
while 1
Global $GUI_MSG = GUIGetMsg()
Switch $GUI_MSG
case $GUI_EVENT_CLOSE
Exit
EndSwitch
If _MouseMove() Then
_GraphClear($GUI_GRAPH)
_MouseDraw($MOUSE_X,$MOUSE_Y,$GUI_GRAPH,$PEN_WHITE)
EndIf
wend
Func _MouseDraw($MOUSE_X,$MOUSE_Y,$GUI_GRAPH,$PEN)
_GDIPlus_GraphicsDrawLine($GUI_GRAPH,0,$MOUSE_Y,$WIN_X,$MOUSE_Y,$PEN)
_GDIPlus_GraphicsDrawLine($GUI_GRAPH,$MOUSE_X,0,$MOUSE_X,$WIN_Y,$PEN)
EndFunc
Func _GraphClear($GUI_GRAPH)
_GDIPlus_GraphicsClear($GUI_GRAPH,0xFF000000)
EndFunc
Func _MouseMove()
Global $MOUSE_X = _WinAPI_GetMousePosX()
Global $MOUSE_Y = _WinAPI_GetMousePosY()
Global $MOUSE_X_N = _WinAPI_GetMousePosX()
Global $MOUSE_Y_N = _WinAPI_GetMousePosY()
if $MOUSE_X <> $MOUSE_X_N or $MOUSE_Y <> $MOUSE_Y_N Then
Return True
Else
return False
EndIf
EndFunc