In Izces Subclassing tut, he subclasses an edit thats in a window and captures the enter key. When i do it in a window, it works. But when i use a dialog, i cant capture the enter key. Is there something else i need to do?
Posted on 2001-08-27 22:47:49 by ChimpFace9000
Message sending to the control only if it under FOCUS. Dialog window cannot be in focus, its not a control!
Posted on 2001-08-28 10:24:23 by Alexey
I'm not getting what you mean.
Posted on 2001-08-28 12:25:10 by ChimpFace9000
The enter key is a dialog "navigation" key captured by IsDialogMessage in a message loop before the dialog window proc gets called. If you are using DialogBoxParam (modal dialog), the call is hidden in this function.

You could fix it with a modeless dialog (create with CreateDialogParam). But you end up either disabling ENTER for all dialog boxes, or needing to fix code in two places for every control that needs to override the ENTER key.

If you want to prevent accidental closing of the dialog box, handle WM_COMMAND:IDOK in the dialog proc.
Posted on 2001-08-28 13:19:31 by tank
you can also answer to the WM_GETDLGCODE message.
There you can specify, that you handle the keys yourself.
Posted on 2001-08-28 14:44:39 by beaster
How about:

invoke GetDlgItem, hDlg, 6001 ; 6001 == edit ID
mov hToBeSubclassed, eax

Do you subclassing!!, .. it always worked for me.

Posted on 2001-08-28 20:35:20 by NaN
Have you tried ES_WANTRETURN ?

Posted on 2001-08-29 03:27:33 by Mirno