• Hab mal wieder was kleines gebastelt. Vllt gefällt es ja dem einen oder anderen.

    mfg funkey

    Spoiler anzeigen
    [autoit]

    Local $hGui = GUICreate("GuiCtrlLCDNumber by funkey", 800)

    [/autoit] [autoit][/autoit] [autoit]

    Local $LCDNum1 = _GuiCtrlLCDNumber_Create(10, 10, 20, 30, 10, 0xff0000, 0xafafa0)
    _GuiCtrlLCDNumber_SetValue($LCDNum1, "0123456789")

    [/autoit] [autoit][/autoit] [autoit]

    Local $LCDNum2 = _GuiCtrlLCDNumber_Create(10, 70, 20, 40, 6)

    [/autoit] [autoit][/autoit] [autoit]

    Local $LCDNum3 = _GuiCtrlLCDNumber_Create(10, 120, 120, 240, 6, 0xffa0, 0x0)

    [/autoit] [autoit][/autoit] [autoit]

    _GuiCtrlLCDNumber_SetValue($LCDNum3, "345678")
    If @error Then MsgBox(16, "Error " & @error, "The value you wanted to set is invalid!", 0, $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    AdlibRegister("_Update", 1000)

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Sleep(20)
    Until GUIGetMsg() = -3

    [/autoit] [autoit][/autoit] [autoit]

    Func _Update()
    _GuiCtrlLCDNumber_SetValue($LCDNum2, StringFormat("%s%s%s", @hour, @min, @SEC))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GuiCtrlLCDNumber_Create($x, $y, $w = 20, $h = 40, $iCount = 1, $iCol = 0, $iBkCol = Default)
    Local $aRet[3] = [GUICtrlCreateDummy()]
    Local $iThick = $w / 8
    For $i = 0 To $iCount - 1
    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetBkColor(-1, $iBkCol)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $iThick, $iThick, $iThick/2, -30, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $w - $iThick, $iThick, $iThick/2, 150, 60) ;$GUI_GR_PIE

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $h/2) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $h/2) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $iThick, $h/2, $iThick/2, -30, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $w - $iThick, $h/2, $iThick/2, 150, 60) ;$GUI_GR_PIE

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, 1.5*$iThick, $h-$iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $w - 1.5*$iThick, $h-$iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $iThick, $h-$iThick, $iThick/2, -30, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $w - $iThick, $h-$iThick, $iThick/2, 150, 60) ;$GUI_GR_PIE

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, $iThick/1.5, 2*$iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $iThick/1.5, $h/2 - $iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $iThick/1.5, 1.5*$iThick, $iThick/2, -120, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h/2 - $iThick/2, $iThick/2, 60, 60) ;$GUI_GR_PIE

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, $w - $iThick/1.5, 2*$iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $w - $iThick/1.5, $h/2 - $iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, 1.5*$iThick, $iThick/2, -120, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h/2 - $iThick/2, $iThick/2, 60, 60) ;$GUI_GR_PIE

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, $iThick/1.5, $h/2 + $iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $iThick/1.5, $h - 2*$iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h/2 + $iThick/2, $iThick/2, -120, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $iThick/1.5, $h - 1.5*$iThick, $iThick/2, 60, 60) ;$GUI_GR_PIE

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGraphic($x + $i * $w, $y, $w, $h, 0)
    GUICtrlSetGraphic(-1, 24, $iThick) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 6, $w - $iThick/1.5, $h/2 + $iThick) ;$GUI_GR_MOVE
    GUICtrlSetGraphic(-1, 2, $w - $iThick/1.5, $h - 2*$iThick) ;$GUI_GR_LINE
    GUICtrlSetGraphic(-1, 24, $iThick/2) ;$GUI_GR_PENSIZE
    GUICtrlSetGraphic(-1, 8, $iCol) ;$GUI_GR_COLOR
    GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h/2 + $iThick/2, $iThick/2, -120, 60) ;$GUI_GR_PIE
    GUICtrlSetGraphic(-1, 14, $w - $iThick/1.5, $h - 1.5*$iThick, $iThick/2, 60, 60) ;$GUI_GR_PIE
    Next
    $aRet[1] = GUICtrlCreateDummy()
    Return $aRet
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GuiCtrlLCDNumber_SetValue(ByRef $hLCDNumber, $sValue)
    If Not StringIsInt($sValue) Then Return SetError(1)
    Local $iDigits = ($hLCDNumber[1] - $hLCDNumber[0] -1) / 8
    If StringLen($sValue) > $iDigits Then Return SetError(2)
    $sValue = StringFormat("%0" & $iDigits & "s", $sValue)
    Local $aValue = StringSplit($sValue, "", 2)
    For $i = 0 To $iDigits - 1
    If StringMid($hLCDNumber[2], $i + 1, 1) = $aValue[$i] Then ContinueLoop
    Switch $aValue[$i]
    Case 0
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 1
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 2
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 32)
    Case 3
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 4
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 5
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 6
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 7
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 8
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    Case 9
    GUICtrlSetState($hLCDNumber[0] + 2 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 3 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 4 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 5 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 6 + $i*8, 16)
    GUICtrlSetState($hLCDNumber[0] + 7 + $i*8, 32)
    GUICtrlSetState($hLCDNumber[0] + 8 + $i*8, 16)
    EndSwitch
    Next
    $hLCDNumber[2] = $sValue
    EndFunc

    [/autoit]
    • Offizieller Beitrag

    Coole Sache. Gefällt mir deine UDF. :thumbup:
    Flacker gelegentlich aber damit kann man leben.

  • Hallo funkey,

    ja ich weis länger als 84 Tage kommen bestimmt gleich wieder Leichensshänderrufe.

    Aber ich finde das Skript gut und hoffe das du daraus eine UDF machst.

    Coole Sache. Gefällt mir deine UDF. :thumbup:


    Raupi anscheinend auch.

    Auf den Thread bin ich gestossen, da ich nach einer func suche, die den Namen eines Controls anhand der ControlID zurückgibt, dachte dass ich soeine func schon einmal von dir gesehen hätte. Naja, Pech gehabt mit den üblichen "Verdächtigen" weitersuchen,

    mfg autoBert

  • Meinst du sowas, autoBert?

    [autoit]

    #include <WinAPI.au3>

    [/autoit][autoit][/autoit][autoit]

    Run("notepad.exe")
    $hWnd = WinWait("[CLASS:Notepad]")

    [/autoit][autoit][/autoit][autoit]

    $ID = _GetClassNameNNByID($hWnd, 15)

    [/autoit][autoit][/autoit][autoit]

    ConsoleWrite($ID & @cr)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    Func _GetClassNameNNByID($hWnd, $ID)
    Local $hCtrl = ControlGetHandle($hWnd, "", $ID)
    Local $sCtrl = _WinAPI_GetClassName($hCtrl)
    If @error Then Return SetError(1)
    For $i = 1 To 1000
    If ControlGetHandle($hWnd, "", $sCtrl & $i) = $hCtrl Then
    Return $sCtrl & $i
    EndIf
    Next
    EndFunc

    [/autoit]