Program Help for Visual C++ applications

This information is for developers connecting context-sensitive Help topics to C++ applications.

1)Open the project in the C++ IDE.

2)Add RoboHelp_CSH.cpp and RoboHelp_CSH.h to the project.

3)Link the wininet.lib and hhctrl.lib libraries to the application. Look for the hhctrl.lib library in the CSH API subfolder of the installation folder.

4)If you are using Microsoft Visual C++ with MFC, set the RoboHelp_CSH.cpp file so that it doesn’t use precompiled headers.

Prevent RoboHelp_CSH.cpp from using precompiled headers

Visual Studio 6

1)Select Project > Settings.

2)Select Robohelp_Csh.Cpp.

3)On the C/C tab, change Category to Precompiled Headers.

4)Select Not Using Precompiled Headers.

5)Click OK.

Visual Studio .NET

1)Right-click Robohelp_Csh.Cpp. Select Properties.

2)In the C/C folder, select Precompiled Headers.

3)Select Not Using Precompiled Headers.

Function calls from Visual C++ applications

note:   Connect context-sensitive Multiscreen HTML5, Responsive HTML5, WebHelp, WebHelp Pro, FlashHelp, FlashHelp Pro, or HTML Help topics to Visual C++ applications.

note:    You can call the context-sensitive help from other languages too. Visual C++ is given as an example here.

RH_ShowHelp syntax

int RH_ShowHelp(HWND hParent, const char * a_pszHelpFile, unsigned int uCommand, DWORD dwData)

Parameter

Data type

Description

hParent

HWND

Handle to calling the dialog box HTML Help Only: Close the Help dialog box with the calling window.

a_pszHelpFile

const char *

Help source For Webhelp/FlashHelp: "Path to project start page" For Webhelp Pro: "http://[ServerName]/roboapi.asp"

* For HTML Help: "Path to .CHM file"

To specify a dialog box, use ">WindowName" at the end of this parameter.

uCommand

unsigned int

Constants:

HH_DISPLAY_INDEX Displays Index pane and default topic.

HH_DISPLAY_SEARCH Displays Search pane and default topic.

HH_DISPLAY_TOC Displays Contents pane and default topic.

HH_HELP_CONTEXT Opens topic associated with map ID in dwData parameter.

dwData

DWORD

To obtain the map ID, export the map file for the programming language. Use HH_HELP_CONTEXT in the uCommand parameter.

RH_OpenHelpTopic Syntax

Call "RH_OpenHelpTopic” function to open a Help Topic in WebHelp or FlashHelp.

int RH_OpenHelpTopic(const TCHAR * a_pszHelpMainPage,
                    const TCHAR * a_pszTopicRelPath);

Parameter

Data type

Description

a_pszHelpMainPage

const char *

Help source For Webhelp/FlashHelp: "Path to project start page" . To specify a window, append ">WindowName" at the end Path to the project start page.

a_pszTopicRelPath

const char *

Relative path of the topic corresponding to the main page.

tip:   To open to the default topic, make a Help call that sets uCommand to HH_DISPLAY_INDEX, HH_DISPLAY_SEARCH, or HH_DISPLAY_TOC, and dwData to "0". In WebHelp Pro systems, default window settings for default navigation buttons override the HH_DISPLAY constant.

Call a context-sensitive Help function for AIR Help

note:    The AIR Help API is provided for many languages including JAVA, VC.NET, CS.NET, VB, VB.NET. The following example shows how to invoke the AIR Help API using Visual C++.

Call RH_AIR_ShowHelp function to show AIR Help Application.

int RH_AIR_ShowHelp(const TCHAR * a_pszViewerPath,
const TCHAR * a_pszHelpId,
const TCHAR * a_pszWindowName,
unsigned long ulMapNum,
const TCHAR * a_pszMapId,
const TCHAR * a_pszTopicURL);

Parameter

Data Type

Description

a_pszViewerPath

const char *

Path to the installation directory of AIR Help Application.

a_ pszHelpId

const char *

(Optional) ID of help content to be viewed in Viewer. It is specified in .helpcfg file.

a_pszWindowName

const char *

(Optional) Customized output window name.

ulMapNum

unsigned long

Context-sensitive map number

a_pszMapId

const char *

(Optional) Context-sensitive map ID. If specified it takes priority and ulMapNum is ignored.

a_pszTopicURL

const char *

(Optional) URL of the topic to appear. If specified, this parameter takes priority over ulMapNum and a_pszMapId.

