#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("TEST", 365, 98)
$PageControl1 = GUICtrlCreateTab(8, 8, 348, 82)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Input1 = GUICtrlCreateInput("", 24, 48, 89, 22)
GUICtrlSetLimit(-1, 8)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetData(-1, "")
$Combo1 = GUICtrlCreateCombo("3", 136, 48, 97, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "4|5")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Input2 = GUICtrlCreateInput("", 248, 48, 89, 22,$ES_READONLY)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo1
calc()
EndSwitch
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0xFFFF)
Local $hCtrl = $lParam
Switch $nID
Case $Input1
Switch $nNotifyCode
Case $EN_CHANGE
calc()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func calc()
$var10_1 = Dec(GUICtrlRead($Input1))
$var10_2 = Dec(GUICtrlRead($Combo1))
GUICtrlSetData($Input2, Tototo($var10_1 - $var10_2))
EndFunc
Func Tototo($int)
Dim $a[100], $jz = 16, $aa = "", $i = 0
While 1
If $int < $jz And $int = 0 Then ExitLoop
$i = $i + 1
$a[$i] = Mod($int, $jz)
$aa = re($a[$i]) & $aa
$int = Int($int / $jz)
WEnd
Return $aa
EndFunc
Func re($x)
Select
Case $x = 0
$y = "0"
Case $x = 1
$y = "1"
Case $x = 2
$y = "2"
Case $x = 3
$y = "3"
Case $x = 4
$y = "4"
Case $x = 5
$y = "5"
Case $x = 6
$y = "6"
Case $x = 7
$y = "7"
Case $x = 8
$y = "8"
Case $x = 9
$y = "9"
Case $x = 10
$y = "A"
Case $x = 11
$y = "B"
Case $x = 12
$y = "C"
Case $x = 13
$y = "D"
Case $x = 14
$y = "E"
Case $x = 15
$y = "F"
Case Else
$y = "(" & $x & ")"
EndSelect
Return $y
EndFunc