IVsFileChangeEx.SyncFile(String) 方法

定义

强制发送更改事件。 与结合使用 IgnoreFile(UInt32, String, Int32) 以进行文件更改,但不接收通知。

public:
 int SyncFile(System::String ^ pszMkDocument);
public:
 int SyncFile(Platform::String ^ pszMkDocument);
int SyncFile(std::wstring const & pszMkDocument);
public int SyncFile (string pszMkDocument);
abstract member SyncFile : string -> int
Public Function SyncFile (pszMkDocument As String) As Integer

参数

pszMkDocument
String

中项目系统中文档的名字对象标识符的字符串格式。 对于文件文档,这始终是文件的路径。

返回

Int32

如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。

注解

COM 签名

从 vsshell:

HRESULT IVsFileChangeEx::SyncFile(  
   [in] LPCOLESTR pszMkDocument  
);  

IgnoreFile如果对文件进行更改并且不想接收更改通知,请将此方法与方法结合使用。 下面的示例对此进行了演示:

pFC->IgnoreFile(dwConnect, "MyFile.cpp", TRUE);  
SaveFile("MyFile.cpp");  
pFC->SyncFile("MyFile.cpp")  
// Forces the change events to be sent. This ensures the event will not be sent (asynchronously) to you after you stop ignoring the file.  
pFC->IgnoreFile(dwConnect, "MyFile.cpp", FALSE)  
// This indicates you are listening to the events again.  

适用于