SuspendFileEvents Method

Suspends all events for a particular file or directory until all of its handles have been closed.


int SuspendFileEvents();
INT SuspendFileEvents();


Applications can call this method from an AfterCreateFile or AfterOpenFile event to suspend all further events for the file or directory that the event fired for. The suspension will remain in effect until all handles to said file or directory have been closed, at which point the class will once again fire events for it (if it is accessed again).

Typically, this method should only be used as a "last resort"; that is, when the application cannot achieve the same outcome through the use of more granular standard filter rules. Said another way, it is almost always more efficient for an application to exclude files and/or directories implicitly using standard filter rules, if possible, than it is to exclude them explicitly using this method.

Note: This method can only be called within the AfterCreateFile and AfterOpenFile events

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Filter 2020 C++ Edition - Version 20.0 [Build 7836]