What i want to do is get the value from 2 different edit box and add them together for a total.
;Get Value 0
invoke GetDlgItemInt,hWin,IDC_EDT1,addr Value0,0
;Get Value 1
invoke GetDlgItemInt,hWin,IDC_EDT2,addr Value1,0
;Add them together
mov eax,Value0
add eax,Value1
mov Total,eax
invoke SetDlgItemInt,hWin,IDC_STC1,Total,0
This doesnt work correctly. what am i doing wrong?
Value0 and Value1 only get filled with true or false, the returned number is in EAX.
invoke GetDlgItemInt,hWin,IDC_EDT1,0,0
mov Value0,eax
invoke GetDlgItemInt,hWin,IDC_EDT2,0,0
add eax,Value0
invoke SetDlgItemInt,hWin,IDC_STC1,eax,0
If you need to check for a valid return, use
invoke GetDlgItemInt,hWin,IDC_EDT1,addr IsCorrect,0
cmp IsCorrect,FALSE
jz not_a_number
edit:changed 'rax' to 'eax' ::)
Read the documentation carefully:
QuoteHWND hDlg, // handle to dialog box
int nIDDlgItem, // control identifier
BOOL *lpTranslated, // points to variable to receive success/failure indicator
BOOL bSigned // specifies whether value is signed or unsigned
What you need is
Quoteinvoke GetDlgItemInt, hWin, IDC_EDT1, addr MyBool, 0
mov Value0, eax
etc
You only need the true/false variable if you want to know whether the conversion succeeded/failed.
Quote
lpTranslated
[out] Pointer to a variable that receives a success or failure value (TRUE indicates success, FALSE indicates failure).
If this parameter is NULL, the function returns no information about success or failure.