In your message map, add an ON_UPDATE_COMMAND_UI macro such as the following:
ON_UPDATE_COMMAND_UI(ID_FILE_OPEN, OnUpdateFileOpen)
In your header file, declare the function like:
afx_msg void OnUpdateFileOpen(CCmdUI* pCmdUI);
Then in the actual function body, all you really need to do is to...