The return value is 0 for a successful result and non-zero if any error occurs.

RH_GetAIRAppPath

Call RH_GetAIRAppPath function to get AIR Help Application.

TCHAR * RH_GetAIRAppPath(const TCHAR * a_pszAppId,
            const TCHAR * a_pszPublisherId);

Parameter

Data Type

Description

a_pszAppId

const char *

Help app ID, specified in RoboHelp during AIR generation.

a_pszPublisherId

const char *

ID corresponding to the digital certificate used for signing the AIR application.

The return value path of the AIR application. The user can call the function free() to free up the memory.note:    Data Type can also be const wchar * for Unicode enabled applications.

Call a context-sensitive function for Responsive/Multiscreen HTML5 Help, WebHelp, FlashHelp, or FlashHelp Pro

The following example assumes the full path to the WebHelp/FlashHelp start page and a dialog box name are stored in a string variable called StrPathAndWindow. An example of this string is “C:\\Program Files\\MyApplication\WebHelp\MyStartPage.htm>MyWindow.” Do not hard-code this string.

note:   Export the map files to the location.

Example:

To open the topic mapped as number 1:

  RH_ShowHelp(GetSafeHwnd(), strPathAndWindow, HH_HELP_CONTEXT, (DWORD)1);

note:   If using airplane Help, associate the offline Help before making calls.

note:    If using Multiscreen or Responsive HTML5 Help, you can also use the functions RH_ShowMul­tiscreenHelpWithMapId andRH_ShowMultiscreenHelpWithMapNoto call HTML5 help topics using MapId and Map number, respectively. The source code and documentation for these func­tions is contained in the support file RoboHelp_CSH.cpp located at C:\Program Files\Adobe\Adobe RoboHelp [version]\CSH API\. You need to import this support file into your C/C++ development project to use these functions.

Call a context-sensitive function for WebHelp Pro

1)Call the function.

The following example assumes the full path to the server and a window name are stored in a string variable called StrPathAndWindow. The project name is required if the Auto-Merge option is set to Off. The value of this string is http://<servername>/robohelp/rest/search?project=<project-name>&quesn=<search-query> for getting the URL for a given keyword.

For getting the context-sensitive information, the URLs are http://servername>/robohelp/rest/robowindow?wtype=ctx &context=<id>[&area=<area_of_publishing>&type=project_type>]

or

http://servername>/robohelp/rest/robowindow?wtype=prj&window=<windowname>[&area=<area_of_publishing>&type=<project_type>]

note:   Export the map files to the location.

Example:

To open the topic mapped to number 1:

     RH_ShowHelp(GetSafeHwnd(), strPathAndWindow, HH_HELP_CONTEXT, (DWORD)1);

2)Run and test the Help call.

note:   If using airplane Help, associate the offline Help before making calls.

Call a context-sensitive function for HTML Help

1)Call the function.

The following example assumes the CHM file and a window name are stored in a string vari­able called StrPathAndWindow. The value of this string indicates the path to the CHM file, such as C:\Program Files\MyApplication\MyHelp.chm>MyWindow.

Example:

To open the topic mapped as number 1:

     RH_ShowHelp(GetSafeHwnd(), strPathAndWindow, HH_HELP_CONTEXT, (DWORD)1);

2)Run and test the Help call.

Notes:

If using airplane Help, associate the offline Help before making calls.

In WebHelp Pro projects, the Help API is supported only with RoboHelp Server or RoboEn­gine 3.0 or later.

Overriding the default MFC Help Handler

This topic is for Visual C++ developers who create MFC-based applications.

As stated in the RoboHelp_CSH.h header file, the wininet.lib and hhctrl.lib libraries must be linked into the application. The hhctrl.lib library can be in the CSH API folder in the RoboHelp installation folder.

Include the RoboHelp_CSH.cpp file in your project.

To use the RoboHelp API instead of the default MFC Help handler, override the WinHelp function in your mainframe class. By default, Visual Studio calls this class CMainFrame, and you can use the class wizard inside Visual Studio to create the function override.

After overriding the function and including RoboHelp_CSH.h, replace the contents of the function with this code. (Set the path to your Help file properly. The example shows RoboHelp Server-based Help.)

