Compartilhar via


IVsEditorFactoryNotify.NotifyItemAdded Method

Definition

Method called when a new file (cloned from a template or existing file) is added to the project.

public:
 int NotifyItemAdded(System::UInt32 grfEFN, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::UInt32 itemid, System::String ^ pszMkDocument);
public:
 int NotifyItemAdded(unsigned int grfEFN, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, unsigned int itemid, Platform::String ^ pszMkDocument);
int NotifyItemAdded(unsigned int grfEFN, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHier, unsigned int itemid, std::wstring const & pszMkDocument);
public int NotifyItemAdded (uint grfEFN, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint itemid, string pszMkDocument);
abstract member NotifyItemAdded : uint32 * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * string -> int
Public Function NotifyItemAdded (grfEFN As UInteger, pHier As IVsHierarchy, itemid As UInteger, pszMkDocument As String) As Integer

Parameters

grfEFN
UInt32

[in] An EFNFLAGS value indicating the file's origin and how to add it. Bit flags constructed with values from the __EFNFLAGS enumeration.

pHier
IVsHierarchy

[in] Pointer to the IVsHierarchy of the project to add the item to.

itemid
UInt32

[in] The item ID (VSITEMID) of the file being added.

pszMkDocument
String

[in] Pointer to a string containing the path and file name.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsEditorFactoryNotify::NotifyItemAdded(  
   [in] EFNFLAGS grfEFN,   
   [in] IVsHierarchy *pHier,   
   [in] VSITEMID itemid,   
   [in] LPCOLESTR pszMkDocument  
);  

Notes to Implementers

Implementations must appropriately set VSHPROPID_ItemSubType on the project item. Implementations may also perform other processing on the file or set other project state as appropriate.

Call this method just after cloning the template file but before opening the editor or calling the OnAfterAddFiles(IVsProject, Int32, String[]) method of the IVsTrackProjectDocuments2 interface.

Applies to