hello !

i have some trouble with the WM_KEYDOWN message in a dialog
with an edit box, why receives my app no WM_KEYDOWN
message when i write in the edit box ?
have i some mistake's in the code ?
or is that not possible in a dialogbox ?


here is the basic code:

######################################

.CONST
ICONA equ 1000
IDE_INPUT equ 1001
IDC_EXIT equ 1002

.DATA
DlgName db "TEST-DLG",0
key_text db "WM_KEYDOWN received !",0

.DATA?
handle dd ?
hicona dd ?

.CODE
start:

push 0
CALL GetModuleHandle
mov handle,eax

push 0
push offset DlgProc
push 0
push offset DlgName
push handle
CALL DialogBoxParam

ret

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
cmp uMsg,WM_CLOSE
je wmdestroy
cmp uMsg,WM_COMMAND
je wmcommand
cmp uMsg,WM_INITDIALOG
je initdig
cmp uMsg,WM_KEYDOWN
je keypress_
xor eax,eax
ret

wmcommand:
cmp wParam,1002
je wmdestroy
xor eax,eax
ret

wmdestroy:
push 0
CALL PostQuitMessage
xor eax,eax
ret

initdig:
push ICONA
push handle
CALL LoadIcon

push eax
push ICONA
push WM_SETICON
push hWnd
CALL SendMessage
xor eax,eax
ret

keypress_:
push 40h
push offset DlgName
push offset key_text
push handle
CALL MessageBox
xor eax,eax
ret


ret
DlgProc endP

END start


;####rc file ####################


#include "\masm32\include\resource.h"
#define ICONA 1000
#define IDE_NAME 1001
#define IDC_EXIT 1002
ICONA ICON "MAINICON.ICO"

TEST-DLG DIALOGEX 0, 0, 157, 74
STYLE DS_ABSALIGN | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CLIENTEDGE
CAPTION " WM_KEYDOWN ??? "
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "EXIT",IDC_EXIT,45,47,57,12
EDITTEXT IDE_NAME,11,17,128,14
END

#######################################


ps:excuse my bad english !
i'm happy for all help,tips !

regards M.Englert
Posted on 2001-09-10 11:37:34 by Marcello
Afternoon, Marcello.

Instead of using 'WM_KEYDOWN', I just check for changes in the edit-box itself.

Check for 'EN_CHANGE' in 'WM_COMMAND'.
e.g.:
;*****************************************

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

.if dx==EN_CHANGE
mov eax, wParam
.if ax==IDC_Edit1
invoke MessageBox,hWnd,addr szMESS_INFO, addr szMESS_TITLE, MB_OK
.endif
.endif
;*****************************************

Cheers,
Scronty
Posted on 2001-09-10 18:12:53 by Scronty
hello Scronty !

thanks a lot, your detailed explanation have exactly resolved my
problem !

ciao marcello !
Posted on 2001-09-11 09:37:23 by Marcello