note:    Modify the path to server-based Help according to your project. In this example, the path applies to RoboHelp Server Help. See the rest of the API documentation to determine parameter values for each command and specify secondary windows for context-sensitive Help calls.

     CWaitCursor wait;
 if (IsFrameWnd()) {
    // CFrameWnd windows should be allowed to exit help mode first
    CFrameWnd* pFrameWnd = (CFrameWnd*)this;
    pFrameWnd->ExitHelpMode();
 }  
 // cancel any tracking modes
 SendMessage(WM_CANCELMODE);
 SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);
 // must use top level parent (for the case where m_hWnd is in DLL)
 CWnd* pWnd = GetTopLevelParent();
 pWnd->SendMessage(WM_CANCELMODE);
 pWnd->SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);
 // attempt to cancel capture
 HWND hWndCapture = ::GetCapture();
 if (hWndCapture != NULL)
    ::SendMessage(hWndCapture, WM_CANCELMODE, 0, 0);
    // Set the path to server-based help
    CString csOnlineHelpPath = _T("http://myserver/RoboAPI.asp");
    // Translate the nCmd from WinHelp commands to RoboHelp commands
    unsigned int nRHCmd;
    switch (nCmd) {
       case HELP_CONTEXT: nRHCmd = HH_HELP_CONTEXT; break;
       case HELP_CONTENTS: nRHCmd = HH_DISPLAY_TOC; break;
       case HELP_CONTEXTMENU: nRHCmd = HH_TP_HELP_CONTEXTMENU; break;
       case HELP_WM_HELP: nRHCmd = HH_TP_HELP_WM_HELP; break;
       case HELP_FINDER: nRHCmd = HH_HELP_FINDER; break;
       default: nRHCmd = nCmd; break;
 }  
 // finally, run the RoboHelp Help engine
 if (!RH_ShowHelp(pWnd->m_hWnd, csOnlineHelpPath, nCmd, dwData))
    AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH_HELP);

Visual C++ developers using Visual Studio .NET

As stated in the RoboHelp_CSH.h header file, the wininet.lib and htmlhelp.lib libraries must be linked into the application.

Include the RoboHelp_CSH.cpp file in your project.

To use the RoboHelp API instead of using the default MFC Help handler, override the Html­Help function in your mainframe class. By default, Visual Studio calls this class CMainFrame, and you can use the class wizard inside Visual Studio to create the function override.

After overriding the function and including RoboHelp_CSH.h, replace the contents of the function with the following code. (Set the path to your Help file accordingly. The example shows server-based Help.)

     CWaitCursor wait;
 // Get the path to the Help system  
 CWinApp* pApp = AfxGetApp();
 ASSERT_VALID(pApp);
 // Set the path to server-based help  
 CString csOnlineHelpPath = _T("http://RoboHelp Server:port/robohelp/server");
 PrepareForHelp();
 // must use top level parent (for the case where m_hWnd is in DLL)  
 CWnd* pWnd = GetTopLevelParent();
 // finally, run the RoboHelp Help engine
 if (!RH_ShowHelp(pWnd->m_hWnd, csOnlineHelpPath, nCmd, dwData))
    AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH_HELP);

note:   In WebHelp Pro projects, the new context-sensitive Help API is supported only with RoboHelp Server or RoboEngine 3.0 or later.

Airplane Help for C++ applications

Syntax

     void RH_AssociateOfflineHelp(const char * a_pszPrimaryHelpSource, const char * a_pszBackupHelpSource)

Example

     m_sOnline = "http://www.mycompany.com/roboapi.asp?project=myproject";
 m_sOffline = "C:\Program Files\My App\WebHelp\StartPage.htm";
 RH_AssociateOfflineHelp(m_sOnline, m_sOffline);

note:   To specify different window names for online and offline Help, you can map windows to RH_As­sociateOfflineHelp. Follow this example for Visual Basic:

     strOnline = "http://www.mycompany.com/roboapi.asp?project=myproject>RemoteWindow1"
 strOffline = "C:\Program Files\My App\MyHelp.chm>LocalWindow1"
 Public cshObject as new RoboHelp_CSH  ' Should be global object
 cshObject. RH_AssociateOfflineHelp strOnline, strOffline
 strOnline = "http://www.mycompany.com/roboapi.asp?project=myproject>RemoteWindow2"
 strOffline = "C:\Program Files\My App\MyHelp.chm>LocalWindow2"
 cshObject. RH_AssociateOfflineHelp strOnline, strOffline

note:   WebHelp Pro context-sensitive Help API is supported only with RoboHelp Server or RoboEngine 3.0 or later.


September 30, 2016

Legal Notices | Online Privacy Policy