Jump to content
Sign in to follow this  
UEZ

Hilfiker / MobaTime Swiss Railway Clock build 2018-03-01

Recommended Posts

qwert

That's pretty amazing.  Thanks for posting.  It's mesmerizing to watch ... the smooth movement ... the shadow effects ... the slight bounce effect on the minute hand.  Excellent!

But I'm curious: do the real railway clocks have the momentary pause at :00?

Share this post


Link to post
Share on other sites
UEZ

@qwert I was never in Switzerland but  this shows the clock

 

Edited by UEZ
  • Like 1

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
qwert

Indeed! ... and there's more to the story:

Quote

"The design of Swiss Railway Clock is very interesting."

Another YouTube link led me to this.  (... where you have to SHOW MORE)

Maybe it's widely known ... but I never knew of such a system.

Thanks.

Edited by qwert

Share this post


Link to post
Share on other sites
UEZ

Made some small modifications and added brushed steel texture for the clock frame . Thanks to Eukalyptus for the _CreateBrushedAluminum() function.

For those who are interested, have a look to post #1.

 

Btw, if you are running lower AutoIt version than  3.3.14.3, it will crash in x64 mode due to the bug in _GDIPlus_EffectCreate()!

Edited by UEZ

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
Efo74

When you see certain works, you look at them fascinated ... and you feel incapable and amateurs. Congratulations simply fantastic.


:rolleyes:

Share this post


Link to post
Share on other sites
marcgforce

Nice work, an impressive demonstration of the capabilities of autoit,  i've just implemented a popup style windows (without borders) witch can be moved and a context menu with exit and about, if someone knows how we can cancel the white square of the popup (transparency does'nt work) it would be interresting for exemple...

;the Hilfiker / MobaTime Swiss Railway Clock
;coded by UEZ build 2018-02-16
;thanks to Eukalyptus for the _CreateBrushedAluminum() function!

#pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico")
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /pe /rm
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3"
#AutoIt3Wrapper_UseX64=n

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3> ;---------------------------added by margforce----------------------

_GDIPlus_Startup()
Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit
Global Const $iW = 500, $iH = $iW, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Swiss Railway Clock v1.1"
Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30
Global $fMin_next, $hDC, $hCanvas, $hBitmap_Clock, $fDiameter, $hDC_backbuffer, $fShadowAngle
Global Const $SC_DRAGMOVE = 0xF012
Global Const $margin = 12; distance from edge of window where dragging is possible---------------------------added by margforce----------------------

AutoItSetOption("GUIOnEventMode", 1)

GDIPlus_SwissRailwayClock()

AutoItSetOption("GUIOnEventMode", 0)
_GDIPlus_Shutdown()

;---------------------------added by margforce----------------------
GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN")

func _context_menu()
     Local $idContextmenu = GUICtrlCreateContextMenu()
     Local $idNewsubmenu_exit = GUICtrlCreateMenuItem("Exit", $idContextmenu)
     Local $idNewsubmenu_info = GUICtrlCreateMenuItem("A propos", $idContextmenu)
     GUICtrlSetOnEvent($idNewsubmenu_exit,"_Exit_about")
     GUICtrlSetOnEvent($idNewsubmenu_info,"_Apropos")
EndFunc 
Func _move_clock()
      _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc
;---------------------------added by margforce----------------------
Func GDIPlus_SwissRailwayClock()
    $bExit = False
    $hGUI = GUICreate($sTitle, $iW, $iH, -1, -1, $WS_POPUP)
    GUICtrlSetResizing(-1,$GUI_DOCKWIDTH)
    GUISetBkColor(0xFFFFFF, $hGUI)
    ;_WinAPI_SetLayeredWindowAttributes( $hGUI, 0xFFFFFF, 255)
    GUISetState(@SW_SHOW, $hGUI)
;~  GUISetCursor(16, 1)

    ;create canvas elements
                $hDC = _WinAPI_GetDC($hGUI)
    Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
                $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
    Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap)
                $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)

    Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _
                $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _
                $hFormat_FPS = _GDIPlus_StringFormatCreate(), _
                $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _
                $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _
                $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16)
    $fDiameter = $iW
                $hBitmap_Clock = GenerateClockBg($fDiameter)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About")
    GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_move_clock");---------------------------added by margforce----------------------
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_context_menu");---------------------------added by margforce----------------------

    $fMin_next = @MIN


    GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
    DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iTimer, "int", 0)

    Do
        If $bExit Then ExitLoop
    Until Not Sleep(100)

    ;release resources
    GUIRegisterMsg($WM_TIMER, "")
    _GDIPlus_FontDispose($hFont_FPS)
    _GDIPlus_FontFamilyDispose($hFamily_FPS)
    _GDIPlus_StringFormatDispose($hFormat_FPS)
    _GDIPlus_BrushDispose($hBrush_Clr)
    _GDIPlus_BrushDispose($hBrush_FPS)
    _GDIPlus_GraphicsDispose($hCanvas)
    _WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
    _WinAPI_DeleteDC($hDC_backbuffer)
    _WinAPI_DeleteObject($hHBitmap)
    _WinAPI_ReleaseDC($hGUI, $hDC)
    GUIDelete($hGUI)
EndFunc   ;==>GDIPlus_SwissRailwayClock

Func Draw()
    _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter, $fDiameter)
    UpdateClock($hCanvas, $fDiameter)
    _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY)
EndFunc

Func _Exit_About()
       $bExit = True
EndFunc   ;==>_Exit_About

