IVsProject4::AddItem Method (UInt32, VSADDITEMOPERATION, String^, UInt32, array<String^>^, IntPtr, array<VSADDRESULT>^)
Creates new items in a project, adds existing files to a project, or causes Add Item wizards to be run.
Assembly: Microsoft.VisualStudio.Shell.Interop.10.0 (in Microsoft.VisualStudio.Shell.Interop.10.0.dll)
int AddItem( unsigned int itemidLoc, VSADDITEMOPERATION dwAddItemOperation, String^ pszItemName, unsigned int cFilesToOpen, array<String^>^ rgpszFilesToOpen, IntPtr hwndDlgOwner, array<VSADDRESULT>^ pResult )
Parameters
- itemidLoc
-
Type:
System::UInt32
[in] Identifier of the container folder for the item being added. Should be VSITEMID_ROOT or other valid item identifier. See the enumeration VSITEMID. Note that this parameter is currently ignored because only adding items as children of a project node is supported. Projects that support the notion of folders will want to add the items relative to itemidLoc.
- dwAddItemOperation
-
Type:
Microsoft.VisualStudio.Shell.Interop::VSADDITEMOPERATION
[in] Operation applied to the newly created item. See the enumeration VSADDITEMOPERATION.
- pszItemName
-
Type:
System::String^
[in] Name of the item to be added.
- cFilesToOpen
-
Type:
System::UInt32
[in] Number of items in rgpszFilesToOpen. Can be zero. This must be 1 if dwAddItemOperation is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENDIRECTORY. If VSADDITEMOP_RUNWIZARD, it must be 1 or 2.
- rgpszFilesToOpen
-
Type:
array<System::String^>^
[in, size_is(cFilesToOpen)] Array of pointers to OLESTR file names. If dwAddItemOperation is VSADDITEMOP_CLONEFILE or VSADDITEMOP_OPENDIRECTORY, the first item (rgpszFilesToOpen[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 (rgpszFilesToOpen[0]) is the name of the wizard to run, and the second item (rgpszFilesToOpen[1]) is the file name the user supplied (same as pszItemName).
- hwndDlgOwner
-
Type:
System::IntPtr
[in] Handle to the Add Item dialog box.
- pResult
-
Type:
array<Microsoft.VisualStudio.Shell.Interop::VSADDRESULT>^
[out, retval] Pointer to the VSADDRESULT enumeration indicating whether the item was successfully added to the project.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.