This documentation is archived and is not being maintained.

IVsUIShellOpenDocument.OpenDocumentViaProjectWithSpecific Method

Finds a specified project to open this document.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in

int OpenDocumentViaProjectWithSpecific (
	[InAttribute] string pszMkDocument,
	[InAttribute] uint grfEditorFlags,
	[InAttribute] ref Guid rguidEditorType,
	[InAttribute] string pszPhysicalView,
	[InAttribute] ref Guid rguidLogicalView,
	out IServiceProvider ppSP,
	out IVsUIHierarchy ppHier,
	out uint pitemid,
	out IVsWindowFrame ppWindowFrame
int OpenDocumentViaProjectWithSpecific (
	/** @attribute InAttribute() */ String pszMkDocument, 
	/** @attribute InAttribute() */ UInt32 grfEditorFlags, 
	/** @attribute InAttribute() */ /** @ref */ Guid rguidEditorType, 
	/** @attribute InAttribute() */ String pszPhysicalView, 
	/** @attribute InAttribute() */ /** @ref */ Guid rguidLogicalView, 
	/** @attribute OutAttribute() */ /** @ref */ IServiceProvider ppSP, 
	/** @attribute OutAttribute() */ /** @ref */ IVsUIHierarchy ppHier, 
	/** @attribute OutAttribute() */ /** @ref */ UInt32 pitemid, 
	/** @attribute OutAttribute() */ /** @ref */ IVsWindowFrame ppWindowFrame
JScript does not support passing value-type arguments by reference.



[in] String form of the unique moniker identifier of the document in the project system. If the document is a file, you can simply specify the file extension for this parameter rather than the full path to the file (for example, .bmp or txt). In non-file cases, this identifier is often in the form of a URL.


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


[in] Unique identifier of the editor type.


[in] Unique identifier of the physical view.


[in] Unique identifier of the logical view. If the editor implements IVsMultiViewDocumentView on the document view object, then the value passed into the rguidLogicalView parameter determines which view is activated when the editor window is shown, when the editor is instantiated. By specifying the logical view GUID, you can request the specific view that matches the reason you are requesting the view. For example, specify LOGVIEWID_Debugging to get the view appropriate for debugging, or LOGVIEWID_TextView to get the view appropriate for the text editor (that is, a view that implements IVsCodeWindow).


[out] Pointer to the IServiceProvider interface.


[out] Pointer to the IVsUIHierarchy interface of the project that can open the document.


[out] Pointer to the hierarchy item identifier of the document in the project. For more information see VSITEMID.


[out, retval] Pointer to the window frame that contains the editor. For more information, see IVsWindowFrame.

Return Value

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

COM Signature

From vsshell.idl:

HRESULT IVsUIShellOpenDocument::OpenDocumentViaProjectWithSpecific(
   [in] LPCOLESTR pszMkDocument,
   [in] REFGUID rguidEditorType,
   [in] LPCOLESTR pszPhysicalView,
   [in] REFGUID rguidLogicalView,
   [out] IServiceProvider **ppSP,
   [out] IVsUIHierarchy **ppHier,
   [out] VSITEMID *pitemid,
   [out, retval] IVsWindowFrame **ppWindowFrame

This method is used by VSPackages that are not projects that need to open a document in a specific editor, but do not care which project opens the file. To call this method from your VSPackage, you need to know exactly which editor factory you want and exactly which window you want the editor factory to create (that is, the physical view). The logical view specified in the rguidLogicalView parameter further allows you to specify which tab should be displayed by the editor if the editor implements IVsMultiViewDocumentView.

This method calls OpenItem. If no project can service the file and the Miscellaneous Files project is not already present, the environment then creates the Miscellaneous Files project and tries again.