// API.cpp : Implementation of CAPI

#include "stdafx.h"
#include "API.h"

#include "wwhelp/wwhwin.h"

// CAPI


STDMETHODIMP CAPI::Startup(BSTR BaseURL, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_Startup(BaseURL);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::Shutdown(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_Shutdown();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelp(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelp(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpWithNavigation(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpWithNavigation(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpWithContents(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpWithContents(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpWithIndex(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpWithIndex(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpWithSearch(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpWithSearch(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpWithFavorites(BSTR Context, BSTR Topic, LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpWithFavorites(Context, Topic);

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpNavigation(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpNavigation();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpContents(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpContents();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpIndex(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpIndex();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpSearch(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpSearch();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}

STDMETHODIMP CAPI::DisplayHelpFavorites(LONG* pRetVal)
{
  HRESULT  VarReturnCode = E_INVALIDARG;


  if (pRetVal != NULL)
  {
    *pRetVal = WWHelp_BSTR_DisplayHelpFavorites();

    VarReturnCode = S_OK;
  }

  return VarReturnCode;
}
