Jump to content
Sign in to follow this  
UEZ

_GDIPlus_MarkScreenRegionAnimated build 2018-11-30 beta

Recommended Posts

...nice tool @UEZ, thank for sharing,

11 hours ago, UEZ said:

 ... If you have any improvements, please post it here ...

my 2 cents:
if you just change the 2 lines 23 and 24 with the following 4 lines, you can also drag around the selected area by clicking in the middle of the area and dragging. (this forces you to point the mouse with more precision for the resizing, but it is still possible)

Found a better solution: just add the following 2 lines at line 50 (right before the GUISetState(@SW_SHOWNA, $__g_hGUI_Bg) statement).
Doing so, the "drag" label (handle) is inserted below the resizing handles, avoiding that these remain behind the drag label itself.

Local $__g_iLabel_00 = GUICtrlCreateLabel("", 1, 1, 1, 1, -1, $GUI_WS_EX_PARENTDRAG) ; inner
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

 

Edited by Chimp
found a better solution

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

@Chimp: thanks for your feedback. :thumbsup:   I updated the code from post#1.

You can drag the marked area by hovering the mouse over the selection and holding the rmb pressed.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

A very interesting effect. Thanks for sharing.

Few little change (cosmetic):

;coded by UEZ build 2018-09-25 beta
#include <APISysConstants.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>


Global $__g_hGUI_MarkArea, $__g_hGUI_Bg, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _
        $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4, $__g_bSelectionDone = False

Global $aRect = _GDIPlus_MarkScreenRegionAnimated()
_ArrayDisplay($aRect, "Marked area coordinates")

