共用方式為


IVsFileChangeEx.AdviseFileChange Method

Definition

Enables a client to receive notifications of changes to a file.

public:
 int AdviseFileChange(System::String ^ pszMkDocument, System::UInt32 grfFilter, Microsoft::VisualStudio::Shell::Interop::IVsFileChangeEvents ^ pFCE, [Runtime::InteropServices::Out] System::UInt32 % pvsCookie);
int AdviseFileChange(std::wstring const & pszMkDocument, unsigned int grfFilter, Microsoft::VisualStudio::Shell::Interop::IVsFileChangeEvents const & pFCE, [Runtime::InteropServices::Out] unsigned int & pvsCookie);
public int AdviseFileChange (string pszMkDocument, uint grfFilter, Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEvents pFCE, out uint pvsCookie);
abstract member AdviseFileChange : string * uint32 * Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEvents * uint32 -> int
Public Function AdviseFileChange (pszMkDocument As String, grfFilter As UInteger, pFCE As IVsFileChangeEvents, ByRef pvsCookie As UInteger) As Integer

Parameters

pszMkDocument
String

[in] String form of the moniker identifier of the document in the project system. In the case of documents that are files, this is always the path to the file. This parameter can also be used to specify documents that are not files.

grfFilter
UInt32

[in] Flags that indicate how the file has been changed. For more information, see _VSFILECHANGEFLAGS.

pFCE
IVsFileChangeEvents

[in] IVsFileChangeEvents Interface on the object requesting notification of file change events.

pvsCookie
UInt32

[out] Unique identifier for the file with which the event sink is associated. This value is used to unadvise the event sink using UnadviseFileChange(UInt32) Method.

Returns

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

Remarks

This method must be accessed on the main thread.

Applies to