Help2.GetPrevTopic(String) 方法

定义

给定一个 URL,将返回目录中的上一个 URL。

public:
 System::String ^ GetPrevTopic(System::String ^ bstrURL);
public:
 Platform::String ^ GetPrevTopic(Platform::String ^ bstrURL);
std::wstring GetPrevTopic(std::wstring const & bstrURL);
[System.Runtime.InteropServices.DispId(15)]
public string GetPrevTopic (string bstrURL);
[<System.Runtime.InteropServices.DispId(15)>]
abstract member GetPrevTopic : string -> string
Public Function GetPrevTopic (bstrURL As String) As String

参数

bstrURL
String

包含与 Internet Explorer 兼容的当前主题的 URL 的字符串。

返回

String

返回一个字符串,该字符串包含目录中上一个主题的 URL。

实现

属性

示例

使用创建外接程序, Visual Studio Visual C# 如 如何:创建外接程序中所述。 添加对 Microsoft.VisualStudio.VSHelpMicrosoft.VisualStudio.VSHelp80 和的引用 System.Windows.Forms 。 将 OnConnection Connect.cs 文件中方法中的代码替换为以下代码。 按照 如何:编译和运行自动化对象模型代码示例中所述运行代码示例。

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);  
    }  
}  

适用于