Func _GDIPlus_MarkScreenRegionAnimated($bAnim = True)
    _GDIPlus_Startup()
    Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]")
    Local Const $aFullScreen = WinGetPos($hFullScreen)

    $__g_hGUI_Bg = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], BitOR($WS_CLIPCHILDREN, $WS_POPUP), $WS_EX_TOPMOST) ;to avoid cursor flickering and for proper control read
    WinSetTrans($__g_hGUI_Bg, "", 0x01)

    $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $bAnim ? $WS_POPUP : BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $__g_hGUI_Bg)
    GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea)
    If Not $bAnim Then $__g_iColor_ResizeDots = 0xFF0000

    $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)
    $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
    GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots)

    GUISetState(@SW_SHOWNA, $__g_hGUI_Bg)
    GUISetState(@SW_SHOW, $__g_hGUI_MarkArea)

    $__g_iOldCursor = MouseGetCursor()
    GUISetCursor(3, 1, $__g_hGUI_Bg)
    GUISetCursor(3, 1, $__g_hGUI_MarkArea)
    _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0)

    Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $aOldWinPos, $aOldMPos, $bMoved
    Local $aGUIStartPos
    #forceref $bMoved

    Do
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                If $bAnim Then
                    GUIRegisterMsg($WM_TIMER, "")
                    DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID)
                    GUIRegisterMsg($WM_ERASEBKGND, "")
                EndIf
                _GDIPlus_Shutdown()
                Local $aResult = WinGetPos($__g_hGUI_MarkArea)
                $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0]
                $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1]
                GUIDelete($__g_hGUI_MarkArea)
                GUIDelete($__g_hGUI_Bg)
                Return $aResult
        EndSwitch
        $aMPos = MouseGetPos()
        If ($aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1]) And (Not $__g_bSelectionDone) Then
            WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1])
            $aPrevMPos = $aMPos
        EndIf
        $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
        If $aCI[2] And (Not $__g_bSelectionDone) Then
            $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea)
            If $bAnim Then
                GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
                GUIRegisterMsg($WM_TIMER, "PlayBorderAnim")
                $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 50, "ptr", 0)[0]
            EndIf
            While $aCI[2] * Sleep(10)
                $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                $aMPos = MouseGetPos()
                $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1
                $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1
                If $aMPos[0] < $aGUIStartPos[0] Then
                    $iX = $aMPos[0]
                Else
                    $iX = $aGUIStartPos[0]
                EndIf
                If $aMPos[1] < $aGUIStartPos[1] Then
                    $iY = $aMPos[1]
                Else
                    $iY = $aGUIStartPos[1]
                EndIf
                WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH)
                UpdateCtrlPos($bAnim)
            WEnd

            $__g_bSelectionDone = True
            GUISetCursor(3, 1, $__g_hGUI_MarkArea)
        ElseIf $aCI[3] And $__g_bSelectionDone Then
            $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea)
            If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aGUIStartPos[0], $aGUIStartPos[1], $aGUIStartPos[0] + $aGUIStartPos[2], $aGUIStartPos[1] + $aGUIStartPos[3]) Then
                $aMPos = MouseGetPos()
                $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea)
                While $aCI[3] * Sleep(10)
                    $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                    WinMove($__g_hGUI_MarkArea, "", $aGUIStartPos[0] - ($aMPos[0] - MouseGetPos(0)), $aGUIStartPos[1] - ($aMPos[1] - MouseGetPos(1)), $__g_iW, $__g_iH)
                    GUISetCursor(0, 1, $__g_hGUI_Bg)
                    GUISetCursor(0, 1, $__g_hGUI_MarkArea)
                WEnd
                GUISetCursor(3, 1, $__g_hGUI_Bg)
                GUISetCursor(3, 1, $__g_hGUI_MarkArea)
            EndIf
        EndIf
        If $__g_bSelectionDone Then
            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
            If @error Then ContinueLoop
            Switch $aCI[4]
                Case $__g_iLabel_TL
                    GUISetCursor(12, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), MouseGetPos(1), $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_BR
                    GUISetCursor(12, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_TR
                    GUISetCursor(10, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_BL
                    GUISetCursor(10, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_LM
                    GUISetCursor(13, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3])
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_RM
                    GUISetCursor(13, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3])
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_TM
                    GUISetCursor(11, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2], $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case $__g_iLabel_BM
                    GUISetCursor(11, 1, $__g_hGUI_MarkArea)
                    If $aCI[2] Then
                        $aOldWinPos = WinGetPos($__g_hGUI_MarkArea)
                        $aOldMPos = MouseGetPos()
                        While $aCI[2] * Sleep(10)
                            $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea)
                            WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2], $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1)))
                        WEnd
                        UpdateCtrlPos($bAnim)
                    EndIf
                Case Else
                    GUISetCursor(3, 1, $__g_hGUI_MarkArea)
            EndSwitch
        EndIf
    Until False
EndFunc   ;==>_GDIPlus_MarkScreenRegionAnimated

Func UpdateCtrlPos($bAnim = True)
    Local Const $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea)
    If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "")
    $__g_iW = $aGUIStartPos[2]
    $__g_iH = $aGUIStartPos[3]
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TL, 0, 0, $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), 0, $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder)
    ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder)
    If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "PlayBorderAnim")
EndFunc   ;==>UpdateCtrlPos

Func PlayBorderAnim()
    Local $aWinPos = WinGetClientSize($__g_hGUI_MarkArea), $iW = $aWinPos[0], $iH = $aWinPos[1]
    Local Static $fOffset = 0
    Local Const $iSize = $__g_iBorder / 2
    Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea)
    Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
    Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
    Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap)
    Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
    Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _
                $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $__g_iColor_ResizeDots), $hPen3 = _GDIPlus_PenCreate(0xFF000000)
    _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOT)
    _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF)
    ;for faster performance direct dll calls
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen2, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2)
    DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1)

    _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY)

    $fOffset += 0.5
    _GDIPlus_GraphicsDispose($hCanvas)
    _WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
    _WinAPI_DeleteDC($hDC_backbuffer)
    _WinAPI_DeleteObject($hHBitmap)
    _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_PenDispose($hPen3)
    _GDIPlus_BrushDispose($hBrush)
EndFunc   ;==>PlayBorderAnim

