//Free the string allocated by MFC at CWinApp startup. 
//m_pszHelpFilePath is the member variable of CWinApp that stores the 
//location to default help window.
//initialize it to an empty string just to be extra sure that default windows 
//support page location is never found.
//This needs to be set before CWinApp::InitInstance() is called.
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath = _tcsdup(_T(""))
In the MainFrame.cpp, declare the MessageMap: 
BEGIN_MESSAGE_MAP(MainFrame, CWinApp)
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
END_MESSAGE_MAP()
Then, call the OnCommandHelp() that is a message handler which will be used to process F1 when in disabled mode.
LRESULT  MainFrame::OnCommandHelp(WPARAM wParam, LPARAM lParam)
{
    CWnd *pWnd = GetFocus();
    if (pWnd != NULL)
    {
        CWinApp* theApp = AfxGetApp();
        CString helpFilePath = theApp->m_pszHelpFilePath;
        // we have a control with the focus, quit help display
        ::WinHelp(m_hWnd, helpFilePath, HELP_QUIT, NULL);
        return TRUE;
    }
    return FALSE;        // let default handling process it
}
Here, WinHelp() is called which launches Windows Help (Winhelp.exe) and passes additional data that indicates the nature of the help requested by the application. HELP_QUIT as one of its parameters, closes the default windows help support page requested. 
Also, don't forget to declare the OnCommandHelp() in MainFrame.h :
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);