Click to See Complete Forum and Search --> : How to Disable Alt F4 Acceletartor Key when i disable CANCEL Button in MFC Dialog Based application


Ganesh Agrawal
March 28th, 1999, 11:44 PM
How to Disable Alt F4 Acceletartor Key when i disable CANCEL Button in MFC Dialog Based application.

Daren Chandisingh
March 29th, 1999, 05:03 AM
Find or add the OnSysCommand message handler and add some code similar to this:

<P>

<PRE>

void CJunkDlg::OnSysCommand(UINT nID, LPARAM lParam)

{

if (bPreventClose && (nID == SC_CLOSE))

{

return;

}

//... rest of function ...

}

</PRE>


Toggle bPreventClose to be true or false as you enable or disable the Cancel button.

siva_mm
June 17th, 2001, 09:12 PM
This will also disable the close button. How can only Alt+F4 be disabled?