共用方式為


IVsSolution.CloseSolutionElement(UInt32, IVsHierarchy, UInt32) Method

Definition

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

public:
 int CloseSolutionElement(System::UInt32 grfCloseOpts, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::UInt32 docCookie);
public:
 int CloseSolutionElement(unsigned int grfCloseOpts, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, unsigned int docCookie);
int CloseSolutionElement(unsigned int grfCloseOpts, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHier, unsigned int docCookie);
public int CloseSolutionElement (uint grfCloseOpts, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint docCookie);
abstract member CloseSolutionElement : uint32 * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 -> int
Public Function CloseSolutionElement (grfCloseOpts As UInteger, pHier As IVsHierarchy, docCookie As UInteger) As Integer

Parameters

grfCloseOpts
UInt32

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

pHier
IVsHierarchy

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

docCookie
UInt32

[in] Document that was closed. This value is returned from the running document table, by calling GetDocumentInfo(UInt32, UInt32, UInt32, UInt32, String, IVsHierarchy, UInt32, IntPtr).

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolution::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).

Applies to