News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Dumb edit box question of the day.

Started by Lightman, June 02, 2010, 08:32:06 AM

Previous topic - Next topic

Lightman

Hi Everybody,

Is there a way to add multiple lines to an edit box?  I can create a multiline edit box and assign text to it.  But when I add more text it overwrites the current text.


...
sLoadMsg   db   'Loading Picture One...', 10, 13, 0
sSaveMsg   db   'Saving Picture One...', 10, 13, 0
...

...
invoke   SendMessage, hEdit, WM_SETTEXT, 0, addr sLoadMsg
invoke   SendMessage, hEdit, WM_SETTEXT, 0, addr sSaveMsg
...


Is there another API call for this?

Regards,

L.

jj2007

invoke SendMessage, hEdit, EM_SETSEL, -1, 0 ; select end of current text
invoke SendMessage, hEdit, EM_REPLACESEL, 0, chr$("appended")

qWord

for appending lines:
MLEditAddLineA proc uses ebx esi hWnd:HANDLE,psz:ptr BYTE

.repeat
mov esi,rv(SendMessage,hWnd,WM_GETTEXTLENGTH,0,0)
add esi,len(psz)
lea esi,[esi+3]
.break .if !ASM(mov ebx,alloc(esi))
.if rv(SendMessage,hWnd,WM_GETTEXT,esi,ebx)
invoke szCatStr,ebx,chr$(13,10)
.endif
invoke szCatStr,ebx,psz
invoke SendMessage,hWnd,WM_SETTEXT,0,ebx
free(ebx)
mov eax,esi
.until
ret

MLEditAddLineA endp
FPU in a trice: SmplMath
It's that simple!

Lightman

Thanks guys.... That works Ok for me...