Application will be closing when Pressed "Enter" or "Escape"
-
The Applications which I have written in vc++ are terminating when I press "Enter" Button or pressing "Escape" button.How can I prevent this type of termination.
YSRao wrote: The Applications which I have written in vc++ are terminating when I press "Enter" Button or pressing "Escape" button. I suppose they are dialog based. If it's so, then override OnOK and OnCancel handlers. Pavel Sonork 100.15206
-
The Applications which I have written in vc++ are terminating when I press "Enter" Button or pressing "Escape" button.How can I prevent this type of termination.
I assume you've written a dialog based app. Override the
OnOK()
andOnCancel()
handlers to simplyreturn;
without calling the base class methods. Then, add a button (eg:IDC_BUTTON_EXIT
) to your dialog and callCDialog::OnOK()
in its handler. /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com -
The Applications which I have written in vc++ are terminating when I press "Enter" Button or pressing "Escape" button.How can I prevent this type of termination.
I guess this is a dialog-based app, so you need to override
CYourDlg::PreTranslateMessage
to catchWM_KEYDOWN
messages with(wParam == VK_RETURN || wParam == VK_ESCAPE)
. You may simply returnTRUE
from this function (with no base implementation call) to get rid of the behavior you mentioned. Regards, BB