Código: Seleccionar todo
#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
; Modified from <a href='http://www.autoitscript.com/forum/index.php?s=&showtopic=97126&view=findpost&p=698489' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?s=&showtopic=97126&view=findpost&p=698489</a>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $hBitmap, $hGui, $hGraphic, $hImage2, $GuiSizeX = @DesktopWidth, $GuiSizeY = @DesktopHeight
Global $GuiSize = 70, $hWnd, $hDC, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
Global $iX1 = 0, $iY1 = 0, $tPoint, $pPoint, $hBMPBuff, $hGraphicGUI, $hPen, $aMPos, $aMPosNew
Global $iOpacity = 255, $dll = DllOpen("user32.dll")
GUISetOnEvent(-3, "_Exit")
OnAutoItExitRegister("_Exit")
Main()
Func Main()
$hGui = GUICreate("L1", $GuiSizeX, $GuiSizeY, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
GUISetState(@SW_SHOW, $hGui)
_GDIPlus_Startup()
$hWnd = _WinAPI_GetDC(0)
$hDC = _WinAPI_CreateCompatibleDC($hWnd)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hWnd, $GuiSizeX, $GuiSizeY)
_WinAPI_SelectObject($hDC, $hBitmap)
$hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC)
$hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($GuiSizeX, $GuiSizeY, $hGraphic)
$hGraphicGUI = _GDIPlus_ImageGetGraphicsContext($hBMPBuff)
_GDIPlus_GraphicsClear($hGraphic)
$hPen = _GDIPlus_PenCreate(0xffff0000, 10)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $GuiSizeX);$iWidth )
DllStructSetData($tSize, "Y", $GuiSizeY);$iHeight)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT); Create point destination structure here
$pPoint = DllStructGetPtr($tPoint); Create pointer to this dll data structure, $pPTDest parameter
DllStructSetData($tPoint, "X", $iX1)
DllStructSetData($tPoint, "Y", $iY1)
_WinAPI_UpdateLayeredWindow($hGui, $hWnd, $pPoint, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA)
Do
While _IsPressed("01", $dll)
$aMPos = MouseGetPos()
_GDIPlus_GraphicsDrawLine($hGraphic, $aMPos[0], $aMPos[1],$aMPos[0]+1, $aMPos[1]+1, $hPen)
_WinAPI_UpdateLayeredWindow($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA)
WEnd
Sleep(50)
Until _IsPressed("1B", $dll); ESC key
EndFunc ;==>Main
Func _Exit()
DllClose($dll)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphicGUI)
_GDIPlus_GraphicsDispose($hGraphic)
_WinAPI_ReleaseDC(0, $hWnd)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hDC)
_GDIPlus_Shutdown()
GUIDelete($hGui)
Exit
EndFunc ;==>_Exit