给定 URL 返回该目录以前的 URL。
命名空间: Microsoft.VisualStudio.VSHelp80
程序集: Microsoft.VisualStudio.VSHelp80(在 Microsoft.VisualStudio.VSHelp80.dll 中)
语法
声明
Function GetPrevTopic ( _
bstrURL As String _
) As String
string GetPrevTopic(
string bstrURL
)
String^ GetPrevTopic(
[InAttribute] String^ bstrURL
)
abstract GetPrevTopic :
bstrURL:string -> string
function GetPrevTopic(
bstrURL : String
) : String
参数
bstrURL
类型:String字符串包含与 Internet Explorer 兼容当前主题的 URL。
返回值
类型:String
返回包含前面的主题的 URL 的字符串在目录中。
示例
创建 Visual Studio 外接程序使用 Visual C# 如 如何:创建外接程序所述。 添加对 Microsoft.VisualStudio.VSHelp、 Microsoft.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);
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。