hi
i have a problem to send a return to a editbox
if maximal char in a line then return the line
.elseif eax == EN_CHANGE
mov eax, wParam
.if ax==1002
invoke GetDlgItemText, hWnd, 1002, ADDR sz1, 1024
invoke lstrlen, ADDR sz1
mov edi,eax
invoke SetDlgItemInt, hWnd, 1003, edi, FALSE
mov ecx,edi
cmp ecx,5 ;maximal char pro line
jnz @out
;invoke MessageBox,hWnd,0,0,MB_OK
;<----------------------------------------
@out:
.endif
functions this with a EM _ message ??
invoke SendMessage,hEdit,WM_COMMAND,VK_RETURN,NULL ??
ragdog
[attachment deleted by admin]
my first problem is solved
i have the next ::) ::)
do you have an idea how it could work when paste a text in the editbox wich is bigger than 61 signs
that there will be an auto line-break change at 61 signs
thanks in forward
ragdog
[attachment deleted by admin]
Quote from: ragdog on November 29, 2007, 05:20:02 PM
do you have an idea how it could work when paste a text in the editbox wich is bigger than 61 signs
that there will be an auto line-break change at 61 signs
Consider what you are asking here. You want something to happen when text changes in an edit control. So how do you handle edit control messages? Look at this WndProc I used (a long time ago) in a simple text-to-binary converter:
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
mov eax,uMsg
.if eax==WM_INITDIALOG
m2m hWnd,hWin
.elseif eax==WM_COMMAND
mov eax,wParam
and eax,0FFFFh
.if eax==1001 ; input edit control message?
.if bClear==0 ; if this is the first change,
invoke SetDlgItemText,hWin,1001,addr bClear
mov bClear,1 ; clear input box (and do not clear it again)
.endif
.if bModify==0 ; if text is new,
invoke ASCII2BIN ; convert ascii to binary
.endif
.endif
.if eax==1002 ; if output edit control message
.if bModify==0 ; if text is new
invoke BIN2ASCII ; convert binary back into ascii
.endif
.endif
.elseif eax==WM_CLOSE
invoke DestroyWindow,hWin
.elseif uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
.endif
mov bModify,0 ; reset changed flag
xor eax,eax
ret
WndProc endp
Here bModify was just a global byte, set to 1, inside each procedure to indicate that text had been converted. The first time you click into the ASCII edit control, it is cleared. Then anything you type there is converted into binary and displayed in the second edit control, and vice-versa.
thanks for you reply!
i cannot found any lib or function ASCII2BIN and BIN2ASCII
can you post this ?
ragdog
I thought someone might ask. ASCII2BIN/BIN2ASCII are private functions, not part of the MASM32 package. (There is a dword to binary routine in the m32lib folder however.) These routines should probably not be posted because they are a common homework assignment.