Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Interfaces
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.

IFileOperationProgressSink Members

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

Remarks

When to Implement

Applications must implement IFileOperationProgressSink themselves. Microsoft 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);
}

Interface Information

Minimum DLL Version None
Custom ImplementationYes
Inherits fromIUnknown
Header and IDL filesshobjidl.h, shobjidl.idl
Minimum operating systems Windows Vista

See Also

IFileOperation
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker