The main wnd for my app is a dialog box.Whenever i press ENTER or ESC my app closes.Can i disable this.
Printable View
The main wnd for my app is a dialog box.Whenever i press ENTER or ESC my app closes.Can i disable this.
Are you using MFC or pure Windows calls? With MFC, just add your own handler for the IDOK button. With pure Windows, it shouldn't do anything you haven't specifically told it to do.
CHahaDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
MessageBox(HWND(this),"Blabla","HAHA",MB_OK);
}
else if (nResponse == IDCANCEL)
{
MessageBox(HWND(this),"Blabla","HAHA",MB_OK);
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
The Dialog still dissapears and the sgbox doesn't appear.
I changed the IDOK event(didn't i).
I almost forgot i use MFC.
Try using NULL as the first argument to MessageBox.