Func UpdateClock($hGfx, $fDiameter)
    Local Const $fRadius = $fDiameter / 2, $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x18A8A8A8)
    Local $fSec, $fMin, $fHr
    Static $bBounce = 0, $f = 0, $fAmplitude = 3
    Local $m1 = $fDiameter * 0.015
    ;hour
    $fHr = 30 * (@HOUR + @MIN / 60)
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fHr)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    Local Const $hBrush = _GDIPlus_BrushCreateSolid(0xFF101010)
    Local $iWidth1 = $fDiameter * 0.0375, _
          $iHeight1 = $fDiameter / 2.5, _
          $iWidth12 = $iWidth1 / 2, _
          $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
                           "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _
                           "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _
                           "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _
                           "float", $fRadius - $iWidth12, _
                           "float", $fPosY, _
                           "float", $iWidth1, "float", $iHeight1)
    _GDIPlus_GraphicsResetTransform($hGfx)

    ;min
    If $fMin_next <> @MIN Then $bBounce = 1
    Switch $bBounce
        Case 1
            $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude
            If $fAmplitude = 0 Then
                $fMin_next = @MIN
                $f = 0
                $fAmplitude = 3
                $bBounce = 0
            Else
                $fAmplitude -= 0.5
                $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude
                $f += 1
            EndIf
        Case Else
            $fMin = (6 * @MIN)
    EndSwitch
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fMin)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    $iWidth1 = $fDiameter * 0.03
    $iHeight1 = $fRadius
    $iWidth12 = $iWidth1 / 2
    $fPosY = $fDiameter * 0.1
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
                           "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _
                           "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _
                           "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _
                           "float", $fRadius - $iWidth12, _
                           "float", $fPosY, _
                           "float", $iWidth1, "float", $iHeight1)
    _GDIPlus_GraphicsResetTransform($hGfx)

    ;sec
    $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000)
    If $fSec >= 360 Then $fSec = 0
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fSec)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    $fPosY = $fDiameter * 0.27
    $fPosY2 = $fDiameter * 0.19
    $iWidth1 = $fDiameter * 0.0095
    $iHeight1 = $fRadius * 1.3 - $fPosY
    $iWidth12 = $iWidth1 / 2
    $iWidth2 = $fDiameter * 0.083333
    $iWidth22 = $iWidth2 / 2


    ;shadow seconds
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
                           "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _
                           "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _
                           "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667)
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _
                           "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _
                           "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _
                           "float", $iWidth2, "float", $iWidth2)
    ;seconds
    _GDIPlus_BrushSetSolidColor($hBrush, 0xF8C01010)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _
                           "float", $fRadius - $iWidth12, _
                           "float", $fPosY, _
                           "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush, _
                           "float", $fRadius - $iWidth22, _
                           "float", $fPosY2, _
                           "float", $iWidth2, "float", $iWidth2)
    _GDIPlus_GraphicsResetTransform($hGfx)

    Local Const $hPen = _GDIPlus_PenCreate(0xFFA02020)
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush, _
                           "float", $fRadius - $iWidth1, _
                           "float", $fRadius - $iWidth1, _
                           "float", 2 * $iWidth1, "float", 2 * $iWidth1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen, _
                           "float", $fRadius - $iWidth1, _
                           "float", $fRadius - $iWidth1, _
                           "float", 2 * $iWidth1, "float", 2 * $iWidth1)

    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrush_Shadow)
EndFunc

Func GenerateClockBg($fDiameter)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter, $fDiameter), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _
                $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000), $hPen = _GDIPlus_PenCreate(0xFF000000), _
                $hEffect = _GDIPlus_EffectCreateBlur(10.5, 0), $fBorderSize = $fDiameter * 0.03333
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4)
    _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4)
    _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xA0000000)
    _GDIPlus_PenSetWidth($hPen, $fBorderSize)
    Local Const $fSize = $fDiameter * 0.95 - $fBorderSize / 2, $fRadius = $fDiameter / 2
    Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01
    $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg
    If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180
    If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180
    _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen)
    _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)

    _GDIPlus_PenSetColor($hPen, 0xF0000000)
    Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle)
    Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture)
    DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture)
    _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen)

    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, -6)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)

    Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _
          $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2
    For $i = 0 to 59
        _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
        _GDIPlus_GraphicsRotateTransform($hGfx, 6)
        _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
        Switch Mod($i, 5)
            Case 0
                _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush)
            Case Else
                _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush)
        EndSwitch
    Next
    _GDIPlus_GraphicsResetTransform($hGfx)

    Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon())
    Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.08, $fDiameter * 0.08)
    Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled)
    _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1])
    _GDIPlus_ImageDispose($hBitmap_Logo)
    _GDIPlus_ImageDispose($hBitmap_Logo_Scaled)
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
;~  _GDIPlus_BrushSetSolidColor($hBrush, 0xFF400000)
    _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush)

    _GDIPlus_ImageDispose($hBitmap_Texture)
    _GDIPlus_BrushDispose($hTexture)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_EffectDispose($hEffect)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfx)
    Return $hBitmap
EndFunc

Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus!
    $iBlurDist = Ceiling($iBlurDist)
    $iBlurDist += 1 - Mod($iBlurDist, 2)

    Local $iOverSize = 0
    For $i = 1 To $iBlurDist Step 2
        $iOverSize += $i + $i + 1
    Next

    Local $iWO = $iW + $iOverSize

    ;=========================================
    ; Add Noise
    ;=========================================

    Local $iNoiseSize = 40

    Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize)
    Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise)

    Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB)
    Local $iStride = DllStructGetData($tData, "Stride")
    Local $iWidth = DllStructGetData($tData, "Width")
    Local $iHeight = DllStructGetData($tData, "Height")
    Local $pScan0 = DllStructGetData($tData, "Scan0")
    Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0)

    Local $iAmp
    For $row = 0 To $iHeight - 1
        For $col = 0 To $iWidth - 1
            $iAmp = Random(0, 0xFF, 1)
            DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1)
        Next
    Next

    _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData)


    ;=========================================
    ; Create Full NoiseBitmap
    ;=========================================

    Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH)
    Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    Local $iXOff, $iYOff, $iSizeX, $iSizeY
    For $y = 0 To $iH Step $iNoiseSize / 2
        For $x = 0 To $iWO Step $iNoiseSize / 2
            $iXOff = Random(0, $iNoiseSize / 2, 1)
            $iYOff = Random(0, $iNoiseSize / 2, 1)
            $iSizeX = $iNoiseSize - $iXOff
            $iSizeY = $iNoiseSize - $iYOff
            _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY)
        Next
    Next

    _GDIPlus_GraphicsDispose($hGfx_Noise)
    _GDIPlus_BitmapDispose($hBmp_Noise)



    ;=========================================
    ; MotionBlur
    ;=========================================
    Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH)
    Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
    DllStructSetData($tColorMatrix, 1, 1, 1)
    DllStructSetData($tColorMatrix, 2, 1, 2)
    DllStructSetData($tColorMatrix, 3, 1, 3)
    DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4)
    DllStructSetData($tColorMatrix, 5, 1, 5)

    Local $hImgAttrib = _GDIPlus_ImageAttributesCreate()
    DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0)
    For $i = 1 To $iBlurDist Step 2
        DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _
                               "float", $i, "float", 0, "float", $iWO, "float", $iH, _
                               "float", 0, "float", 0, "float", $iWO, "float", $iH, _
                               "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0)
        If $i >= $iBlurDist Then
            DllStructSetData($tColorMatrix, 1, $fRed, 1)
            DllStructSetData($tColorMatrix, 2, $fGreen, 2)
            DllStructSetData($tColorMatrix, 3, $fBlue, 3)
            DllStructSetData($tColorMatrix, 4, 1, 4)
            DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0)
        EndIf
        DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _
                               "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _
                               "float", 0, "float", 0, "float", $iWO, "float", $iH, _
                               "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0)
    Next
    _GDIPlus_ImageAttributesDispose($hImgAttrib)

    _GDIPlus_GraphicsDispose($hGfx_Full2)
    _GDIPlus_BitmapDispose($hBmp_Full2)
    _GDIPlus_GraphicsDispose($hGfx_Full)

    ;=========================================
    ; Add Light
    ;=========================================

    Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0)
    _GDIPlus_BitmapDispose($hBmp_Full)

    Local $tPointF1 = DllStructCreate("float; float;")
    Local $tPointF2 = DllStructCreate("float; float;")
    DllStructSetData($tPointF2, 2, $iH * $fLightScale)

    $aResult =   DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False)
    Local $hBrush = $aResult[6]

    _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma)
    _GDIPlus_LineBrushSetGammaCorrection($hBrush)
    DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0)

    _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush)

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfx_Alu)

    Return $hBmp_Alu
