WHY DO MY PROGRAMS CLOSE WHEN I PRESS ENTER?
AND HOW DO STOP THIS?
Printable View
WHY DO MY PROGRAMS CLOSE WHEN I PRESS ENTER?
AND HOW DO STOP THIS?
Erm, they won't unless your window procedure handles things like this. Are you using MFC?
yes MFC
Override OnOK, or remove the OK button. In the same way, pressing escape triggers OnCancel (I think).
a lot of program that people i konw have that problem...my friend has that problem, and this program called PunkBuster for the online game half-life does it.....
can i just make the keypress event do somthing else? how would i do that?
With MFC, if you want to change the default behaviour, just override the methods in your dialogue box class.
still cant figure it out...i deleted the ok and cancel buttons, and no where in any of my code is OnOK(); or OnCancel();
but it still closes when i press enter
That's because you need to override OnOK and OnCancel using ClassWizard.