home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / nethelp.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  80 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include "stdafx.h"
  20. #include "nethelp.h"
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // IOleHelp operations
  24.  
  25. void IOleHelp::HtmlHelp(LPCTSTR pMapFileUrl, LPCTSTR pId, LPCTSTR pSearch)
  26. {
  27.     static BYTE parms[] =
  28.         VTS_BSTR VTS_BSTR VTS_BSTR;
  29.     InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
  30.          pMapFileUrl, pId, pSearch);
  31. }
  32.  
  33.  
  34. // Called from mkhelp.c to get the standard location of the NetHelp folder as a URL
  35. char * FE_GetNetHelpDir()
  36. {
  37.     CString        nethelpDirectory;
  38.     
  39. #ifdef XP_WIN32
  40.     CString    regKey = FEU_GetCurrentRegistry(szLoadString(IDS_NETHELP_REGISTRY));
  41.     CString installDirectory = FEU_GetInstallationDirectory(regKey, szLoadString(IDS_NETHELP_DIRECTORY)) + "\\";
  42. #else ifdef XP_WIN16
  43.     CString installDirectory = FEU_GetInstallationDirectory(szLoadString(IDS_NETSCAPE_REGISTRY), szLoadString(IDS_NETHELP_DIRECTORY)) + "\\";
  44. #endif 
  45.  
  46.     WFE_ConvertFile2Url(nethelpDirectory, installDirectory);
  47.     
  48.     if (nethelpDirectory.IsEmpty()) {
  49.         return NULL;
  50.     } else {
  51.         return XP_STRDUP(nethelpDirectory);
  52.     }
  53. }
  54.  
  55. MWContext *FE_GetNetHelpContext()
  56. {
  57.     MWContext *pActiveContext = NULL;
  58.  
  59.     if(theApp.m_pSlaveCX) {
  60.         pActiveContext = theApp.m_pSlaveCX->GetContext();
  61.     }
  62.  
  63.     return pActiveContext;
  64. }
  65.  
  66.  
  67. /* Left in for compatibility, for the moment */
  68.  
  69. void NetHelp( const char *topic )
  70. {
  71.     if( topic ) {
  72.         MWContext *pNetHelp = FE_GetNetHelpContext();
  73.         if(pNetHelp) {
  74.             XP_NetHelp( pNetHelp, topic );
  75.         }
  76.     }
  77. }
  78.  
  79.  
  80.