GuiParas equ "adding two numbers", w560, h84, icon Lens
include \masm32\MasmBasic\Res\MbGui.asm
GuiControl MyEdit, "edit", h=0+28, "1234+1000h", font -16:FW_SEMIBOLD
GuiControl MyStatusBar, "statusbar", "Change the number to see the sum in dec, hex and binary format", font -14:FW_MEDIUM
Event Command
.if nCode==EN_CHANGE
mov ecx, Win$(hMyEdit) ; get the text from the edit control
push Val(ecx) ; save first integer to stack
and edx, 127 ; get #chars used
lea ecx, [ecx+edx+1] ; skip the plus sign
void Val(ecx)
If_ edx==-127 Then xor eax, eax ; second value was invalid or empty
pop ecx ; pop first value
add ecx, eax ; sum
SetWin$ hMyStatusBar=Str$("Sum is %i = ", ecx)+Hex$(ecx)+"h = "+Bin$(ecx)+"b"
.endif
GuiEnd