EndFunc   ;==>_CreateBrushedAluminum


;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02

Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $Au3_Icon
   
    $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAv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GlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg=='
    Local $bString = _WinAPI_Base64Decode($Au3_Icon)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_Au3_Icon

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode
;---------------------------added by margforce----------------------
Func GetMousePosType()
    Local $cp = GUIGetCursorInfo()
    Local $wp = WinGetPos($hGUI)
    Local $side = 0
    Local $TopBot = 0
    Local $curs
    If $cp[0] < $margin Then $side = 1
    If $cp[0] > $wp[2] - $margin Then $side = 2
    If $cp[1] < $margin Then $TopBot = 3
    If $cp[1] > $wp[3] - $margin Then $TopBot = 6

    Return $side + $TopBot

EndFunc ;==>GetMousePosType
func _Apropos()
    Msgbox(64,"The Hilfiker / MobaTime Swiss Railway Clock", "Coded by UEZ build 2018-02-16" & @CRLF & "Thanks to Eukalyptus for the _CreateBrushedAluminum() function! " & @CRLF & "Popup style & context menu by Marcgforce")

EndFunc

Func WM_LBUTTONDOWN($hWnd, $iMsg, $StartWIndowPosaram, $lParam)

      Local $drag = GetMousePosType()
    If $drag > 0 Then
        MSGBOX(0,'',"test")
        DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $WM_SYSCOMMAND, "int", 0xF000 + $drag, "int", 0)
    EndIf

EndFunc ;==>WM_LBUTTONDOWN
;---------------------------added by margforce----------------------

 

Edited by marcgforce

Share this post


Link to post
Share on other sites
UEZ

Here we go (widget style clock):

;the Hilfiker / MobaTime Swiss Railway Clock
;coded by UEZ build 2018-03-01
;thanks to Eukalyptus for the _CreateBrushedAluminum() function!

#Pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico")
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /pe /rm
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3"
#AutoIt3Wrapper_UseX64=n

Break(0)

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>

ProcessSetPriority(@AutoItPID, $PROCESS_LOW)

_GDIPlus_Startup()
Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit
Global Const $iW = 200, $iH = $iW, $sTitle = "GDI+ Swiss Railway Clock v1.15"
Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $ULW_ALPHA = 2, $SC_DRAGMOVE = 0xF012, $fDeltaShadow = 20
Global $hBitmap, $hHBitmap, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $fShadowAngle, $fMin_next, _
        $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3, $fSize, $hOld

Global $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION)
$tSize.X = $iW
$tSize.Y = $iH
$tBlend.Alpha = 255
$tBlend.Format = 1

Global Const $hScrDC = _WinAPI_GetDC($hGUI), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)

AutoItSetOption("GUIOnEventMode", 1)

GDIPlus_SwissRailwayClock()

AutoItSetOption("GUIOnEventMode", 0)
_GDIPlus_Shutdown()


Func GDIPlus_SwissRailwayClock()
    $bExit = False
    $hGUI = GUICreate($sTitle, $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
    GUISetBkColor(0xFFFFFF, $hGUI)
    GUISetState(@SW_SHOW, $hGUI)

    ;create canvas elements
    $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW + $fDeltaShadow, $iH + $fDeltaShadow)
    $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x14A0A0A0)
    $hPen_Update = _GDIPlus_PenCreate(0xFFA02020)
    $hBrush_Update = _GDIPlus_BrushCreateSolid(0)
    _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)

    $fDiameter = $fDiameter < 128 ? 128 : $fDiameter > 1024 ? 1024 : $fDiameter
    $hBitmap_Clock = GenerateClockBg($fDiameter)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About")

    $fMin_next = @MIN

    GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")
    GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
    Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0]
    Do
        If $bExit Then ExitLoop
    Until Not Sleep(100)

    ;release resources
    GUIRegisterMsg($WM_TIMER, "")
    DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID)
    GUIRegisterMsg($WM_LBUTTONDOWN, "")
    _GDIPlus_PenDispose($hPen_Update)
    _GDIPlus_BrushDispose($hBrush_Shadow)
    _GDIPlus_BrushDispose($hBrush_Update)
    _GDIPlus_GraphicsDispose($hCanvas)
    _GDIPlus_ImageDispose($hCanvas)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_DeleteDC($hMemDC)
    GUIDelete($hGUI)
EndFunc   ;==>GDIPlus_SwissRailwayClock

Func Draw($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    _GDIPlus_GraphicsClear($hCanvas, 0x00000000)
    _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow)
    UpdateClock($hCanvas, $fDiameter)

    $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hHBitmap)
