Yep i want my edit not to contain values grater than 255. Ther would be no problem when user write it without hesitation but i do not know how to do this when for example somebody will try inject "2" betwen "4" and "5"
Posted on 2003-11-22 16:42:02 by AceEmbler
Limit the Edit Control to only 3 chars :)
Posted on 2003-11-22 17:59:01 by JimmyClif
Are the entries integers ?
If so just add their values together and if theyre above > 255: Messagebox "dumb user"
Posted on 2003-11-23 01:06:18 by Ranma_at
This was covered in another thread:

http://www.asmcommunity.net/board/index.php?topic=13597&perpage=15&pagenumber=2

Put the maximum number in the GWL_USERDATA parameter of the edit control and subclass it using this procedure.

LimitWndProc PROC hEdit:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

LOCAL hParent :DWORD
LOCAL idCtrl :DWORD
LOCAL lpTranslated :DWORD
LOCAL OldValue :DWORD
LOCAL Limit :DWORD
LOCAL SelStart :DWORD

.if uMsg==WM_CHAR || uMsg==WM_PASTE
invoke GetParent,hEdit
mov hParent,eax
invoke GetDlgCtrlID,hEdit
mov idCtrl,eax
invoke GetWindowLong,hEdit,GWL_USERDATA
mov Limit,eax
invoke GetDlgItemInt,hParent,idCtrl,ADDR lpTranslated,FALSE
mov OldValue,eax
invoke CallWindowProc,OldWndProc,hEdit,uMsg,wParam,lParam

push eax
invoke GetDlgItemInt,hParent,idCtrl,ADDR lpTranslated,FALSE
.IF eax > Limit
invoke SetDlgItemInt,hParent,idCtrl,Limit,FALSE
invoke SendMessage,hEdit,EM_SETSEL,0,-1
.ELSEIF lpTranslated == FALSE
invoke SetDlgItemInt,hParent,idCtrl,0,FALSE
invoke SendMessage,hEdit,EM_SETSEL,0,-1
.endif

pop eax
.else
invoke CallWindowProc,OldWndProc,hEdit,uMsg,wParam,lParam

.endif
ret
LimitWndProc endp
Posted on 2003-11-23 01:17:21 by donkey

This was covered in another thread:

http://www.asmcommunity.net/board/index.php?topic=13597&perpage=15&pagenumber=2

Put the maximum number in the GWL_USERDATA parameter of the edit control and subclass it using this procedure.

LimitWndProc PROC hEdit:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

LOCAL hParent :DWORD
LOCAL idCtrl :DWORD
LOCAL lpTranslated :DWORD
LOCAL OldValue :DWORD
LOCAL Limit :DWORD
LOCAL SelStart :DWORD

.if uMsg==WM_CHAR || uMsg==WM_PASTE
invoke GetParent,hEdit
mov hParent,eax
invoke GetDlgCtrlID,hEdit
mov idCtrl,eax
invoke GetWindowLong,hEdit,GWL_USERDATA
mov Limit,eax
invoke GetDlgItemInt,hParent,idCtrl,ADDR lpTranslated,FALSE
mov OldValue,eax
invoke CallWindowProc,OldWndProc,hEdit,uMsg,wParam,lParam

push eax
invoke GetDlgItemInt,hParent,idCtrl,ADDR lpTranslated,FALSE
.IF eax > Limit
invoke SetDlgItemInt,hParent,idCtrl,Limit,FALSE
invoke SendMessage,hEdit,EM_SETSEL,0,-1
.ELSEIF lpTranslated == FALSE
invoke SetDlgItemInt,hParent,idCtrl,0,FALSE
invoke SendMessage,hEdit,EM_SETSEL,0,-1
.endif

pop eax
.else
invoke CallWindowProc,OldWndProc,hEdit,uMsg,wParam,lParam

.endif
ret
LimitWndProc endp



Sory but i do not like your example
can i do this without using GWL_USERDATA ??
Posted on 2003-11-23 13:07:52 by AceEmbler

Sory but i do not like your example
can i do this without using GWL_USERDATA ??

:confused: Just make Limit a global variable or a constant
Posted on 2003-11-23 14:01:32 by donkey
Thats intersting one.
It's not exactly what i meant but usefull also.

Thanks donkey
Posted on 2003-11-23 15:21:39 by AceEmbler