Hi all,
I'm attempting to use the WM_GETTEXTLENGTH, to give me a live character count in an editbox, as and when the user adds and deletes characters. At present I've put the call in WinProc under uMsg==WM_CREATE but the code is never executed, below is my attempt.

invoke GetDlgItem,hWnd,IDC_EDIT_INFO
mov , eax

Dose anyone know What changes I need to make, and the correct placement of the code, to accomplish the above task.

Regards Enforcer
Posted on 2001-10-21 21:37:39 by Enforcer
Hi Enforcer

An edit control sends an EN_CHANGE to it's parent window when you add or delete.

From Win32api:

idEditCtrl = (int) LOWORD(wParam); // identifier of edit control
hwndEditCtrl = (HWND) lParam; // handle of edit control

.elseif uMsg==EN_CHANGE
invoke SendMessage,lParam,WM_GETTEXTLENGTH,0,0
;eax now has text lenght

Maybe you can use this.

Posted on 2001-10-22 02:23:09 by KetilO
Thanks KetilO for your reply, the code was very helpful, the part I couldn't get working was the msg==EN_CHANGE.
I did a quick messageboard search and found a thread that Scronty had replied to on a similar problem, I was then able to place the last bit of the puzzle into place, so the final code segment looks like this and works fine.


.elseif uMsg==WM_COMMAND
mov edx, wParam
shr edx, 16

.if dx==EN_CHANGE
mov eax, wParam
invoke SendMessage,lParam,WM_GETTEXTLENGTH,0,0
mov [txtlen], eax

Nice to see fellow programmers comming to each others aid.

Regards Enforcer
Posted on 2001-10-22 18:51:24 by Enforcer