Compartir a través de


IVsFileChangeEx.SyncFile Method

Forces change events to be sent. Used in conjunction with IgnoreFile to make file changes but not receive notification.

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

Syntax

'Declaration
Function SyncFile ( _
    pszMkDocument As String _
) As Integer
int SyncFile(
    string pszMkDocument
)
int SyncFile(
    [InAttribute] String^ pszMkDocument
)
abstract SyncFile : 
        pszMkDocument:string -> int
function SyncFile(
    pszMkDocument : String
) : int

Parameters

  • pszMkDocument
    Type: 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.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

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

Use this method in conjunction with IgnoreFile Method if you are making a change to the file and do not want to receive the change notification. This is shown in the following example:

   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.

.NET Framework Security

See Also

Reference

IVsFileChangeEx Interface

Microsoft.VisualStudio.Shell.Interop Namespace