Compartir a través de


IVsRunningDocumentTable2.QueryCloseRunningDocument(String, Int32) Method

Definition

Closes the specified document, with possible confirmation, if it is open in an incompatible editor.

public:
 int QueryCloseRunningDocument(System::String ^ pszMkDocument, [Runtime::InteropServices::Out] int % pfFoundAndClosed);
int QueryCloseRunningDocument(std::wstring const & pszMkDocument, [Runtime::InteropServices::Out] int & pfFoundAndClosed);
public int QueryCloseRunningDocument (string pszMkDocument, out int pfFoundAndClosed);
abstract member QueryCloseRunningDocument : string * int -> int
Public Function QueryCloseRunningDocument (pszMkDocument As String, ByRef pfFoundAndClosed As Integer) As Integer

Parameters

pszMkDocument
String

[in] The path to the document to close.

pfFoundAndClosed
Int32

[out] Returns non-zero (TRUE) if the document was found and closed; otherwise, returns zero (FALSE). See Remarks.

Returns

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

Remarks

COM Signature

From vsshell80.idl:

HRESULT QueryCloseRunningDocument(  
   [in] LPCOLESTR pszMkDocument,  
   [out] BOOL *pfFoundAndClosed  
);  

This method is called after a document has been opened in an editor that turns out to be incompatible with the document. This method closes the document automatically unless certain conditions exist, in which case, the user is prompted to close the document. The following list indicates what happens when this method is called.

  • If the document is not in the running document table (RDT), then this method sets the pfFoundAndClosed parameter to zero (FALSE) and returns S_OK.

  • If the document is in the RDT and has only read locks, then the document is automatically closed.

  • If the document is in the RDT and has edit locks, then the user is prompted to close the file.

  • If the user chooses not to close the document, then this method sets the pfFoundAndClosed parameter to zero (FALSE) and returns OLE_E_PROMPTSAVECANCELLED.

  • If the document is actually closed, then this method sets the pfFoundAndClosed parameter to non-zero (TRUE) and returns S_OK.

Applies to