Help2.SyncIndex(String, Int32) 方法

定义

查找由 K 关键字指定的主题,但除非指定,否则它不会显示文档资源管理器中的主题。

public:
 void SyncIndex(System::String ^ bstrKeyword, int fShow);
public:
 void SyncIndex(Platform::String ^ bstrKeyword, int fShow);
void SyncIndex(std::wstring const & bstrKeyword, int fShow);
[System.Runtime.InteropServices.DispId(19)]
public void SyncIndex (string bstrKeyword, int fShow);
[<System.Runtime.InteropServices.DispId(19)>]
abstract member SyncIndex : string * int -> unit
Public Sub SyncIndex (bstrKeyword As String, fShow As Integer)

参数

bstrKeyword
String

包含 K 关键字的字符串。

fShow
Int32

设置以强制打开 "索引" 窗口。

实现

属性

示例

使用创建外接程序, 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;  
    HelpSyncContentsexample(_applicationObject);  
}  

public void HelpSyncContentsexample(DTE2 dte)  
{  
    // This add-in synchronizes the Help index to   
    // the supplied index.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

        // Synchronize index.  
        help2.SyncIndex("FLT_RADIX constant", 1);  
    }  

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

适用于