EndFunc   ;==>Draw

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    Switch $hWnd
        Case $hGUI
            _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
    EndSwitch
EndFunc   ;==>_WM_LBUTTONDOWN

Func _Exit_About()
    $bExit = True
EndFunc   ;==>_Exit_About

Func UpdateClock($hGfx, $fDiameter)
    Static $bBounce = 0, $f = 0
    Local $m1 = $fDiameter * 0.015

    ;hour
    $fHr = 30 * (@HOUR + @MIN / 60)
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fHr)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    Local $iWidth1 = $fDiameter * 0.0375, _
          $iHeight1 = $fDiameter / 2.5, _
          $iWidth12 = $iWidth1 / 2, _
          $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2


    _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010)

    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
            "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _
            "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _
            "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _
            "float", $fRadius - $iWidth12, _
            "float", $fPosY, _
            "float", $iWidth1, "float", $iHeight1)
    _GDIPlus_GraphicsResetTransform($hGfx)

    ;min
    If $fMin_next <> @MIN Then $bBounce = 1
    Switch $bBounce
        Case 1
            $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude
            If $fAmplitude = 0 Then
                $fMin_next = @MIN
                $f = 0
                $fAmplitude = 3
                $bBounce = 0
            Else
                $fAmplitude -= 0.5
                $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude
                $f += 1
            EndIf
        Case Else
            $fMin = (6 * @MIN)
    EndSwitch
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fMin)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    $iWidth1 = $fDiameter * 0.03
    $iHeight1 = $fRadius
    $iWidth12 = $iWidth1 / 2
    $fPosY = $fDiameter * 0.1
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
            "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _
            "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _
            "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _
            "float", $fRadius - $iWidth12, _
            "float", $fPosY, _
            "float", $iWidth1, "float", $iHeight1)
    _GDIPlus_GraphicsResetTransform($hGfx)

    ;sec
    $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000)
    If $fSec >= 360 Then $fSec = 0
    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, $fSec)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
    $fPosY = $fDiameter * 0.27
    $fPosY2 = $fDiameter * 0.19
    $iWidth1 = $fDiameter * 0.0095
    $iHeight1 = $fRadius * 1.3 - $fPosY
    $iWidth12 = $iWidth1 / 2
    $iWidth2 = $fDiameter * 0.083333
    $iWidth22 = $iWidth2 / 2


    ;shadow seconds
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _
            "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _
            "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _
            "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667)
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _
            "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _
            "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _
            "float", $iWidth2, "float", $iWidth2)
    ;seconds
    _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010)
    DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _
            "float", $fRadius - $iWidth12, _
            "float", $fPosY, _
            "float", $iWidth1, "float", $iHeight1)
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _
            "float", $fRadius - $iWidth22, _
            "float", $fPosY2, _
            "float", $iWidth2, "float", $iWidth2)
    _GDIPlus_GraphicsResetTransform($hGfx)

    ;button in the center
    DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _
            "float", $fRadius - $iWidth1, _
            "float", $fRadius - $iWidth1, _
            "float", 2 * $iWidth1, "float", 2 * $iWidth1)
    DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _
            "float", $fRadius - $iWidth1, _
            "float", $fRadius - $iWidth1, _
            "float", 2 * $iWidth1, "float", 2 * $iWidth1)
EndFunc   ;==>UpdateClock

Func GenerateClockBg($fDiameter, $iBGColor = 0xF8FFFFFF)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _
                $hBrush = _GDIPlus_BrushCreateSolid($iBGColor), $fBorderSize = $fDiameter * 0.03333, _
                $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 1), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4)
    _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4)

    Local Const $fSize = $fDiameter * 0.942 - $fBorderSize / 2

    Local Const $hLBrush = _GDIPlus_LineBrushCreate($fBorderSize, $fBorderSize, $fSize, $fSize, 0xFCFFFFFF, 0xF8FAFAFA, 3)
    _GDIPlus_LineBrushSetSigmaBlend($hLBrush, 0.6)
    _GDIPlus_LineBrushSetGammaCorrection($hLBrush)
    _GDIPlus_GraphicsFillEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hLBrush)

;~     Local Const $hPath = _GDIPlus_PathCreate()
;~     _GDIPlus_PathAddEllipse($hPath, $fBorderSize, $fBorderSize, $fSize, $fSize)
;~     Local $hLBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
;~     _GDIPlus_PathBrushSetCenterColor($hLBrush, 0xF8F0F0FF)
;~     _GDIPlus_PathBrushSetCenterPoint($hLBrush, $fSize * 0.70, $fSize * 0.70)
;~     _GDIPlus_PathBrushSetSurroundColor($hLBrush, 0xFBFFFFFF)
;~     _GDIPlus_PathBrushSetGammaCorrection($hLBrush, True)
;~     _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hLBrush)
;~  _GDIPlus_PathDispose($hPath)


    Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01
    $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg
    If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180
    If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180
    _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen)
    _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)

    _GDIPlus_BrushSetSolidColor($hBrush)
    _GDIPlus_PenSetColor($hPen, 0xF0000000)
    Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle)
    Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture)
    DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture)
    _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen)

    _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
    _GDIPlus_GraphicsRotateTransform($hGfx, -6)
    _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)

    Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _
            $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2
    For $i = 0 To 59
        _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius)
        _GDIPlus_GraphicsRotateTransform($hGfx, 6)
        _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius)
        Switch Mod($i, 5)
            Case 0
                _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush)
            Case Else
                _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush)
        EndSwitch
    Next
    _GDIPlus_GraphicsResetTransform($hGfx)

    Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon())
    Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.095, $fDiameter * 0.095)
    Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled)
    _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1])
    _GDIPlus_ImageDispose($hBitmap_Logo)
    _GDIPlus_ImageDispose($hBitmap_Logo_Scaled)

    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush)

    _GDIPlus_ImageDispose($hBitmap_Texture)
    _GDIPlus_BrushDispose($hTexture)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_EffectDispose($hEffect)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hLBrush)
    _GDIPlus_GraphicsDispose($hGfx)
    Return $hBitmap
