Hi,
kein Plan, wofür man das brauchen könnte (vermutlich zum "lernen" :D)
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate("Bit Anzeiger", 226, 83, 192, 114)
$Button1 = GUICtrlCreateButton("0", 16, 16, 19, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("0", 40, 16, 19, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("0", 64, 16, 19, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("0", 88, 16, 19, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("•", 112, 32, 8, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button5 = GUICtrlCreateButton("0", 120, 16, 19, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("0", 144, 16, 19, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("0", 168, 16, 19, 25, $WS_GROUP)
$Button8 = GUICtrlCreateButton("0", 192, 16, 19, 25, $WS_GROUP)
$out = GUICtrlCreateInput("", 16, 48, 65, 21)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
GUICtrlSetData($Button1, BitXOR(GUICtrlRead($Button1),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button2
GUICtrlSetData($Button2, BitXOR(GUICtrlRead($Button2),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button3
GUICtrlSetData($Button3, BitXOR(GUICtrlRead($Button3),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button4
GUICtrlSetData($Button4, BitXOR(GUICtrlRead($Button4),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button5
GUICtrlSetData($Button5, BitXOR(GUICtrlRead($Button5),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button6
GUICtrlSetData($Button6, BitXOR(GUICtrlRead($Button6),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button7
GUICtrlSetData($Button7, BitXOR(GUICtrlRead($Button7),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $Button8
GUICtrlSetData($Button8, BitXOR(GUICtrlRead($Button8),1))
GUICtrlSetData($out, bin2dec(GUICtrlRead($Button1) & GUICtrlRead($Button2) & GUICtrlRead($Button3) & GUICtrlRead($Button4) & _
GUICtrlRead($Button5) & GUICtrlRead($Button6) & GUICtrlRead($Button7) & GUICtrlRead($Button8)))
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func bin2dec($strBin)
Local $Return
Local $lngResult
Local $intIndex
If StringRegExp($strBin,'[0-1]') then
$lngResult = 0
For $intIndex = StringLen($strBin) to 1 step -1
$strDigit = StringMid($strBin, $intIndex, 1)
Select
case $strDigit="0"
case $strDigit="1"
$lngResult = $lngResult + (2 ^ (StringLen($strBin)-$intIndex))
case else
$lngResult = 0
$intIndex = 0
EndSelect
Next
$Return = $lngResult
Return $Return
EndIf
EndFunc
Beschreibung: Selbsterklärend!
Gruß
x0r