senolc_eht
Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
|
halo everybody,
i wanna ask "how to make multiline on edit box..?"
include 'win32ax.inc'
.data
_title db 'Win32 program template',0
_class db 'FASMWIN32',0
mainhwnd dd ?
hinstance dd ?
client RECT
_edit db 'EdiT',0
edithwnd dd ?
msg MSG
wc WNDCLASS
editfont dd ?
.code
start:
invoke GetModuleHandle,0
mov [hinstance],eax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.hIcon],eax
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],eax
mov [wc.style],0
mov [wc.lpfnWndProc],WindowProc
mov [wc.cbClsExtra],0
mov [wc.cbWndExtra],0
mov eax,[hinstance]
mov [wc.hInstance],eax
mov [wc.hbrBackground],COLOR_BTNFACE+1
mov [wc.lpszMenuName],0
mov [wc.lpszClassName],_class
invoke RegisterClass,wc
invoke CreateDialogParam,[hinstance],1,0,0,0
cmp eax,0
jne @f
push [hinstance]
call ShowLastError
jmp end_loop
@@:
mov [mainhwnd],eax
invoke ShowWindow,[mainhwnd],SW_SHOWNORMAL
invoke UpdateWindow,[mainhwnd]
msgloop:
invoke GetMessage,msg,0,0,0
cmp eax,0
je end_loop
invoke IsDialogMessage,[mainhwnd],msg
cmp eax,0
jne msgloop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msgloop
end_loop:
invoke ExitProcess,0
proc WindowProc, hwnd,wmsg,wparam,lparam
push ebx esi edi
cmp [wmsg],WM_CREATE
je wmcreate
cmp [wmsg],WM_DESTROY
je wmdestroy
defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp finish
wmcreate:
invoke GetClientRect,[hwnd],client
invoke CreateWindowEx,WS_EX_CLIENTEDGE,_edit,0,WS_VISIBLE+WS_CHILD+WS_HSCROLL+WS_VSCROLL+ES_AUTOHSCROLL+ES_AUTOVSCROLL+ES_MULTILINE,[client.left],[client.top],[client.right],[client.bottom],[hwnd],0,[hinstance],NULL ;pick up from minipad example
or eax,eax
jz failed
mov [edithwnd],eax
invoke CreateFont,16,0,0,0,0,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_RASTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH+FF_DONTCARE,NULL
or eax,eax
jz failed
mov [editfont],eax
invoke SendMessage,[edithwnd],WM_SETFONT,eax,FALSE
xor eax,eax
jmp finish
failed:
or eax,-1
jmp finish
jmp finish
wmdestroy:
invoke PostQuitMessage,0
xor eax,eax
finish:
pop edi esi ebx
return
endp
proc ShowErrorMessage, hWnd,dwError
.lpBuffer dd ?
enter
lea eax,[.lpBuffer]
invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
invoke MessageBox,[hWnd],[.lpBuffer],NULL,MB_ICONERROR+MB_OK
invoke LocalFree,[.lpBuffer]
return
endp
; VOID ShowLastError(HWND hWnd);
proc ShowLastError, hWnd
invoke GetLastError
stdcall ShowErrorMessage,[hWnd],eax
return
endp
.end start
section '.rsrc' resource data readable
directory RT_DIALOG,dialogs
resource dialogs,\
1,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration
dialog demonstration,'FASMWIN32','Examples',70,70,190,175,DS_CENTER + WS_CAPTION + WS_OVERLAPPED + DS_3DLOOK + WS_SYSMENU
enddialog
resource.inc, i pick from Kevin Zheng corection (thanks for the correction) "adding class on dialog resource macro"
macro dialog label,class,title,x,y,cx,cy,style,menu,exstyle,fontname,fontsize
{ local data,size,items
label dd RVA data,size,0,0
data dd style or DS_SETFONT,exstyle +0
dw items,x,y,cx,cy
if menu+0 <> 0
dw 0FFFFh
end if
if ~class eq
du menu+0,class,0,title,0
else
du menu+0,0,title,0
end if
if fontname eq
du 8,'MS Sans Serif',0
else
du fontsize+0,fontname,0
end if
align 4
dialog_size equ size = $ - data
dialog_items equ items = dialog_items_counter
dialog_items_counter = 0
}
my code is running but why the editbox not do multiline..?
thanks for the help
my regard,
Senolc_Eht
_________________ sorry if i always asking.....
|