Func WM_ERASEBKGND($hWnd, $iMsgm, $wParam, $lParam) ;suppress repainting to avoid flickering but causes some other side effects
    #forceref $iMsgm, $wParam, $lParam, $hWnd
    Local Const $hBrush = _WinAPI_CreateSolidBrush(0xEFCDAB) ;BGR format
;~  _WinAPI_RedrawWindow($__g_hGUI_MarkArea, 0, 0, BitOR($RDW_NOERASE, $RDW_NOCHILDREN, $RDW_NOFRAME, $RDW_VALIDATE))
    _WinAPI_SetClassLongEx($__g_hGUI_MarkArea, $GCL_HBRBACKGROUND, $hBrush)
    _WinAPI_DeleteObject($hBrush)
    Return 0
EndFunc   ;==>WM_ERASEBKGND

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2019-10-01

Share this post


Link to post
Share on other sites

Hello,

Thank you for your example, I've tried to change the way it exit with hotkey and accelerators but I can't get it.

I've tried with a hidden button too but it seem this part

Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                If $bAnim Then
                    GUIRegisterMsg($WM_TIMER, "")
                    DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID)
                    GUIRegisterMsg($WM_ERASEBKGND, "")
                EndIf
                _GDIPlus_Shutdown()
                Local $aResult = WinGetPos($__g_hGUI_MarkArea)
                $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0]
                $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1]
                GUIDelete($__g_hGUI_MarkArea)
                GUIDelete($__g_hGUI_Bg)
                Return $aResult
        EndSwitch

Doesn't want any more Case.

Any idea for changing the way it exit , like pressing Enter key ?

Share this post


Link to post
Share on other sites

