DocumentManager.Close Method

Closes an open document window.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

'宣言
Public Overridable Function Close ( _
    closeFlag As __FRAMECLOSE _
) As Integer
'使用
Dim instance As DocumentManager
Dim closeFlag As __FRAMECLOSE
Dim returnValue As Integer

returnValue = instance.Close(closeFlag)
public virtual int Close(
    __FRAMECLOSE closeFlag
)
public:
virtual int Close(
    __FRAMECLOSE closeFlag
)
public function Close(
    closeFlag : __FRAMECLOSE
) : int

Parameters

Return Value

Type: System.Int32

Returns E_FAIL if the project node is null, or if the project node' project manager (a ProjectNode, which handles the persistent state of the project) is a null reference (Nothing in Visual Basic) or closed. Returns another error code if it fails to close the window. If all is well, returns S_OK.

Remarks

Using the internal [GetDocInfo] method, this method retrieves information on the state of the document (whether or not it is dirty, whether or not it should be saved if dirty, whether or not the file was opened by the current project) as well as a IVsPersistDocData pointer to the document. It then gets a IVsUIShellOpenDocument pointer to the SVsUIShellOpenDocument service. The method uses this service to call [M:Microsoft.VisualStudio.IVsUIShellOpenDocument.IsDocumentOpen(T:Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy pHierCaller, uint itemidCaller, string pszMkDocument, ref System.Guid rguidLogicalView, uint grfIDO, out T:Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy ppHierOpen, uint[] pitemidOpen, out T:Microsoft.VisualStudio.Package.IVsWindowFrame ppWindowFrame, out int pfOpen)] in order to get a handle to the correct window frame, and uses the window frame to call [M:Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.CloseFrame(uint grfSaveOptions)] with the specified close flags.

Permissions

See Also

Reference

DocumentManager Class

DocumentManager Members

Microsoft.VisualStudio.Package Namespace