Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GDIPlus.au3>
- #include <GUIConstants.au3>
- #include <WindowsConstants.au3>
- #include <WinAPI.au3>
- #include <Misc.au3>
- #include <Constants.au3>
- ; - Author: name22 (www.autoit.de)
- Opt("GUIOnEventMode", 1)
- HotKeySet("{ESC}", "_Exit")
- $vU32DLL = DllOpen("User32.dll")
- $iGUIColorBG = 0xFFFFFFFF
- $iGUIWidth = @DesktopWidth
- $iGUIHeight = @DesktopHeight
- $hWnd = GUICreate("Test", $iGUIWidth, $iGUIHeight, 0, 0, BitOR(0x80000000, 0x08000000), BitOR(0x00080000, 0x00000008, 0x00000080))
- GUISetState()
- _GDIPlus_Startup()
- $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
- $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
- $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
- _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
- $hPen = _GDIPlus_PenCreate(0xFF000000, 2)
- $hDC = _WinAPI_GetDC($hWnd)
- $hCDC = _WinAPI_CreateCompatibleDC($hDC)
- $tSize = DllStructCreate($tagSIZE)
- $pSize = DllStructGetPtr($tSize)
- DllStructSetData($tSize, "X", $iGUIWidth)
- DllStructSetData($tSize, "Y", $iGUIHeight)
- $tSource = DllStructCreate($tagPOINT)
- $pSource = DllStructGetPtr($tSource)
- $tBlend = DllStructCreate($tagBLENDFUNCTION)
- $pBlend = DllStructGetPtr($tBlend)
- DllStructSetData($tBlend, "Alpha", 255)
- DllStructSetData($tBlend, "Format", 1)
- $tPoint = DllStructCreate($tagPOINT)
- $pPoint = DllStructGetPtr($tPoint)
- DllStructSetData($tPoint, "X", 0)
- DllStructSetData($tPoint, "Y", 0)
- GUIRegisterMsg($WM_PAINT, "_ReDraw")
- $aMousePosOld = MouseGetPos()
- While True
- $aMousePosNew = MouseGetPos()
- If _IsPressed("10", $vU32DLL) Then
- If $aMousePosOld[0] <> $aMousePosNew[0] Or $aMousePosOld[1] <> $aMousePosNew[1] Then _GDIPlus_GraphicsDrawLine($hBuffer, $aMousePosOld[0], $aMousePosOld[1], $aMousePosNew[0], $aMousePosNew[1], $hPen)
- _ReDraw()
- EndIf
- If BitOR(WinGetState($hWnd), 2) <> 2 Then _WinAPI_SetWindowPos($hWnd, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE))
- $aMousePosOld = $aMousePosNew
- WEnd
- Func _ReDraw()
- Local $hBitmapTmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
- _WinAPI_SelectObject($hCDC, $hBitmapTmp)
- _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, $pSize, $hCDC, $pSource, 0, $pBlend, 2)
- _WinAPI_DeleteObject($hBitmapTmp)
- EndFunc
- Func _Exit()
- _GDIPlus_GraphicsDispose($hGraphic)
- _GDIPlus_GraphicsDispose($hBuffer)
- _GDIPlus_BitmapDispose($hBitmap)
- _GDIPlus_PenDispose($hPen)
- _GDIPlus_Shutdown()
- DllClose($vU32DLL)
- Exit
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement