次の方法で共有


Help2.SearchEx(String, String, UInt32) Method

Definition

Selects the Search window and optionally fills the Search dialog box with a term or executes a search for a specific term.

public:
 void SearchEx(System::String ^ bstrSearchFilterTransform, System::String ^ pszSearchTerm, System::UInt32 vssfSearchFlags);
public:
 void SearchEx(Platform::String ^ bstrSearchFilterTransform, Platform::String ^ pszSearchTerm, unsigned int vssfSearchFlags);
void SearchEx(std::wstring const & bstrSearchFilterTransform, std::wstring const & pszSearchTerm, unsigned int vssfSearchFlags);
[System.Runtime.InteropServices.DispId(28)]
public void SearchEx (string bstrSearchFilterTransform, string pszSearchTerm, uint vssfSearchFlags);
[<System.Runtime.InteropServices.DispId(28)>]
abstract member SearchEx : string * string * uint32 -> unit
Public Sub SearchEx (bstrSearchFilterTransform As String, pszSearchTerm As String, vssfSearchFlags As UInteger)

Parameters

bstrSearchFilterTransform
String

Not used. Pass in null.

pszSearchTerm
String

A string containing the search term.

vssfSearchFlags
UInt32

Values defined in __vsSearchFlags.

Attributes

Examples

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;  
    HelpSearchExexample(_applicationObject);  
}  

public void HelpSearchExexample(DTE2 dte)  
{  
    // This add-in searches for Help topics on automation.  
    try  
    {  
        Microsoft.VisualStudio.VSHelp80.Help2 help2 =  
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");  

        // Start a search on the keyword, automation.  
        help2.SearchEx(null, "automation", 1);  
    }  

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

Applies to