StyleGame

Online Tutorials

Va rog sa faceti cunoscut forumu. Cum puteti ajuta? De preferat la status pe yahoo messenger massuri etc. Va urez bafta in a ne ajuta cu respect echipa stylegame

    AutoIt - Din baza 10 in baza 2

    Distribuiţi
    avatar
    CYobY
    Administrator
    Administrator

    Mesaje : 197
    Data de inscriere : 04/10/2009
    Varsta : 24
    Localizare : VASLUI

    AutoIt - Din baza 10 in baza 2

    Mesaj Scris de CYobY la data de Lun Oct 26, 2009 11:29 pm

    In autoit:


    Cod:
     #include <GUIConstants>
        #Include <String>
      #NoTrayIcon

        $main = GUICreate("Convert to ... |3453 2", 300, 100)
      GUISetBkColor(0x000000)
        $input = GUICtrlCreateInput("", 8, 8, 280, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
        GUICtrlSetLimit(-1, 8)
        $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

    cyoby@stylegame.forumers.ro


    _________________
    RESPECT

      Acum este: Mar Oct 16, 2018 4:38 pm