This example is about a double edit issue with two edit box using FASM.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | format PE GUI 4.0 entry start ; include files include 'win32a.inc' ; section data section '.data' data readable writeable ; my buffer 76h my_buffer rb 76h ;section code section '.code' code readable executable ; start start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0 invoke ExitProcess,0 ; start dialog window proc DialogProc hwnddlg,msg,wparam,lparam push ebx esi edi cmp [msg],WM_INITDIALOG je .wminitdialog cmp [msg],WM_COMMAND je .wmcommand cmp [msg],WM_CLOSE je .wmclose xor eax,eax jmp .finish .wminitdialog: jmp .double_edit_code .wmcommand: cmp [wparam],BN_CLICKED shl 16 + IDCANCEL je .wmclose cmp [wparam],EN_CHANGE shl 16 + ID_001 je .double_edit_code jmp .next_code ; this will add the text from first editbox to next one .double_edit_code: invoke GetDlgItemText,[hwnddlg],ID_001,my_buffer,255 invoke lstrlen,my_buffer invoke SetDlgItemText,[hwnddlg],ID_002,my_buffer jmp .next_code ; the close step .wmclose: invoke EndDialog,[hwnddlg],0 ; you can add next code here .next_code: mov eax,1 .finish: pop edi esi ebx ret endp ; section idata section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' include 'api\kernel32.inc' include 'api\user32.inc' ; section resource data section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\ 37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration ID_001 = 1 ID_002 = 2 dialog demonstration,'Double edit',0,0,183,76,WS_CAPTION+WS_SYSMENU+DS_CENTER+DS_SYSMODAL dialogitem 'EDIT','Example', ID_001,6,7,176,14,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL dialogitem 'EDIT','',ID_002,6,19,176,14,WS_VISIBLE+WS_BORDER+ES_AUTOHSCROLL+ES_READONLY dialogitem 'BUTTON','Exit',IDCANCEL,6,37,50,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON enddialog |