Q: How to enable/disable the 'Close' button of your dialog at run-time?
A:
Code:BOOL bEnable = TRUE; // To enable BOOL bEnable = FALSE; // To disable UINT menuf = bEnable ? (MF_BYCOMMAND) : (MF_BYCOMMAND | MF_GRAYED | MF_DISABLED); CMenu* pSM = GetSystemMenu(FALSE); if(pSM) { pSM->EnableMenuItem(SC_CLOSE, menuf); }