Share via


ISnapinHelp2::GetHelpTopic method

The ISnapinHelp2::GetHelpTopic method enables a snap-in to add its compiled HTML Help file to the MMC Help collection file.

Syntax

HRESULT GetHelpTopic(
  [out] LPOLESTR *lpCompiledHelpFile
);

Parameters

  • lpCompiledHelpFile [out]
    A pointer to the address of the null-terminated Unicode string that contains the path of the compiled Help file (.chm) for the snap-in. When specifying the path, place the file anywhere and specify the full path name.

Return value

This method can return one of these values.

  • S_OK
    A Help file path string is returned.

  • S_FALSE
    The snap-in does not have a Help file.

  • E_UNEXPECTED
    An unexpected error occurred.

  • E_POINTER
    The parameter is NULL.

Remarks

MMC calls the snap-in's implementation of this method to get the location of the snap-in's Help file. MMC merges the HTML Help files of all snap-ins with the MMC console HTML Help collection file.

The topic hierarchy from the snap-in's Help file will appear in the table of contents when the collection is viewed. If the Help file links to topics in other Help files, the additional files can be added to the collection with the ISnapinHelp2::GetLinkedTopics method.

By merging the HTML Help files, MMC creates a single, integrated HTML Help table of contents, index, and search feature. When a user clicks Help on Microsoft Management Console on the main Help menu, MMC opens the merged Help file that includes HTML Help files for all snap-ins in the current console file.

Allocate the lpCompiledHelpFile string with the COM API function CoTaskMemAlloc (or the equivalent) and MMC will release it.

Examples

STDMETHODIMP CComponentData::GetHelpTopic( LPOLESTR *lpCompiledFile )
{
    LPOLESTR lpHelpFile;
 
    if ( !lpCompiledFile )
        return E_POINTER; // invalid argument
 
    lpHelpFile = (LPOLESTR) CoTaskMemAlloc( MAX_PATH * sizeof(WCHAR) );
 
    if ( !lpHelpFile )
    {
        return E_OUTOFMEMORY;
    }
 
    ExpandEnvironmentStringsW( L"%SystemRoot%\\Help\\myhelpfile.chm", lpHelpFile, MAX_PATH );
 
    *lpCompiledHelpFile = lpHelpFile;
 
    return S_OK;
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Mmc.h

See also

IDisplayHelp::ShowTopic

ISnapinHelp2

MMCPropertyHelp

Adding HTML Help Support

Providing MUI-Compliant Help Files