Share via


How to: Add the Help Pane Proxy Object to a C++ Project

To integrate the Help Pane Proxy Object with your project, link to the HelpPaneProxy.dll by adding an #import statement to your project header (.h) file, and then creating an instance of the Help Pane Proxy Object. The #import statement instructs the C++ compiler to implement a wrapper class, expose the Help Pane type library, and import the applicable header files.

To import the HelpPaneProxy.dll

  • Add the following code to the header (.h) file for your project:

    #import "C:\Windows\System32\HelpPaneProxy.dll" named_guids no_namespace exclude("GUID") exclude("IUnknown")
    

To create an instance of the Help Pane Proxy Object

  1. Use CoInitialize to initialize the COM library for use by the calling thread, and allocate a pointer variable for the IHxHelpPane interface.

    CoInitialize(NULL);
    IHxHelpPane* pHelpPane = NULL;
    

    The Help Pane proxy object can now be called from any form in the project, and will remain for as long as it is required.

  2. Call CoCreateInstance to create an instance of the Help Pane Proxy Object.

    HRESULT hr = ::CoCreateInstance(CLSID_HxHelpPane, NULL, CLSCTX_ALL, IID_IHxHelpPane, reinterpret_cast<void**>(&pHelpPane))
    
  3. At the end of the object lifetime, use CoUninitialize to close the COM library on the current thread, and unload all DLLs that were loaded by the thread.

Example

The following example demonstrates creating an instance of the Help Pane proxy object.

#include <windows.h>
#include <atlbase.h>
#include <stdio.h>

#import "C:\Windows\System32\HelpPaneProxy.dll" named_guids no_namespace exclude("GUID") exclude("IUnknown")

int _tmain(int argc, _TCHAR* argv[])
{
    CoInitialize(NULL);
    IHxHelpPane* pHelpPane = NULL;

    HRESULT hr = ::CoCreateInstance(CLSID_HxHelpPane, NULL, CLSCTX_ALL, IID_IHxHelpPane, reinterpret_cast<void**>(&pHelpPane));
    if(FAILED(hr))
    {
        printf("Can't create HelpPaneProxy object. HR=0x%X\n", hr);
        return -1;
    }

See Also

Other Resources

Help Pane API Overview