共用方式為


IVsComponentUser Interface

Definition

Adds components to a specified project.

public interface class IVsComponentUser
public interface class IVsComponentUser
__interface IVsComponentUser
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("910035B1-D8BE-403A-975E-E4FB68CE40A1")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsComponentUser
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("910035B1-D8BE-403A-975E-E4FB68CE40A1")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsComponentUser
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("910035B1-D8BE-403A-975E-E4FB68CE40A1")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsComponentUser = interface
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("910035B1-D8BE-403A-975E-E4FB68CE40A1")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsComponentUser = interface
Public Interface IVsComponentUser
Attributes

Remarks

IVsComponentUser is used in conjunction with IVsComponentSelectorDlg. A package that wants to use the component selector dialog would implement IVsComponentUser and pass it to the SVsComponentSelectorDlg service.

The environment provides the default implementation that is used by the standard Add Reference dialog box.

You implement IVsComponentUser on your hierarchy node, then call IVsComponentSelectorDlg with an appropriate filter from the __VSCOMPSELFLAGS enumeration, pass in your node's IVsComponentUser interface, a GUID_NULL for the show-only page (or GUID_COMPlusPage if that's the one you want on top), null if you want to enumerate on the local machine, an array of VSCOMPONENTSELECTORTABINIT values, your file filter, and a BSTR to set the initial directory and store it on return.

The following are the steps to using the IVsComponentUser interface.

  1. The use selects AddReference which calls the Hierarchy's IOleCommandTarget for AddReference.

  2. The command implementation does a QueryService for SVsComponentSelectorDlg to find IVsComponentSelectorDlg and then calls IVsComponentSelectorDlg with its implementation of IVsComponentUser.

  3. The user selects references to add and clicks the Add button on the dialog.

  4. The dialog calls back on AddComponent.

  5. The hierarchy's implementation of AddComponent visually adds the reference and physically adds it to the project.

Only projects that support references need to implement this interface.

Notes to Implementers

Implemented by any VSPackage that wants to use the Component Selector Dialog, such as a Project System that will allow the user to add references to .Net assemblies.

Methods

AddComponent(VSADDCOMPOPERATION, UInt32, IntPtr[], IntPtr, VSADDCOMPRESULT[])

Used by the environment to add components specified by the user in the Component Selector dialog to the specified project.

Applies to