@Stormgrade: done -> see post#1. Return key exits selection, too.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Bilgus
      This is an update or derivative work of Beege 's Scrolling Line Graph UDF
      https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf
       
      I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform
      High CPU usage went hand in hand with that requirement
      Another issue was just how long updating took to complete
      I've hopefully rectified that with this version
       
      There are a few changes (only 1 line per graph for instance)
      The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3)
       
      Example 2 (peak.au3)
      UDF
      Updated:
      Previous Downloads [38 / 38/ 0]
      SSLG.au3 waveform.au3 Peak.au3
    • By UEZ
      I was inspired by a CSS example to create a procedural graphic without any shader or ray tracing technique.
      Here the result using GDI+ only:

       
      Blue Orb.au3
      ;Inspired from https://codepen.io/bradleytaunt/details/VwvzKyb ;Coded by UEZ build 2020-05-07 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If @OSBuild < 7600 Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "ERROR", "This demo requires GDIPlus v1.1", 10) _GDIPlus_Startup() Global Const $iW = 1200, $iH = 700, $iSize_globe = 450 Global Const $hGUI = GUICreate("GDI+ Procedural Gfx / Blue Orb v1.20 by UEZ", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;~ _GDIPlus_GraphicsSetCompositingQuality($hGfx, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HALF) ;draw background Global Const $hBrush_bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xFF1E88E5, 0xFF1565C0, 2) _GDIPlus_LineBrushSetSigmaBlend ($hBrush_bg, 0.95, 1) ;create blurry edge _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_bg) ;draw blurred text Global Const $hImage_text = _GDIPlus_BitmapCreateFromScan0($iW, $iH / 2) Global Const $hGfx_text = _GDIPlus_ImageGetGraphicsContext($hImage_text) Global Const $hPath_text = _GDIPlus_PathCreate() Global Const $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global Const $hStringFormat = _GDIPlus_StringFormatCreate() Global Const $hBrush_txt = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xE0FFFFFF, 0xA01A237E) ;_GDIPlus_BrushCreateSolid(0xF02E86FB) _GDIPlus_LineBrushSetSigmaBlend($hBrush_txt, 0.66, 1) Global Const $hPen_txt = _GDIPlus_PenCreate(0x801A237E, 1) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) _GDIPlus_GraphicsSetSmoothingMode($hGfx_text, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) _GDIPlus_GraphicsSetTextRenderingHint($hGfx_text, $GDIP_TextRenderingHintAntialias) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx_text, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsSetCompositingQuality($hGfx_text, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) Global $tLayout = _GDIPlus_RectFCreate() $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = -$iH * 0.05 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt) _GDIPlus_GraphicsDrawPath($hGfx_text, $hPath_text, $hPen_txt) Global Const $hEffect_blur_text = _GDIPlus_EffectCreateBlur(20) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, 0, $iW, $iH / 2) ;draw shadow of the text Global Const $hBrush_txt_shadow = _GDIPlus_BrushCreateSolid(0x40000000) _GDIPlus_GraphicsClear($hGfx_text, 0) _GDIPlus_PathReset($hPath_text) $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = 0 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt_shadow) Global Const $hEffect_blur_text_shadow = _GDIPlus_EffectCreateBlur(60) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, $iH * 0.55, $iW, $iH / 8) ;draw shadow Global Const $iW_shadow1 = $iSize_globe * 0.85, $iH_shadow1 = $iSize_globe * 0.1, $iW_shadow2 = $iSize_globe * 0.60, _ $iW_shadow_Img = $iW_shadow1 * 2, $iH_shadowImg = $iH_shadow1 * 4 Global Const $hImage_shadow = _GDIPlus_BitmapCreateFromScan0($iW_shadow_Img, $iH_shadowImg) Global Const $hGfx_shadow = _GDIPlus_ImageGetGraphicsContext($hImage_shadow) _GDIPlus_GraphicsSetSmoothingMode($hGfx_shadow, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) Global Const $hBrush_shadow = _GDIPlus_BrushCreateSolid(0x66000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow1) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow1, $iH_shadow1, $hBrush_shadow) _GDIPlus_BrushSetSolidColor($hBrush_shadow, 0xB3000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow2) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow2, $iH_shadow1, $hBrush_shadow) Global Const $hEffect_blur_shadow = _GDIPlus_EffectCreateBlur(32) _GDIPlus_BitmapApplyEffect($hImage_shadow, $hEffect_blur_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_shadow, ($iW - $iW_shadow_Img) / 2, $iH / 2 + $iH_shadow1 * 2.20, $iW_shadow_Img, $iH_shadowImg) ;draw globe Global Const $hPath_globe = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath_globe, ($iW - $iSize_globe) / 2, ($iH - $iSize_globe) / 2, $iSize_globe, $iSize_globe) Global Const $hLBrush_globe1 = _GDIPlus_LineBrushCreate($iW / 2, ($iH - $iSize_globe) / 2, $iW / 2, ($iH + $iSize_globe) / 2, 0, 0, 1) Global $aInterpolations[5][2] $aInterpolations[0][0] = 4 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFFEEEEEE $aInterpolations[2][1] = 0.10 $aInterpolations[3][0] = 0xFF2E86FB $aInterpolations[3][1] = 0.50 $aInterpolations[4][0] = 0xFF1A237E $aInterpolations[4][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe1, $aInterpolations) _GDIPlus_GraphicsFillPath($hGfx, $hPath_globe, $hLBrush_globe1) Global Const $iSize_globe2 = $iSize_globe * 0.85, $iSize_globe2_Img = $iSize_globe2 * 1.5 Global Const $hImage_globe2 = _GDIPlus_BitmapCreateFromScan0($iSize_globe2_Img, $iSize_globe2_Img) Global Const $hGfx_globe2 = _GDIPlus_ImageGetGraphicsContext($hImage_globe2) Global Const $hBrush_globe2 = _GDIPlus_BrushCreateSolid(0x7F000000) ;draw shadow and blur it Global Const $px = ($iSize_globe2_Img - $iSize_globe2) / 2, $py = ($iSize_globe2_Img - $iSize_globe2) / 2 _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py + ($iSize_globe - $iSize_globe2) * 0.25, $iSize_globe2, $iSize_globe2, $hBrush_globe2) Global Const $hEffect_blur_shadow2 = _GDIPlus_EffectCreateBlur(15) _GDIPlus_BitmapApplyEffect($hImage_globe2, $hEffect_blur_shadow2) ;draw 2nd smaller globe and blur it, too Global Const $hLBrush_globe2 = _GDIPlus_LineBrushCreate($iW / 2, $py, $iW / 2, $py + $iSize_globe2, 0, 0) Dim $aInterpolations[4][2] $aInterpolations[0][0] = 3 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFF2E86FB $aInterpolations[2][1] = 0.60 $aInterpolations[3][0] = 0xFF283593 $aInterpolations[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe2, $aInterpolations) _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py, $iSize_globe2, $iSize_globe2, $hLBrush_globe2) Global Const $hImage_globe2_blur = _Blur($hImage_globe2, $iSize_globe, $iSize_globe) ;windows gdi+ blur doesn't work properly _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_globe2_blur, ($iW - $iSize_globe2_Img) / 2 - ($iSize_globe - $iSize_globe2) / 8, ($iH - $iSize_globe2_Img) / 2, $iSize_globe2_Img, $iSize_globe2_Img) GUISetState() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iW, $iH) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Blue Orb v1.20.png") ;clean-up ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_EffectDispose($hEffect_blur_text) _GDIPlus_EffectDispose($hEffect_blur_text_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow2) _GDIPlus_PathDispose($hPath_text) _GDIPlus_PathDispose($hPath_globe) _GDIPlus_PenDispose($hPen_txt) _GDIPlus_BrushDispose($hBrush_txt) _GDIPlus_BrushDispose($hBrush_txt_shadow) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BrushDispose($hLBrush_globe1) _GDIPlus_BrushDispose($hLBrush_globe2) _GDIPlus_BrushDispose($hBrush_globe2) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_text) _GDIPlus_ImageDispose($hImage_shadow) _GDIPlus_ImageDispose($hImage_globe2) _GDIPlus_ImageDispose($hImage_globe2_blur) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_GraphicsDispose($hGfx_text) _GDIPlus_GraphicsDispose($hGfx_shadow) _GDIPlus_GraphicsDispose($hGfx_globe2) _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func _Blur($hBitmap, $iW, $iH, $fScale = 0.0525, $dx1 = 0, $dy1 = 0, $dx2 = 0, $dy2 = 0, $qual = 6) ; by eukalyptus Local $hBmpSmall = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxSmall, $GDIP_PIXELOFFSETMODE_HALF) Local $hBmpBig = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxBig, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur  
      I hope you like it.
       
      Feel free to post your examples here, too. 
    • By ripdad
      I have been working on audio graphical scripts these last several months.
      This is my last script on this subject for now. On to other projects.
      Credits: UEZ, Eukalyptus, BrettF, Prog@ndy, Authenticity and the AutoIt Community.
      Thanks to all that made these scripts possible!
      Please let me know if you have any problems with it.

      Download:
      LIVE Stereo Audio Waveform v2.zip
       

    • By ripdad
      I have been playing with this script off and on for about a month - trying to get the needles to look more realistic.
      It's best to use with an audio limiter on the source audio, or else you'll be tweaking the input levels on every song.
      It should work with any version of AutoIt, starting with 3.3.8.1.
      Please report any problems with it. Credits are in the script.

      Download: LIVE Analog Stereo Meter.au3
    • By cdeb
      How can you select the specific style of a font with multiple * .otf files?
      The font in question has several files:
       
      Thin Thin Italic Extra-Light Extra-Light Italic Light Light Italic Regular Regular Italic Medium Medium Italic Semi-Bold Semi-Bold Italic Bold Bold Italic Extra-Bold Extra-Bold Italic Black Black Italic But after doing several tests I can recall the font like this, without being able to specify the precise style:
      Local $hFamily = _GDIPlus_FontFamilyCreate("Poppins") ; Local $hFont = _GDIPlus_FontCreate($hFamily, 95, 1+2, 3) ; Example I cannot therefore select "Poppins Black Italic"
      but only "Poppins" 
      Thank you

×
×
  • Create New...