EndFunc   ;==>GenerateClockBg

Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus!
    $iBlurDist = Ceiling($iBlurDist)
    $iBlurDist += 1 - Mod($iBlurDist, 2)

    Local $iOverSize = 0
    For $i = 1 To $iBlurDist Step 2
        $iOverSize += $i + $i + 1
    Next

    Local $iWO = $iW + $iOverSize

    ;=========================================
    ; Add Noise
    ;=========================================

    Local $iNoiseSize = 40

    Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize)
    Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise)

    Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB)
    Local $iStride = DllStructGetData($tData, "Stride")
    Local $iWidth = DllStructGetData($tData, "Width")
    Local $iHeight = DllStructGetData($tData, "Height")
    Local $pScan0 = DllStructGetData($tData, "Scan0")
    Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0)

    Local $iAmp
    For $row = 0 To $iHeight - 1
        For $col = 0 To $iWidth - 1
            $iAmp = Random(0, 0xFF, 1)
            DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1)
        Next
    Next

    _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData)


    ;=========================================
    ; Create Full NoiseBitmap
    ;=========================================

    Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH)
    Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    Local $iXOff, $iYOff, $iSizeX, $iSizeY
    For $y = 0 To $iH Step $iNoiseSize / 2
        For $x = 0 To $iWO Step $iNoiseSize / 2
            $iXOff = Random(0, $iNoiseSize / 2, 1)
            $iYOff = Random(0, $iNoiseSize / 2, 1)
            $iSizeX = $iNoiseSize - $iXOff
            $iSizeY = $iNoiseSize - $iYOff
            _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY)
        Next
    Next

    _GDIPlus_GraphicsDispose($hGfx_Noise)
    _GDIPlus_BitmapDispose($hBmp_Noise)



    ;=========================================
    ; MotionBlur
    ;=========================================
    Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH)
    Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
    DllStructSetData($tColorMatrix, 1, 1, 1)
    DllStructSetData($tColorMatrix, 2, 1, 2)
    DllStructSetData($tColorMatrix, 3, 1, 3)
    DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4)
    DllStructSetData($tColorMatrix, 5, 1, 5)

    Local $hImgAttrib = _GDIPlus_ImageAttributesCreate()
    DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0)
    For $i = 1 To $iBlurDist Step 2
        DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _
                "float", $i, "float", 0, "float", $iWO, "float", $iH, _
                "float", 0, "float", 0, "float", $iWO, "float", $iH, _
                "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0)
        If $i >= $iBlurDist Then
            DllStructSetData($tColorMatrix, 1, $fRed, 1)
            DllStructSetData($tColorMatrix, 2, $fGreen, 2)
            DllStructSetData($tColorMatrix, 3, $fBlue, 3)
            DllStructSetData($tColorMatrix, 4, 1, 4)
            DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0)
        EndIf
        DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _
                "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _
                "float", 0, "float", 0, "float", $iWO, "float", $iH, _
                "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0)
    Next
    _GDIPlus_ImageAttributesDispose($hImgAttrib)

    _GDIPlus_GraphicsDispose($hGfx_Full2)
    _GDIPlus_BitmapDispose($hBmp_Full2)
    _GDIPlus_GraphicsDispose($hGfx_Full)

    ;=========================================
    ; Add Light
    ;=========================================

    Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4)
    _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3)

    _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0)
    _GDIPlus_BitmapDispose($hBmp_Full)

    Local $tPointF1 = DllStructCreate("float; float;")
    Local $tPointF2 = DllStructCreate("float; float;")
    DllStructSetData($tPointF2, 2, $iH * $fLightScale)

    $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False)
    Local $hBrush = $aResult[6]

    _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma)
    _GDIPlus_LineBrushSetGammaCorrection($hBrush)
    DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0)

    _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush)

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGfx_Alu)

    Return $hBmp_Alu
EndFunc   ;==>_CreateBrushedAluminum


;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02

Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $Au3_Icon
    $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8S0ERAwS1DFeEo3m6owzmUySc+Zc+15VXZd9+dZyp6ro4pDTORlGIfnDn703TW/+//X9v/Wt3i3PPfccP85w/GhBgLqkS23ixhpRfau6bgItIPpRN5Ag0Xl88jYrxu/E+KA492E0vJd44d245BKQ/H8bkAe80wMOEE5HA5c8SpQ822yv/ubW9vnfffyxR3+vs7r6YcS9HewZnP9ZXPwE0Py/NuCBJj65iERvQPybcNFP4JKzuPgq+CeR6GnwV3FJB4juM+mSNj55Ehe97/LFC5947PL2ey5tb755daW1+fiVc295+qk3fuTShfPPPnb10d+J60sfI6o9B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t2LIQgca1h651l1tt1iqKQ42EIceTdzn7v+b39/U+L889j4VtT8Q+HfOUbL3zq7Ob6J800VlWbfR3W3b193z06/EPEfwoXP+ai+BdWO+0PFEXIq/3wBjAwVGazd29U0q+YFYGghjFF7KDmApVGGQ2PbWOtI1WzIC8Vg1Bp94fdwau37+78KdhzaHgFLbpA4OEgwmzNmPR8RCZDVuj2elG3e/S5NIn/KMuLQyR+Ucv80zs7ey+BbVVinIjUVpcXL816O82613Zd'
    $Au3_Icon &= 'gMTEOQcCqIo4RlkpVRu2Uk129w8DneWxeO9v3N79l+pCnuVfxvRfCdkLwIDXAPnSf33tU+fOnvktEXNFUUi1af3e3sHXNRQfA746P0+p4eJlxJ9D5I3OR09fPnfml6vD5m6rubCdRC4FAUDNdDTOe977ej2NUjOjdzxgNBwVh73h3/ooGXrvk2w8esE0PI9Nus11oM9rhHzhi//xtpXV1c+msW92uz0ODw6fA/1t4Es8GDEu3kDcFRclP6Ua2nGcbMdxvI4hzossLdQvAeRFeS/Liv00jddUtej2Bs9pKP4TDYdgOdBD3C4h2wcCrx1M/8kn7j2Y/gxwM03Tz2RZdouHo4GLOuA2EGliNBGpY3qM8+uAoeV3MBvjXBucTJ5dfIcwGgIGlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg=='
    Local $bString = _WinAPI_Base64Decode($Au3_Icon)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_Au3_Icon

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

 

Edited by UEZ
small optimizations
  • Like 1

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
qwert

