IVsProject2::OpenItem Method (UInt32, Guid, IntPtr, IVsWindowFrame^)
Opens an item in the project.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int OpenItem( unsigned int itemid, [InAttribute] Guid% rguidLogicalView, IntPtr punkDocDataExisting, [OutAttribute] IVsWindowFrame^% ppWindowFrame )
Parameters
- itemid
-
Type:
System::UInt32
[in] Identifier of the item to open. Should be VSITEMID_ROOT or other valid item identifier. See the VSITEMID enumeration.
- rguidLogicalView
-
Type:
System::Guid
[in] Unique identifier of the logical view. If not GUID_NULL, indicates a specific type of view to create. For more information, see the LOGVIEWID.
- punkDocDataExisting
-
Type:
System::IntPtr
[in] Pointer to the document data object of the item to open. If the caller of OpenItem had a pointer to the document data object, it would pass it in the punkDocDataExisting parameter. If the caller knew that the document data object was not open, it would pass null. If the caller did not know if the document data object was open or if it did not want to look it up in the running document table (RDT) to find out, then it could pass in DOCDATAEXISTING_UNKNOWN. If this value is passed, then OpenStandardEditor will look up the value in the RDT by calling FindAndLockDocument (RDT_EditLock) to determine whether the file (DocData) is already open.
- ppWindowFrame
-
Type:
Microsoft.VisualStudio.Shell.Interop::IVsWindowFrame^
[out] Pointer to the IVsWindowFrame interface.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From vsshell.idl:
HRESULT IVsProject2::OpenItem( [in] VSITEMID itemid, [in] REFGUID rguidLogicalView, [in] IUnknown *punkDocDataExisting, [out] IVsWindowFrame **ppWindowFrame );
By implementing IVsProjectSpecificEditorMap2 Interface on your project object, you can do project-specific handling of files. That is, you can support either opening the file in a project-specific editor or allowing the global editor to open the item. Opening an item requires launching an editor using OpenStandardEditor or OpenSpecificEditor, depending on the handling you want to implement. For more information, see GetSpecificEditorProperty.
Note |
|---|
In your implementation of OpenItem, do not call Show on the window frame you return in ppWindowFrame. |
Compare to ReopenItem method.
