Share via


Receiving HTML Help Notification Messages in an MFC Application

To receive notification messages from HTML Help within an MFC program, you must:

  1. Define a symbol in your Visual C++ project. This example uses a symbol called ID_HHNOTIFICATION.

    • To define a symbol, right click the high-level folder in ResourceView and select Resource Symbols.

    • In the Resource Symbols dialog box, click New and define the new symbol.

  2. In your Visual C++ project, initialize the HH_WINTYPE structure and call the HTMLHelp function to set this structure using the HH_SET_WIN_TYPE command. Use ID_HHNOTIFICATION for the idNotify field in the structure.

  3. Define the handler for your custom notification message.

    • Place a function prototype for the handler, called OnNavComplete, in your class' .h file. For example:

      protected:
      //{{AFX_MSG(CMainFrame)
      afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
      //}}AFX_MSG
      void OnNavComplete(NMHDR*, LRESULT*);
      DECLARE_MESSAGE_MAP()
      
    • Place an entry in your class's message map as follows:

      BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
      //{{AFX_MSG_MAP(CMainFrame)
      ON_WM_CREATE()
      ON_NOTIFY(HHN_NAVCOMPLETE, ID_HHNOTIFICATION, OnNavComplete)
      //}}AFX_MSG_MAP
      END_MESSAGE_MAP()
      
    • Define a function, OnNavComplete, to handle the notifications.

Back to Help Topics (HTML Help)