//
/// Called by EvHelp() to activate the help file with the help context ID.
//
void
THelpFileManager::ActivateHelp(TWindow* /*window*/, int helpFileContextId, uint helpCmd)
{
  if (helpCmd == HELP_INDEX || helpCmd == HELP_CONTENTS)
    helpCmd = HELP_FINDER;
  TApplication* app = TYPESAFE_DOWNCAST(this, TApplication);
#if !defined(NO_HTMLHELP)
  if(UseHTMLHelp){
    if (app)
      HelpState = ToBool(HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(),
                                  helpCmd, helpFileContextId) != 0);
    else
      HelpState = ToBool(HtmlHelp(0, GetHelpFile().c_str(),
                                  helpCmd, helpFileContextId) != 0);
  }
  else{
#endif
    if (app)
      HelpState = ToBool(app->GetMainWindow()->WinHelp(GetHelpFile().c_str(),
                         helpCmd, helpFileContextId));
    else
      HelpState = ToBool(::WinHelp(0, GetHelpFile().c_str(),
                         helpCmd, helpFileContextId));
#if !defined(NO_HTMLHELP)
  }
#endif
}
//
/// Deactivates the help.
//
void
THelpFileManager::DeactivateHelp()
{
  TApplication* app = TYPESAFE_DOWNCAST(this, TApplication);
#if !defined(NO_HTMLHELP)
  if(UseHTMLHelp){
    if (app)
      HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(), HELP_QUIT, 0);
    else
      HtmlHelp(0, GetHelpFile().c_str(), HELP_QUIT, 0);
  }
  else{
#endif
    if (app)
      app->GetMainWindow()->WinHelp(GetHelpFile().c_str(), HELP_QUIT, 0);
    else
      ::WinHelp(0, GetHelpFile().c_str(), HELP_QUIT, 0);
#if !defined(NO_HTMLHELP)
  }
#endif
}
Exemple #3
0
////////////////////////////////////////////////////////////////////////////////
//
// Adds Custom help top a OPTTYPE UI item.
//
// Note :
//  The OPTITEM member HelpIndex must be set the the correct HELP ID number.
//      HelpIndex is the index that you assigned in the hlp file to this item of help.
//  The OPTITEM, pOIExt member must point to a valid OIEXT structure.
//  The phelpfile is member of OIEXT must have the fully qualified path to the driver file.
//
//
//  It is also possible to overide common help items in UNIDRIVE via the HelpIndex in the GPD.
//  For further information on using HelpIndex in the GPD see the relavent section in the DDK
//  It is not possible to custimse help however via the PPD. The OPTITEM must be modified in the OEM Plugin.
//
static BOOL AddCustomUIHelp (HANDLE hPrinter, HANDLE hHeap, HANDLE hModule,
                             POPTITEM pOptItem, DWORD HelpIndex, DWORD HelpFile)
{
    POIEXT pOIExt = NULL;

    //
    //Allocate a new OIEXT structure on the heap
    //
    if (pOptItem->pOIExt == NULL)
    {
        pOptItem->pOIExt = CreateOIExt(hHeap);
    }

    if ( pOptItem->pOIExt == NULL )
    {
        ERR("AddCustomUIHelp() Error Allocation Failed.\r\n");
        return FALSE;
    }

    pOIExt = pOptItem->pOIExt;

    //
    //Set to the full absolute path of the driver file.
    //(It should be in the Printer Driver Directrory in most cases)
    //This String needs to be allocated on the heap (The Driver will clean it up).
    //
    pOIExt->pHelpFile = GetHelpFile (hPrinter, hHeap, hModule, HelpFile);

    //
    //Set to show tha there is a valid OIEXT structure and data
    //
    pOptItem->Flags |= OPTIF_HAS_POIEXT;

    //
    //This needs to be set if you have ansi strings in your help file. (NOTE!)
    //
    //pOiExt->Flags |= OIEXTF_ANSI_STRING;

    //
    //Add the help this the index in the .hlp file.
    //
    pOptItem->HelpIndex = HelpIndex;

    return TRUE;
}