IVsSolution2::CloseSolutionElement Method (UInt32, IVsHierarchy^, UInt32)

 

Programmatically closes a document, a project, or the entire solution.

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

int CloseSolutionElement(
	unsigned int grfCloseOpts,
	IVsHierarchy^ pHier,
	unsigned int docCookie
)

Parameters

grfCloseOpts
Type: System::UInt32

[in] Close options for the solution (.sln) file. For a list of grfCloseOpts values, see __VSSLNCLOSEOPTIONS.

pHier
Type: Microsoft.VisualStudio.Shell.Interop::IVsHierarchy^

[in] Pointer to the IVsHierarchy interface of the document to close.

docCookie
Type: System::UInt32

[in] Document that was closed. This value is returned from the running document table, by calling GetDocumentInfo.

Return Value

Type: System::Int32

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

From vsshell.idl:

HRESULT IVsSolution2::CloseSolutionElement(
   [in] VSSLNCLOSEOPTIONS grfCloseOpts, 
   [in] IVsHierarchy *pHier, 
   [in] VSCOOKIE docCookie
);

To close the entire solution, call CloseSolutionElement(grfCloseOpts, null, null). To close a single project, call CloseSolutionElement(grfCloseOpts, phier, null). To close a single document, call CloseSolutionElement(grfCloseOpts, null, docCookie).

Return to top
Show: