I have the exact same code (not including the ObBnClickedButton1) for an About menu item to pop up an About modal dialog from the main program dialog window. I see the ID value coming from the system is 0XF095. That is AFX_IDS_UNKNOWNTYPE from <afxres.h>. If I comment out the check for the menu in this method then the about dialog does display properly. So how is the system sending me an UNKNOWNTYPE?
//A selection from the menu (Just "About" for now)
void CguiDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
//the About menu item was selected and this should popup the About Dialog here
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}