IFileOperationProgressSink interface

Exposes methods that provide a rich notification system used by callers of IFileOperation to monitor the details of the operations they are performing through that interface.

Inheritance

The IFileOperationProgressSink interface inherits from the IUnknown interface. IFileOperationProgressSink also has these types of members:

Methods

The IFileOperationProgressSink interface has these methods.

Method Description
IFileOperationProgressSink::PauseTimer Not supported.
IFileOperationProgressSink::PostCopyItem Performs caller-implemented actions after the copy process for each item is complete.
IFileOperationProgressSink::PostDeleteItem Performs caller-implemented actions after the delete process for each item is complete.
IFileOperationProgressSink::PostMoveItem Performs caller-implemented actions after the move process for each item is complete.
IFileOperationProgressSink::PostNewItem Performs caller-implemented actions after the new item is created.
IFileOperationProgressSink::PostRenameItem Performs caller-implemented actions after the rename process for each item is complete.
IFileOperationProgressSink::PreCopyItem Performs caller-implemented actions before the copy process for each item begins.
IFileOperationProgressSink::PreMoveItem Performs caller-implemented actions before the move process for each item begins.
IFileOperationProgressSink::PreNewItem Performs caller-implemented actions before the process to create a new item begins.
IFileOperationProgressSink::ResetTimer Not supported.
IFileOperationProgressSink::ResumeTimer Not supported.
IFileOperationProgressSink::UpdateProgress Provides an estimate of the total amount of work currently done in relation to the total amount of work.
IFileOperationProgressSink::FinishOperations Performs caller-implemented actions after the last operation performed by the call to IFileOperation is complete.
IFileOperationProgressSink::PreDeleteItem Performs caller-implemented actions before the delete process for each item begins.
IFileOperationProgressSink::PreRenameItem Performs caller-implemented actions before the rename process for each item begins.
IFileOperationProgressSink::StartOperations Performs caller-implemented actions before any specific file operations are performed.

Remarks

When to Implement

Applications must implement IFileOperationProgressSink themselves. Windows does not provide a default implementation.

When to Use

IFileOperationProgressSink are essentially handlers for particular events. They are used normally to display information about the specific action being processed at that time, such as the name of a file, source and destination, and the new name of the item at the destination. Post methods receive the HRESULT of each part of the operation so that the caller can determine specifically where the process fails if it does. IFileOperation method parameter values are passed to the appropriate IFileOperationProgressSink methods so that they have access to the same information.

To attach an implementation of IFileOperationProgressSink to a call to IFileOperation, you have two options:

If you call Advise there is no need to pass IFileOperationProgressSink to specific IFileOperation methods as that results in redundant calls to the IFileOperationProgressSink methods and duplicate notifications.

If you choose to pass IFileOperationProgressSink only to select methods, the same instance of IFileOperationProgressSink can be used for them all.

Example

The following example passes IFileOperationProgressSink to an instance of IFileOperation by calling the Advise method.
IFileOperation *pfo;
CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL, IID_IFileOperation, (void **)&m_pFO)
HRESULT hr = SHCreateFileOperation(hwnd, 0, IID_PPV_ARGS(&pfo));
if (SUCCEEDED(hr))
{
    // Advise to get notifications
    DWORD dwCookie;
    hr = pfo->Advise(SAFECAST(this, IFileOperationProgressSink*), &dwCookie);
}

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also

IFileOperation