The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: voidguide on June 03, 2006, 09:58:00 PM

Title: A squence of characters in EditBox
Post by: voidguide on June 03, 2006, 09:58:00 PM
Hi, everybody. I have an editbox which has initial value set to 0 (it's a simple calc I'm trying to write). How do I implement the following analog written in C#:

.
.
.
tbDigitField.Text += btnOne.Text;
tmp = Convert.ToDouble(tbDigitField.Text);
.
.
.
tbDigitField.Text += btnTwo.Text;
tmp = Convert.ToDouble(tbDigitField.Text);

Actually, I have these lines:
.
.
.
.elseif eax == IDC_BTN_TWO
                invoke   lstrcpy, addr szBuffer, offset szBtnOne       ; szBtnOne db '1',0    
                invoke    SendMessage, hDgtFld, WM_SETTEXT, 0, addr szBuffer         
.elseif eax == IDC_BTN_TWO
                invoke   lstrcpy, addr szBuffer, offset szBtnTwo      ; szBtnTwo db '2',0
                invoke   SendMessage, hDgtFld, WM_SETTEXT, 0, addr szBuffer
.
.
.
I am at a loss... How to save those numbers in szBuffer? Say, when 1 is pressed EditBox shows 1, then again 1 - EditBox has 11, then 2 - 112 and so on?

TIA.
Title: Re: A squence of characters in EditBox
Post by: dsouza123 on June 04, 2006, 03:45:07 AM
The following API function will get the text from an editbox
with a maximum of 511 chars and place it in a char buffer.

You will have to parse the text for numeric chars and once cleaned up
invoke one of the text to binary number conversion routines.

.data
  szBuffer db 512 dup (0)

.code
  invoke GetDlgItemText,hWnd,IDC_EDIT,ADDR szBuffer,511