@UEZ: a masterful result!  Purposeful ... and pleasing to behold.  Thanks for posting it. 

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  

  • Similar Content

    • Pricehacker
      By Pricehacker
      Hello,
      I am making a program where the button is an image that "changes" when specific conditions are fullfilled. Problem is that these images have different dimensions and when a smaller picture is displayed over a bigger one both will be seen, therefore i would like the images to be hidden, invincible or, alternatively, deleted.
      I have tried using _GDIPlus_GraphicsClear() with no luck
      However that might just be me not using it right as im quite new to autoit
      Here is the code if you want to test run it:
      Thanks to everyone helping!
    • UEZ
      By UEZ
      Here another example to mark the desktop to get the marked region for capturing. This example is not perfect and not very fast (room for improvements).
      ;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 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 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  
      Just press the lmb and move your mouse. When lmb is released you can adjust the size of the window by dragging the white rectangle to any direction. Rmb will move the marked area.
      Press ESC to get the coordinates of the marked region.
      If you have any improvements, please post it here.
       
      Tested on Win10 x64 only.
       
    • JoeWagner
      By JoeWagner
      I'm building a tool to remotely monitor CPU usage on my server.
      I have a working tool but I have a few issues I'd like some help with.
      1. The app uses more system memory on a continual growth rate...  It eventually starts displaying strange artifacts and the background flashes between black and and white behind the GDI+ elements.  I determined this couldn't be left to run for any amount of time (greater than 15-20 minutes) - Very frustrating.
      I suspect it's because it keeps drawing new GDI+ elements to replace the previous cycle ... the $bar1 = "" is enough to remove the image and allow the new image to be drawn there, but I don't have a handle for the original GDI+ element to throw it away... Not sure where they go...
      I also suspect there could be a better way to do what I'm doing here, but from a problem solving perspective - this is what I came up with - I will accept suggestions for how better to accomplish the same / better or acceptable results  
      I will not however accept corrections on grammar, punctuation or commenting - I didn't comment this as I was going, I use the variables that make sense to me (or as they were when I lifted them from the scraps I found on the internet) and you can never be too careful with punctuation.
      2. I have a WMI query that is used to remotely pull the CPU data from the server - if I supply the wrong credentials the app crashes... I tried to make it show an error and go back to allow me to try again ... doesn't work. Any help with catching that error and preventing the crash would be super helpful. (works great if the credentials are correct; domain or local)
       
      The whole thing below... 
      #include <Date.au3> #include <WindowsConstants.au3> #include <GuiConstantsEX.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3> Global $__g_hGDIPDll Global $graph[21] Global $timer, $timeout = 500 Global $hFlag = 0 $timer = TimerInit() $main = GUICreate("CPU Graph", 125, 220, Default, Default, Default, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $bar1 = GUICtrlCreatePic("", 10, 10, 5, 100) $bar2 = GUICtrlCreatePic("", 15, 10, 5, 100) $bar3 = GUICtrlCreatePic("", 20, 10, 5, 100) $bar4 = GUICtrlCreatePic("", 25, 10, 5, 100) $bar5 = GUICtrlCreatePic("", 30, 10, 5, 100) $bar6 = GUICtrlCreatePic("", 35, 10, 5, 100) $bar7 = GUICtrlCreatePic("", 40, 10, 5, 100) $bar8 = GUICtrlCreatePic("", 45, 10, 5, 100) $bar9 = GUICtrlCreatePic("", 50, 10, 5, 100) $bar10 = GUICtrlCreatePic("", 55, 10, 5, 100) $bar11 = GUICtrlCreatePic("", 60, 10, 5, 100) $bar12 = GUICtrlCreatePic("", 65, 10, 5, 100) $bar13 = GUICtrlCreatePic("", 70, 10, 5, 100) $bar14 = GUICtrlCreatePic("", 75, 10, 5, 100) $bar15 = GUICtrlCreatePic("", 80, 10, 5, 100) $bar16 = GUICtrlCreatePic("", 85, 10, 5, 100) $bar17 = GUICtrlCreatePic("", 90, 10, 5, 100) $bar18 = GUICtrlCreatePic("", 95, 10, 5, 100) $bar19 = GUICtrlCreatePic("", 100, 10, 5, 100) $bar20 = GUICtrlCreatePic("", 105, 10, 5, 100) $host = GUICtrlCreateInput("Host", 10, 115, 100, 20, $ES_AUTOHSCROLL) $user = GUICtrlCreateInput("User", 10, 140, 100, 20, $ES_AUTOHSCROLL) GUICtrlSetFont(-1, 8, 400) $pass = GUICtrlCreateInput("Pass", 10, 165, 100, 20, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlSetFont(-1, 8, 400) $start = GUICtrlCreateButton("Start", 10, 190, 100, 20, $BS_DEFPUSHBUTTON) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $start Then ConnectWMI() If $hFlag = 1 Then If TimerDiff($timer) > $timeout Then UpdateGraph() EndIf WEnd Func ConnectWMI() Global $hostname = GUICtrlRead($host) If Ping($hostname, 2000) = 0 Then Msgbox(0, "Error", "Unable to reach specified host") Return 0 EndIf Local $usr = GUICtrlRead($user) Local $pwd = GUICtrlRead($pass) Global $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") Global $objWMIService = $objSWbemLocator.ConnectServer($hostname, "root\cimv2", $usr, $pwd) If @error Then Msgbox(0, "Error", "Unable to connect to the Host with the supplied credentials") Return 0 EndIf $hFlag = 1 UpdateGraph() EndFunc Func UpdateGraph() $usage = _Processor_Usage() For $i = 1 to 19 $graph[$i] = $graph[$i+1] Next $graph[20] = $usage GUICtrlSetImage($bar1, "") CreateBar($bar1, $graph[1]) GUICtrlSetImage($bar2, "") CreateBar($bar2, $graph[2]) GUICtrlSetImage($bar3, "") CreateBar($bar3, $graph[3]) GUICtrlSetImage($bar4, "") CreateBar($bar4, $graph[4]) GUICtrlSetImage($bar5, "") CreateBar($bar5, $graph[5]) GUICtrlSetImage($bar6, "") CreateBar($bar6, $graph[6]) GUICtrlSetImage($bar7, "") CreateBar($bar7, $graph[7]) GUICtrlSetImage($bar8, "") CreateBar($bar8, $graph[8]) GUICtrlSetImage($bar9, "") CreateBar($bar9, $graph[9]) GUICtrlSetImage($bar10, "") CreateBar($bar10, $graph[10]) GUICtrlSetImage($bar11, "") CreateBar($bar11, $graph[11]) GUICtrlSetImage($bar12, "") CreateBar($bar12, $graph[12]) GUICtrlSetImage($bar13, "") CreateBar($bar13, $graph[13]) GUICtrlSetImage($bar14, "") CreateBar($bar14, $graph[14]) GUICtrlSetImage($bar15, "") CreateBar($bar15, $graph[15]) GUICtrlSetImage($bar16, "") CreateBar($bar16, $graph[16]) GUICtrlSetImage($bar17, "") CreateBar($bar17, $graph[17]) GUICtrlSetImage($bar18, "") CreateBar($bar18, $graph[18]) GUICtrlSetImage($bar19, "") CreateBar($bar19, $graph[19]) GUICtrlSetImage($bar20, "") CreateBar($bar20, $graph[20]) $timer = TimerInit() EndFunc Func _Processor_Usage() Dim $Col_Items = $objWMIService.ExecQuery('SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor', 'WQL') Local $Obj_Item For $Obj_Item In $Col_Items Return $Obj_Item.PercentProcessorTime Next EndFunc Func CreateBar($target, $value) Local $width=5, $height=2 _GDIPlus_Startup() $hImage = DLL_BitmapCreate($width, $height*50) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2) ;100 If $value > 98 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF00F2F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $width, $height, $hBrush) EndIf ;98 If $value > 96 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF0182C") _GDIPlus_GraphicsFillRect($hGraphic, 0, 2, $width, $height, $hBrush) EndIf ;96 If $value > 94 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF0212A") _GDIPlus_GraphicsFillRect($hGraphic, 0, 4, $width, $height, $hBrush) EndIf ;94 If $value > 92 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF02B28") _GDIPlus_GraphicsFillRect($hGraphic, 0, 6, $width, $height, $hBrush) EndIf ;92 If $value > 90 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF03426") _GDIPlus_GraphicsFillRect($hGraphic, 0, 8, $width, $height, $hBrush) EndIf ;90 If $value > 88 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF03E24") _GDIPlus_GraphicsFillRect($hGraphic, 0, 10, $width, $height, $hBrush) EndIf ;88 If $value > 86 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF04722") _GDIPlus_GraphicsFillRect($hGraphic, 0, 12, $width, $height, $hBrush) EndIf ;86 If $value > 84 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF05120") _GDIPlus_GraphicsFillRect($hGraphic, 0, 14, $width, $height, $hBrush) EndIf ;84 If $value > 82 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF05A1D") _GDIPlus_GraphicsFillRect($hGraphic, 0, 16, $width, $height, $hBrush) EndIf ;82 If $value > 80 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF0641B") _GDIPlus_GraphicsFillRect($hGraphic, 0, 18, $width, $height, $hBrush) EndIf ;80 If $value > 78 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF06D19") _GDIPlus_GraphicsFillRect($hGraphic, 0, 20, $width, $height, $hBrush) EndIf ;78 If $value > 76 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF07717") _GDIPlus_GraphicsFillRect($hGraphic, 0, 22, $width, $height, $hBrush) EndIf ;76 If $value > 74 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF08015") _GDIPlus_GraphicsFillRect($hGraphic, 0, 24, $width, $height, $hBrush) EndIf ;74 If $value > 72 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF08A13") _GDIPlus_GraphicsFillRect($hGraphic, 0, 26, $width, $height, $hBrush) EndIf ;72 If $value > 70 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF09311") _GDIPlus_GraphicsFillRect($hGraphic, 0, 28, $width, $height, $hBrush) EndIf ;70 If $value > 68 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF09311") _GDIPlus_GraphicsFillRect($hGraphic, 0, 30, $width, $height, $hBrush) EndIf ;68 If $value > 66 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFF09D0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 32, $width, $height, $hBrush) EndIf ;66 If $value > 64 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFECA20F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 34, $width, $height, $hBrush) EndIf ;64 If $value > 62 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFE8A80F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 36, $width, $height, $hBrush) EndIf ;62 If $value > 60 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFE5AD0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 38, $width, $height, $hBrush) EndIf ;60 If $value > 58 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFE1B30F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 40, $width, $height, $hBrush) EndIf ;58 If $value > 56 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFDEB80F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 42, $width, $height, $hBrush) EndIf ;56 If $value > 54 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFDABE0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 44, $width, $height, $hBrush) EndIf ;54 If $value > 52 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFD6C30F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 46, $width, $height, $hBrush) EndIf ;52 If $value > 50 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFCFCE0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 48, $width, $height, $hBrush) EndIf ;50 If $value > 48 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFCCD40F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 50, $width, $height, $hBrush) EndIf ;48 If $value > 46 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFC8D90F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 52, $width, $height, $hBrush) EndIf ;46 If $value > 44 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFC4DF0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 54, $width, $height, $hBrush) EndIf ;44 If $value > 42 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFC1E40F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 56, $width, $height, $hBrush) EndIf ;42 If $value > 40 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFBDEA0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 58, $width, $height, $hBrush) EndIf ;40 If $value > 38 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFBAF00F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 60, $width, $height, $hBrush) EndIf ;38 If $value > 36 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFBAF00F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 62, $width, $height, $hBrush) EndIf ;36 If $value > 34 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFADEF0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 64, $width, $height, $hBrush) EndIf ;34 If $value > 32 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFFA1EE0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 66, $width, $height, $hBrush) EndIf ;32 If $value > 30 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF94ED0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 68, $width, $height, $hBrush) EndIf ;30 If $value > 28 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF88ED0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 70, $width, $height, $hBrush) EndIf ;28 If $value > 26 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF7CEC0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 72, $width, $height, $hBrush) EndIf ;26 If $value > 24 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF6FEB0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 74, $width, $height, $hBrush) EndIf ;24 If $value > 22 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF63EA0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 76, $width, $height, $hBrush) EndIf ;22 If $value > 20 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF56EA0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 78, $width, $height, $hBrush) EndIf ;20 If $value > 18 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF56EA0F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 80, $width, $height, $hBrush) EndIf ;18 If $value > 16 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF4AE90F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 82, $width, $height, $hBrush) EndIf ;16 If $value > 14 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF3EE80F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 84, $width, $height, $hBrush) EndIf ;14 If $value > 12 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF31E70F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 86, $width, $height, $hBrush) EndIf ;12 If $value > 10 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF25E70F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 88, $width, $height, $hBrush) EndIf ;10 If $value > 8 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF18E60F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 90, $width, $height, $hBrush) EndIf ;8 If $value > 6 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF0CE50F") _GDIPlus_GraphicsFillRect($hGraphic, 0, 92, $width, $height, $hBrush) EndIf ;6 If $value > 4 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF00E510") _GDIPlus_GraphicsFillRect($hGraphic, 0, 94, $width, $height, $hBrush) EndIf ;4 If $value > 2 Then $hBrush = _GDIPlus_BrushCreateSolid("0xFF00E509") _GDIPlus_GraphicsFillRect($hGraphic, 0, 96, $width, $height, $hBrush) EndIf ;2 $hBrush = _GDIPlus_BrushCreateSolid("0xFF00E509") _GDIPlus_GraphicsFillRect($hGraphic, 0, 98, $width, $height, $hBrush) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSendMsg($target, 0x172, 0, $hBitmap) _WinAPI_DeleteObject($hBitmap) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>_CreateBar Func DLL_BitmapCreate($width, $height) Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $width, "int", $height, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Return $aResult[6] EndFunc ;==>DLL_BitmapCreate  
       
    • UEZ
      By UEZ
      AutoIt Windows Screenshooter
      Key Features:
      takes easily a screenshot from any visible window capture any region of the desktop incl. freehand capturing capture GUI controls and GUI menus separately capture a marked area every x seconds for a duration of y seconds create a GIF animation from saved frames (Vista or higher os required) capture to AVI file (without audio!) takes a screenshot from web sites (available only on Win7+ os and when Aero is enabled) put images to clipboard to paste to other applications easily color picker save image in different formats and also to PDF! add timestamp to saved images simple image editing options: greyscale, b&w, invert, rotate +-90° send image to printer and default email client preview of captured screens incl. zoom option multi monitor support display pixel color under mouse ruler basic image editor (paint, highlight, ellipse, rectangle, text and some graphic FX) watermark captured image no 3rd party tools or DLLs used - pure AutoIt! fully portable - no installation is needed multi language feature (Eng, Ger, Tur, Fra and Rus only) To do:
      capture content of scrollable window/control capture cascaded menus Due to DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) limitation some windows cannot be captured properly (GDI+, ProgDVB, etc.) but can take screenshots of hidden windows. One workaround is to use full screen capturing (F11/F12) or "Grab Screen" function! Or try double click with rmb on listview items (beta).
      Download source code (6295 downloads previously):  AutoIt Windows Screenshooter v1.81 Build 2018-08-12.7z (version 3.3.12.0+ needed!)
      You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name!
      Download compiled Exe only: 4shared / Media Fire / Softpedia (1.54mb)
      Distributing copies of the program in compiled format (exe) must be free of any fee!
      -----> click here to Donate!  
       
      (Current donators: 1. Cuong N.) 
      It is designed for Win7+ operating systems with AERO enabled! E.g. on WinXP machines some functions are not working properly and might crash the application!
      AV scanners may have a negative impact the execution of compiled exe and might report any malware. I guarantee that there is no malicious code in the source code / exe!!! 
      Main GUI:

       
       
      About Intro:

       
       
      Basic Image Editor:

       
       
      Watermark:

       
       
      Click link for an enhanced version of Watermark Image.
      Credits:
      main code by UEZ additional code (alphabetical order) by Authenticity, AutoItObject Team, Eemuli, Eukalyptus, funkey, _Kurt, martin, monoceres, ProgAndy, taietel, trancexx, Ward, wolf9228 and Yashied! mesale0077 for turkish translation wakillon for french translation AZJIO for russian translation Keys:
      Main GUI:
      User your mouse to scroll preview window or
      Numpad 8: Scroll preview window up
      Numpad 2: Scroll preview window down
      Numpad 4: Scroll preview window left
      Numpad 6: Scroll preview window right
      Numpad +: zoom in preview window or mousewheel down
      Numpad -: zoom out preview window or mousewheel up
      F1: capture again on last position
      F5: refresh Windows Name list
      PRINTSCREEN: take screenshot from whole screen
      ALT+PRINTSCR: take a screenshot from active window
      F10: Undo made changes with Image Editing function
      F11: take screenshot from whole screen incl mouse cursor
      F12: take screenshot from whole screen
      Ctrl+Alt+F9 start "Grab Screen" mode
      Ctrl+Alt+F12: take a screenshot from active window using alternative screenshot functionality (beta)!
      Ctrl+r: call ruler
      Ctrl+s: save current displayed image
      Ctrl+x: exit program
      ctrl+w: call web grab input field (availabe only when Aero is enabled)
      Ctrl+i: call image editor
      Ctrl+m: call watermark editor
      Ctrl+z: undo
      Only available on Vista+ os: double click with rmb on list items to use alternative screenshot functionality (beta)!
      When 'Grab Screen' is clicked you can hold down the ctrl key to switch to 'grab controls' mode. Control under mouse will be framed red.
      ctrl + shift will take the screenshot of appropriate control. To capture GUI menues you can press rmb which simulates the lmb. When a menu is opened press shift additionaly to capture it.
      Press and hold only the shift key to capture any region on the desktop using freehand capturing - release it so capture marked regions!
      Or just mark resizeable area which you want to grab. Press CTRL key to grab marked area or right mouse button to capture the marked area every x seconds for a duration of y seconds.
      When saving the image just enter the extension you whish to use (*.jpg;*.png;*.bmp;*.gif;*.tif;*.pdf). Big thanks to taietel for his PDF UDF!
      Image Editor:
      s: save
      c: copy
      n: send
      h: highlighter
      p: pen
      r: rectangle
      e: ellipse
      a: arrow
      o: color
      t: text
      g: text config
      Ctrl+z: undo
      Watermark editor:
      Ctrl+z: undo
       
      To start the app minimized just call it "Windows Screenshooter.exe /min"
      Maybe it is useful for someone...
      Any kind of comment is welcome.
      Br,
      UEZ
      Change log:
       
×