共用方式為


IVsAddProjectItemDlg2.AddNewProjectItem Method

Definition

Adds a new project item.

public:
 int AddNewProjectItem(System::UInt32 itemidLoc, Guid % rguidProject, Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, System::UInt32 grfEditorFlags, Guid % rguidEditorType, System::String ^ pszPhysicalView, Guid % rguidLogicalView, System::String ^ pszItemName, [Runtime::InteropServices::Out] System::String ^ % pbstrFileToAdd);
public int AddNewProjectItem (uint itemidLoc, ref Guid rguidProject, Microsoft.VisualStudio.Shell.Interop.IVsProject pProject, uint grfEditorFlags, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidLogicalView, string pszItemName, out string pbstrFileToAdd);
abstract member AddNewProjectItem : uint32 * Guid * Microsoft.VisualStudio.Shell.Interop.IVsProject * uint32 * Guid * string * Guid * string * string -> int
Public Function AddNewProjectItem (itemidLoc As UInteger, ByRef rguidProject As Guid, pProject As IVsProject, grfEditorFlags As UInteger, ByRef rguidEditorType As Guid, pszPhysicalView As String, ByRef rguidLogicalView As Guid, pszItemName As String, ByRef pbstrFileToAdd As String) As Integer

Parameters

itemidLoc
UInt32

[in] Item identifier of the folder in the project to which items should be added.

rguidProject
Guid

[in] Unique identifier of the project.

pProject
IVsProject

[in] Pointer to the IVsProject3 interface on which the Add Item will be called.

grfEditorFlags
UInt32

[in] Flags whose values are taken from the __VSSPECIFICEDITORFLAGS enumeration.

rguidEditorType
Guid

[in] Editor type with which to open (if supported).

pszPhysicalView
String

[in] Physical view with which to open (if supported).

rguidLogicalView
Guid

[in] Logical view with which to open (if supported).

pszItemName
String

[in] Template file name.

pbstrFileToAdd
String

[in, out] File name to add.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsAddProjectItemDlg2::AddNewProjectItem(  
   [in] VSITEMID itemidLoc,  
   [in] REFGUID rguidProject,  
   [in] IVsProject *pProject,  
   [in] VSSPECIFICEDITORFLAGS grfEditorFlags,  
   [in] REFGUID rguidEditorType,  
   [in] LPCOLESTR pszPhysicalView,  
   [in] REFGUID rguidLogicalView,  
   [in] LPCOLESTR pszItemName,  
   [in,out] BSTR *pbstrFileToAdd  
);  

Applies to