hello everyone,
i have a richedit on my dialog (RichEdit20A).
pressing ESC while the richedit has the focus it sends the WM_CLOSE message to my DlgProc... this happens only if the richedit has the ES_MULTILINE style.
how can i avoid this? i don't want the dialog to close pressing ESC.

Posted on 2005-05-17 08:10:01 by blues4u
you can check the control id in your dlgproc and do nothing in response to WM_CLOSE from the IDC_RICHEDIT control.
Posted on 2005-05-18 18:21:37 by rdaneel
yes, i thought this as well, but according to the Win32 API documentation the message WM_CLOSE has no parameters (meaning both wParam and lParam are 0), so how to know from which control the WM_CLOSE comes from?

Posted on 2005-05-19 03:28:02 by blues4u
i guess you will have to subclass that control and check it that way.  seems like a lot of trouble though.
Posted on 2005-05-19 11:50:02 by rdaneel
i solved the problem!
i do not destroy the dialog when it receives WM_CLOSE but only when it receives WM_SYSCOMMAND with notification SC_CLOSE...
this way it closes correctly with the "X" button and with Alt+F4 but it ignores the WM_CLOSE that the richedit sends automatically.
thanks for your help, you put me in the correct road with your first post.

Posted on 2005-05-20 05:45:50 by blues4u