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