This documentation is archived and is not being maintained.

Help2.GetPrevTopic Method

Given a URL returns the previous URL in the table of contents.

Namespace: Microsoft.VisualStudio.VSHelp80
Assembly: Microsoft.VisualStudio.VSHelp80 (in microsoft.visualstudio.vshelp80.dll)

string GetPrevTopic (
	[InAttribute] string bstrURL
)
String GetPrevTopic (
	/** @attribute InAttribute() */ String bstrURL
)
function GetPrevTopic (
	bstrURL : String
) : String

Parameters

bstrURL

String containing the URL of the current topic that is compatible with Internet Explorer.

Return Value

Returns a string containing the URL of the previous topic in the table of contents.

Create a Visual Studio add-in by using Visual C# as described in How to: Create an Add-in. Add references to Microsoft.VisualStudio.VSHelp, Microsoft.VisualStudio.VSHelp80, and System.Windows.Forms. Replace the code in the OnConnection method in the Connect.cs file with the following code. Run the code example as described in How to: Compile and Run the Automation Object Model Code Examples.

using System;
using Extensibility;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.VSHelp;
using Microsoft.VisualStudio.VSHelp80;
using System.Windows.Forms;

public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    HelpGetPrevURLExample(_applicationObject);
}

public void HelpGetPrevURLExample(DTE2 dte)
{
    // Returns and displays the URL of the topic that precedes
    // the topic specified
    // by the URL in the table of contents.
    try
    {
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject("Help2");

        // Get the URL of the topic that precedes 
        // Introducing Visual Studio 
        // and display it.
        MessageBox.Show("The previous URL before the supplied one is " 
+ "\n" + help2.GetPrevTopic
("ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en
/dv_vstoc/html/99997089-56ff-4d60-81a9-447062dc98ac.htm"));

    }
    catch (SystemException ex)
    {
        MessageBox.Show("ERROR: " + ex);
    }
}
Show: