.©ÝobÝ™

Online Gaming Tutorial


    AutoIt - Din baza 10 in baza 2

    Distribuiţi

    andrey

    Mesaje : 27
    Data de inscriere : 29/09/2009

    AutoIt - Din baza 10 in baza 2

    Mesaj  andrey la data de Mar Sept 29, 2009 5:53 pm

    In autoit:



    #include
    #Include
    #NoTrayIcon

    $main = GUICreate("Convert to ... |3453 2", 300, 100)
    GUISetBkColor(0x000000)
    $input = GUICtrlCreateInput("", 8, 8, 280, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
    GUICtrlSetLimit(-1, Cool
    $label = GUICtrlCreateLabel("Baza 2: ", 8, 36, 280, 21)
    $copyright = GUICtrlCreateLabel(Chr(169) & " " & "by Fodor Sergiu" & " " & "(Cyber)", 165, 86, 135, 14)
    $convert = GUICtrlCreateButton("!convert!", 20, 60, 80, 25, 0)
    $clear = GUICtrlCreateButton("!clear!", 108, 60, 80, 25, 0)
    $exit = GUICtrlCreateButton("!exit!", 194, 60, 80, 25, 0)
    GUISetState(@SW_SHOW)

    GUICtrlSetColor ($label, 0xFF0033)
    GUICtrlSetColor ($copyright, 0x666666)

    Func Dec2Bin($nr)
    While 1

    Dim $text
    $rest = MOD($nr, 2)
    $text = $text & $rest
    $nr = ($nr - $rest) / 2
    Select
    Case $nr = 0
    ExitLoop
    EndSelect

    WEnd
    $text = _StringReverse($text)
    Return $text
    EndFunc

    While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $convert
    $numar = GuiCtrlRead($input)
    $r = StringIsInt ( $numar )
    If $r = 1 Then
    $b2 = Dec2Bin($numar)
    GUICtrlSetData($label, "Baza 2 : "& $b2)
    EndIf
    Case $clear
    GUICtrlSetData($input, "")
    GUICtrlSetData($label, "Baza 2 : ")
    Case $exit
    ExitLoop
    EndSwitch
    WEnd

    andrey for cyobyy.forumz.ro

      Acum este: Mar Dec 18, 2018 11:16 pm