Microsoft KB Archive/132715

= HOWTO: How to Enable the Help Button on a Modal Property Sheet =

Article ID: 132715

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 1.52 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition

 Microsoft Visual C++ 2.1

 Microsoft Visual C++ 4.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q132715

<div class="summary_section">

SUMMARY
The F1-key help functionality and the Help button on a Modal Property sheet can be enabled by choosing Context-Sensitive Help while generating an AppWizard-generated application. In a standard AppWizard-generated application, clicking the Help button on the property sheet has no effect because there is no default handler for the Help button. This article shows by example how to obtain F1-key functionality with the Help button.

<div class="moreinformation_section">

Step-by-Step Example
The default implementation of a modal property sheet has no handler for the Help button. To obtain F1-key functionality with the Help button, follow these steps:

<ol> Derive a class from CPropertySheet.</li> Add an OnHelp handler for ID_HELP to the property sheet. For more information on how to add a handler, please see MFC Technical Note #6.</li> In the OnHelp handler, send a WM_COMMANDHELP message to the property sheet window by using SendMessage(WM_COMMANDHELP).</li>  Implement the following code to provide the Help button with context-sensitive help functionality of the F1 function key: // Derive a class CMyPropertySheet from CPropertySheet. // Include the file afxpriv.h to obtain the id for // WM_COMMANDHELP in the implementation file for CMyPropertySheet

#include "afxpriv.h"

// add this handler in the implementation file for CMyPropertySheet

void CMyPropertySheet::OnHelp {       SendMessage(WM_COMMANDHELP); }                       </li></ol>

NOTE: The WM_COMMANDHELP message, when sent to the Property Sheet window, invokes the OnCommandHelp handler for the CPropertySheet class, which in turn sends a WM_COMMANDHELP message to the active page.

<div class="references_section">