ProjectNode.AddItem Method

Adds an item to the project.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

'宣言
Public Overridable Function AddItem ( _
    itemIdLoc As UInteger, _
    op As VSADDITEMOPERATION, _
    itemName As String, _
    filesToOpen As UInteger, _
    files As String(), _
    dlgOwner As IntPtr, _
    result As VSADDRESULT() _
) As Integer
'使用
Dim instance As ProjectNode
Dim itemIdLoc As UInteger
Dim op As VSADDITEMOPERATION
Dim itemName As String
Dim filesToOpen As UInteger
Dim files As String()
Dim dlgOwner As IntPtr
Dim result As VSADDRESULT()
Dim returnValue As Integer

returnValue = instance.AddItem(itemIdLoc, _
    op, itemName, filesToOpen, files, _
    dlgOwner, result)
public virtual int AddItem(
    uint itemIdLoc,
    VSADDITEMOPERATION op,
    string itemName,
    uint filesToOpen,
    string[] files,
    IntPtr dlgOwner,
    VSADDRESULT[] result
)
public:
virtual int AddItem(
    unsigned int itemIdLoc, 
    VSADDITEMOPERATION op, 
    String^ itemName, 
    unsigned int filesToOpen, 
    array<String^>^ files, 
    IntPtr dlgOwner, 
    array<VSADDRESULT>^ result
)
public function AddItem(
    itemIdLoc : uint, 
    op : VSADDITEMOPERATION, 
    itemName : String, 
    filesToOpen : uint, 
    files : String[], 
    dlgOwner : IntPtr, 
    result : VSADDRESULT[]
) : int

Parameters

  • itemIdLoc
    Type: System.UInt32

    Identifier of the container folder for the item being added. Should be VSITEMID_ROOT or other valid item identifier. Note that this parameter is currently ignored because only adding items as children of a project node is supported. Projects that support folders will want to add the items relative to itemidLoc.

  • filesToOpen
    Type: System.UInt32

    Number of items in files to open. Can be zero. This must be 1 if op is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENDIRECTORY. If VSADDITEMOP_RUNWIZARD, it must be 1 or 2. See VSADDITEMOPERATION.

  • files
    Type: []

    Array of file name strings. If op is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENFILE, the first item (files[0]) in the array is the name of the file to clone or the directory to open. If it is VSADDITEMOP_RUNWIZARD, the first item (files [0]) is the name of the wizard to run, and the second item (files [1]) is the file name the user supplied (same as itemName). See VSADDITEMOPERATION.

  • dlgOwner
    Type: System.IntPtr

    Handle to the Add Item dialog box.

  • result
    Type: []

    Array of VSADDRESULT enumerations indicating whether the item was successfully added to the project.

Return Value

Type: System.Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

IVsProject3.AddItem(UInt32, VSADDITEMOPERATION, String, UInt32, [], IntPtr, [])
IVsProject2.AddItem(UInt32, VSADDITEMOPERATION, String, UInt32, [], IntPtr, [])
IVsProject.AddItem(UInt32, VSADDITEMOPERATION, String, UInt32, [], IntPtr, [])

Permissions

See Also

Reference

ProjectNode Class

ProjectNode Members

Microsoft.VisualStudio.Package Namespace