H2Viewer - COM Interface

15-Jun-2003 - V1.1 - added: Index(), Search(), PageTab()
10-Jul-2004 - V1.3.4 - Safe Connect

Connect to the ActiveX COM server using either:
ProgrID = "H2Viewer.h2vmain"
CLASSID="CLSID:C13B8DA2-8149-45BA-9EEA-5FE23B302E76"

The H2Viewer.EXE application will open as soon as you connect. If the application detects that it has been opened via it's COM interface it will open with the main window hidden. In this case you must next call ShowWindow = 1 to show the window.

As soon as you disconnect the server (by destroying the Object in code. EG. Obj out of scope or set to null) the window will close (unless of course the window was already open before you connected).

10-Jul-2004: Save Connect

When calling ShowWindow=1 immediately after connecting to the COM server (above) you can get an exception error. This is a timing problem where the main window is not yet initialized. The fix is as follows:
a) Get h2Viewer version 1.3.4 or greater
b) Immediately after connecting, loop until WindowHandle != 0

Example:  The "Connect to Server" button (above) now runs the following code if connection is successful:
    do {} while (H2ViewerSvr.WindowHandle == 0);

Property: ShowWindow [Integer, Write Only]

Set ShowWindow=1 to show the main window.
Set ShowWindow=0 to hide the main window.

Method: Close()

Close the application

Property: Version [String, Read Only]

Returns the application Version number as a string
in the form: "MajorVer.MinorVer.ReleaseNo.BuildNo"

Property: V1 [Integer, Read Only]
Property: V2 [Integer, Read Only]
Property: V3 [Integer, Read Only]
Property: V4 [Integer, Read Only]

Returns the individual application Version numbers as
MajorVer, MinorVer, ReleaseNo, BuildNo

Property: WindowHandle [Integer, Read Only]

Returns the handle of the main window.

URL (Param1):

FilterName (Param2):

FilterQuery (Param3):

Method: Open(URL, FilterName, FilterQuery)

Opens a collection in the viewer.

URL [IN]: Namespace or HxS file to open in the viewer.
Example1: "ms-help://MS.VSCC" or just "MS MS.VSCC" (we add the ms-help:// prefix for you). Opens the MS MS.VSCC collection.
Example2: "ms-help://MS.VSCC/vsccCommon/html/vsccCommon_Start_Page.htm"
Opens the MS MS.VSCC collection at a given path.
Example3: "c:\path\myhelp.hxS" - If the full path to a .HxS file is provided then we create a temporary namespace so the help file can be viewed.

FilterName [IN]: Name of the Filter to select from the Filter drop down or '' (an empty string). The filter name must be defined in the current collection and must have a valid Filter Query string associated with it. If invalid then we open with no filter applied.

FilterQuery [IN]: Filter Query string to use when opening collection or '' (an empty string).

Normally you would not specify both a FilterName and FilterQuery at the same time. Have one or the other or none. When not used set to empty string.

URL:

Property: URL [String, Read/Write]

Use URL to Set or Get the browsers URL. Anything that can be entered into the Internet Explorer URL address line is appropriate here. When setting URL= we also auto-sync the Table Of Contents control if the item exists in the TOC.

Property: CurrentNS [String, Read Only]

Returns the Current namespace name.
EG. If ms-help://MS.VSCC is loaded the CurrentNS returns MS.VSCC


FilterName (Param2):

Property FilterName [String, Read Only]

Use FilterName to Set or Get the Current Filter name for the current collection. Setting Filtername="XYZ" will have no effect if the current collection does not contain a filter "XYZ" or no collection is opened. Set Filter="" (empty string) to set Filtering Off for the current collection. If (GET) Filter returns an empty string then no filter is currently set for the current collection.


FilterQuery (Param2):

Property FilterQuery [String, Read Only]

Similar to FilterName above but instead of referencing the Query string indirectly via the associated QueryName you can Set or Get the Filter Query string directly. This string can be any valid query string (as you would define one in the Filter Edit dialog).

Namespace (Param1):

Search Term (Param2):

NavDataMoniker (Param3):

FilterQuery (Param4) (*=current):

Options (Param5):

Method: QueryForURL(Namespace, SearchTerm, NavDataMoniker, FilterQuery, Options): String

Performs a query on the current Collection and returns a string that contains the URL of the first topic in the results list. The query can be based on an index, full-text search, attribute, or context identifier.

The QueryForURL returns an empty string if

  • The Namespace provided is invalid.
  • No Namespace is provided and there is no Namespace currently loaded in the editor.
  • The query produces zero results.

Namespace [IN]: Namespace to perform query on.
Set this to an empty string to search the currently opened collection.
Set to a valid Namespace name (EG. MS.VSCC) to create a new temporary Session and search that. If an invalid NS is used then search result will be empty string.

SearchTerm [IN]: Text to search for.

NavDataMoniker [IN]: Moniker specifies which part of the collection to search:
!DefaultKeywordIndex -- Default keyword index (KLinks).
!DefaultAssociativeIndex -- Default associative index (ALinks).
!DefaultNamedURLIndex -- Named URLs Index (HomePage, DefaultPage etc)
!DefaultFullTextSearch -- Full-text search index.
!DefaultContextWindowIndex -- Default context window index, if one exists.
!SampleInfo -- Performs a query on the Sample Index.
!DefaultToc -- Performs a query on the Default TOC.

FilterQuery [IN]: Restrict the scope of the Query by defining a Filter Query String. Set to an empty string to use no filtering in the query.
EG. "DocSet" = "C#" OR ("DocSet" = "MSDN" AND "ProductVers" = "C#")
Note: If Namespace is not specified then you can set FilterQuery="*" (character *) to mean use the current filter query.

Options [IN]: Integer value, Normally set to 0 (zero).
0 -- No Options,
1 -- For FullTextSearch. Restricts search to topic titles.
2 -- For FullTextSearch. Enable Stemming. Enables run-time stemming, for example, a search on "print" would also return "printing," "printed," "prints," and so on.
3 -- For FullTextSearch. Search Previous Results. Searches previous results.
10 -- For KeywordSearch. Causes a keyword search to be case sensitive
 

Keyword:

Method: Index(Keyword)

Equivalent to selecting the Index navigation page, typing in a Keyword and pressing Enter.

Keyword [IN]: Keyword (K Index) or partial keyword to search for.

Search String:

Method: Search(SearchStr)

Equivalent to selecting the Search navigation page, typing in a SearchStr and pressing Enter.

SearchStr [IN]: Text string to search for.

Page# (must be 1, 2, 3 or 4):

Method: PageTab(PageNum)

Equivalent to selecting a navigation page tab.

PageNum [IN]: Navigation Page to select.
1=Contents, 2=Index, 3=Search, 4=Favs
Example: PageTab(2) = Selects Index Page