Compartilhar via


IVsProject.OpenItem(UInt32, Guid, IntPtr, IVsWindowFrame) Method

Definition

Opens an item in the project.

public:
 int OpenItem(System::UInt32 itemid, Guid % rguidLogicalView, IntPtr punkDocDataExisting, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ % ppWindowFrame);
public int OpenItem (uint itemid, ref Guid rguidLogicalView, IntPtr punkDocDataExisting, out Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame ppWindowFrame);
abstract member OpenItem : uint32 * Guid * nativeint * IVsWindowFrame -> int
Public Function OpenItem (itemid As UInteger, ByRef rguidLogicalView As Guid, punkDocDataExisting As IntPtr, ByRef ppWindowFrame As IVsWindowFrame) As Integer

Parameters

itemid
UInt32

[in] Identifier of the item to open. Should be VSITEMID_ROOT or other valid item identifier. See the VSITEMID enumeration.

rguidLogicalView
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
IntPtr

nativeint

[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(UInt32, String, Guid, String, IVsUIHierarchy, UInt32, IntPtr, IServiceProvider, IVsWindowFrame) will look up the value in the RDT by calling FindAndLockDocument(UInt32, String, IVsHierarchy, UInt32, IntPtr, UInt32) (RDT_EditLock) to determine whether the file (document data object) is already open.

ppWindowFrame
IVsWindowFrame

[out] Pointer to the IVsWindowFrame interface.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProject::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.

Applies to