Function ShowHelp in Windows Client Applications
In Windows client applications, you can use NetHelp context-sensitive Help in two different ways:
-
Use the Microsoft WebBrowser control to show Help inside one of your application windows. In this case you need to add a reference to the WebBrowser control in your application.
-
Show Help in a separate browser window. In this case you don’t need to use the WebBrowser control.
Use the appropriate syntax.
ContextSensitiveHelp.ShowHelp(ByVal query As Query, ByVal param As Parameters, ByVal url As String, ByVal window As Object) As Boolean
-
Query (Query Class) Represents Query parameters: QueryType, Value.
-
QueryType (QueryTypes enumeration) Possible values: ContextID, Keyword, Group, Search, TopicUrl, None. Specifies what type of query must be performed. It is used together with the Value parameter.
-
Value (String) Corresponds to specified QueryType and contains either a context ID value, keyword, group, search query, or a topic URL.
-
Param (Parameter Class) Represents Hash parameters: ActiveTab, TopicOnly.
-
Tab (Tabs Enumeration) Specifies the active tab when NetHelp is loaded. Possible values: Default, Contents, Index, Search.
-
TopicOnly (Bool) If true, the topic is displayed without the Contents, Index, and Search, and without header panel and toolbars. The user will still be able to navigate to other topics if this topic contains links to other topics, but the Contents, Index, and Search will be hidden. If false is passed, the complete Help system is displayed with Contents, Index, and Search, as well as header panel and toolbars. The user will be able to navigate through the links in the topic and through the Contents, Index, and Search.
-
URL (String) URL of the main web page of the Help or a direct topic URL. For example, the URL of a locally deployed NetHelp target can be a file path, although it still needs to be encoded as a URL with the prefix "file:///," such as file:///C:/Program Files (x86)/MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html; or, for a server-deployed NetHelp target it can be http://www.mycompany.com/myproject/index.html. This parameter is used to identify the Help system containing the topic. It is necessary because you may use multiple Help systems in the same application or even on the same web page.
-
Window (WebBrowser Object) If this parameter is null (Nothing in Visual Basic .NET), the Help is shown in a separate browser window, as if you were opening an HTML file with a double-click. If this parameter is set to a WebBrowser component, the Help is shown in that component. Using the WebBrowser component, you can show Help inside your application windows.
-
Add one of the D2H_ctxt.* files to your project; use D2H_ctxt.cs for C# or D2H_ctxt.vb for Visual Basic .NET.
-
To show context-sensitive Help in one of your application windows, add the WebBrowser control reference to your application. If you choose to show Help in a separate browser window, you don’t need a reference to the WebBrowser control.
Example — C#
-
Open default topic and Index
Copytab string url = "file:///C:/Program Files (x86)/MadCap Software/DocToHelp /Samples/MyProject/NetHelp/index.html";
Query query = new Query();
Parameters parameters = new Parameters(Tabs.Index);
ContextSensitiveHelp. ShowHelp(query, parameters, url, webBrowser); -
Open default topic with default tab (Contents) in topic only mode
Copystring url = "file:///C:/Program Files (x86)/ MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html";
Query query = new Query(QueryTypes.ContextID, "91");
Parameters parameters = new Parameters(Tabs.Default, true);
ContextSensitiveHelp.ShowHelp(query, parameters, url, webBrowser); -
Open specified topic and search tab
Copystring url = "file:///C:/Program Files (x86)/ MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html";
Query query = new Query(QueryTypes.TopicUrl, "documents/sandiego_attractions.htm");
Parameters parameters = new Parameters(Tabs.Search);
ContextSensitiveHelp.ShowHelp(query, parameters, url, webBrowser);
To open NetHelp in an external browser window pass null instead of the "webBrowser" value.
Example — Visual Basic .NET
-
Open default topic and Index tab
CopyDim url As String, query As Query, parameters As Parameters
url = "file:///C:/Program Files (x86)/ MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html"
query = New Query()
parameters = New Parameters(Tabs.Index)
ContextSensitiveHelp.ShowHelp(query, parameters, url, webBrowser); -
Open default topic with default tab (Contents) in topic only mode
CopyDim url As String, query As Query, parameters As Parameters
url = "file:///C:/Program Files (x86)/ MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html"
query = new Query(QueryTypes.ContextID, "91")
parameters = new Parameters(Tabs.Default, true)
ContextSensitiveHelp.ShowHelp(query, parameters, url, webBrowser); -
Open specified topic and search tab
CopyDim url As String, query As Query, parameters As Parameters
url = "file:///C:/Program Files (x86)/ MadCap Software/DocToHelp/Samples/MyProject/NetHelp/index.html"
query = new Query(QueryTypes.TopicUrl, "documents/sandiego_attractions.htm")
parameters = new Parameters(Tabs.Search)
ContextSensitiveHelp.ShowHelp(query, parameters, url, webBrowser);