Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ***********************************************************************
- ' Author : ElektroStudios
- ' Modified : 30-March-2022
- ' ***********************************************************************
- #Region " Option Statements "
- Option Strict On
- Option Explicit On
- Option Infer Off
- #End Region
- #Region " Imports "
- Imports System.IO
- Imports System.Runtime.InteropServices
- Imports DevCase.Interop.Unmanaged.Win32.Enums
- #End Region
- #Region " IFileOperationProgressSink "
- ' ReSharper disable once CheckNamespace
- Namespace DevCase.Interop.Unmanaged.Win32.Interfaces
- ''' ----------------------------------------------------------------------------------------------------
- ''' Exposes methods that provide a rich notification system used by callers of <see cref="IFileOperation"/>
- ''' to monitor the details of the operations they are performing through that interface.
- ''' ----------------------------------------------------------------------------------------------------
- ''' <remarks>
- ''' <see href="https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ifileoperationprogresssink"/>
- ''' </remarks>
- ''' ----------------------------------------------------------------------------------------------------
- <ComImport>
- <Guid("04b0f1a7-9490-44bc-96e1-4296a31252e2")>
- <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
- Public Interface IFileOperationProgressSink
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before any specific file operations are performed.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function StartOperations() As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the last operation performed by the call to <see cref="IFileOperation"/> is complete.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="hrResult">
- ''' The return value of the final operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by one of the <see cref="IFileOperation"/> methods,
- ''' which simply queue the operations.
- ''' Instead, this is the result of the actual operation, such as copy, delete, or move.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- Sub FinishOperations(<MarshalAs(UnmanagedType.U4)> hrResult As HResult)
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before the rename process for each item begins.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that control the operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the item to be renamed.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the new display name of the item. This is a null-terminated, Unicode string.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' the rename operation and all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PreRenameItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the rename process for each item is complete.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that were used during the rename operation.
- ''' <para></para>
- ''' Some values can be set or changed during the rename operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the item before it was renamed.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the new display name of the item. This is a null-terminated, Unicode string.
- ''' <para></para>
- ''' Note that this might not be the name that you asked for, given collisions and other naming rules.
- ''' </param>
- '''
- ''' <param name="hrRename">
- ''' The return value of the rename operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by <see cref="IFileOperation.RenameItem"/>,
- ''' which simply queues the rename operation. Instead, this is the result of the actual rename operation.
- ''' </param>
- '''
- ''' <param name="psiNewlyCreated">
- ''' Pointer to an <see cref="IShellItem"/> that represents the item with its new name.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PostRenameItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String, <MarshalAs(UnmanagedType.U4)> hrRename As HResult, psiNewlyCreated As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before the move process for each item begins.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that control the operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the item to be moved..
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder to contain the moved item.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to a new name for the item in its new location. This is a null-terminated Unicode string and can be NULL.
- ''' <para></para>
- ''' If NULL, the name of the destination item is the same as the source.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' the move operation and all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PreMoveItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the move process for each item is complete.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that were used during the move operation.
- ''' <para></para>
- ''' Some values can be set or changed during the move operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the source item.
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder that contains the moved item.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the name that was given to the item after it was moved. This is a null-terminated Unicode string.
- ''' <para></para>
- ''' Note that this might not be the name that you asked for, given collisions and other naming rules.
- ''' </param>
- '''
- ''' <param name="hrMove">
- ''' The return value of the move operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by <see cref="IFileOperation.MoveItem"/>,
- ''' which simply queues the move operation. Instead, this is the result of the actual move.
- ''' </param>
- '''
- ''' <param name="psiNewlyCreated">
- ''' Pointer to an <see cref="IShellItem"/> that represents the moved item in its new location.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PostMoveItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String, <MarshalAs(UnmanagedType.U4)> hrMove As HResult, psiNewlyCreated As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before the copy process for each item begins.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that control the operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the source item.
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder to contain the copy of the item.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to a new name for the item after it has been copied. This is a null-terminated Unicode string and can be NULL.
- ''' <para></para>
- ''' If NULL, the name of the destination item is the same as the source.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' the copy operation and all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PreCopyItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the copy process for each item is complete.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that were used during the copy operation.
- ''' <para></para>
- ''' Some values can be set or changed during the copy operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the source item.
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder to which the item was copied.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the new name that was given to the item after it was copied. This is a null-terminated Unicode string.
- ''' <para></para>
- ''' Note that this might not be the name that you asked for, given collisions and other naming rules.
- ''' </param>
- '''
- ''' <param name="hrCopy">
- ''' The return value of the copy operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by <see cref="IFileOperation.CopyItem"/>,
- ''' which simply queues the copy operation. Instead, this is the result of the actual copy.
- ''' </param>
- '''
- ''' <param name="psiNewlyCreated">
- ''' Pointer to an <see cref="IShellItem"/> that represents the new copy of the item.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PostCopyItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String, <MarshalAs(UnmanagedType.U4)> hrCopy As HResult, psiNewlyCreated As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before the delete process for each item begins.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that control the operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the item to be deleted.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' the delete operation and all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PreDeleteItem(dwFlags As TransferSourceFlags, psiItem As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the delete process for each item is complete.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that were used during the delete operation.
- ''' <para></para>
- ''' Some values can be set or changed during the delete operation.
- ''' </param>
- '''
- ''' <param name="psiItem">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the item that was deleted.
- ''' </param>
- '''
- ''' <param name="hrDelete">
- ''' The return value of the delete operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by <see cref="IFileOperation.DeleteItem"/>,
- ''' which simply queues the delete operation. Instead, this is the result of the actual deletion.
- ''' </param>
- '''
- ''' <param name="psiNewlyCreated">
- ''' A pointer to an <see cref="IShellItem"/> that specifies the deleted item, now in the Recycle Bin.
- ''' <para></para>
- ''' If the item was fully deleted, this value is NULL.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PostDeleteItem(dwFlags As TransferSourceFlags, psiItem As IShellItem, <MarshalAs(UnmanagedType.U4)> hrDelete As HResult, psiNewlyCreated As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions before the process to create a new item begins.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that control the operation.
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder that will contain the new item.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the file name of the new item, for instance Newfile.txt. This is a null-terminated, Unicode string.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' this operation and all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PreNewItem(dwFlags As TransferSourceFlags, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Performs caller-implemented actions after the new item is created
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="dwFlags">
- ''' bitwise value that contains flags that were used during the creation operation.
- ''' <para></para>
- ''' Some values can be set or changed during the creation operation.
- ''' </param>
- '''
- ''' <param name="psiDestinationFolder">
- ''' Pointer to an <see cref="IShellItem"/> that specifies the destination folder to which the new item was added.
- ''' </param>
- '''
- ''' <param name="pszNewName">
- ''' Pointer to the file name of the new item, for instance Newfile.txt. This is a null-terminated, Unicode string.
- ''' </param>
- '''
- ''' <param name="pszTemplateName">
- ''' Pointer to the name of the template file (for example Excel9.xls) that the new item is based on,
- ''' stored in one of the following locations:
- ''' <para></para>
- ''' - CSIDL_COMMON_TEMPLATES. The default path for this folder is %ALLUSERSPROFILE%\Templates.
- ''' <para></para>
- ''' - CSIDL_TEMPLATES. The default path for this folder is %USERPROFILE%\Templates.
- ''' <para></para>
- ''' - %SystemRoot%\shellnew
- ''' <para></para>
- ''' This is a null-terminated, Unicode string used to specify an existing file of the same type as the new file,
- ''' containing the minimal content that an application wants to include in any new file.
- ''' <para></para>
- ''' This parameter is normally NULL to specify a new, blank file.
- ''' </param>
- '''
- ''' <param name="dwFileAttributes">
- ''' The file attributes applied to the new item.
- ''' </param>
- '''
- ''' <param name="hrNew">
- ''' The return value of the creation operation.
- ''' <para></para>
- ''' Note that this is not the <see cref="HResult"/> returned by <see cref="IFileOperation.NewItem"/>,
- ''' which simply queues the creation operation. Instead, this is the result of the actual creation.
- ''' </param>
- '''
- ''' <param name="psiNewItem">
- ''' The psi new item.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' <para></para>
- ''' In the case of an error value,
- ''' all subsequent operations pending from the call to <see cref="IFileOperation"/> are canceled.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PostNewItem(dwFlags As TransferSourceFlags, psiDestinationFolder As IShellItem, <MarshalAs(UnmanagedType.LPWStr)> pszNewName As String, <MarshalAs(UnmanagedType.LPWStr)> pszTemplateName As String, dwFileAttributes As UInteger, <MarshalAs(UnmanagedType.U4)> hrNew As HResult, psiNewItem As IShellItem) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Provides an estimate of the total amount of work currently done in relation to the total amount of work.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="iWorkTotal">
- ''' An estimate of the amount of work to be completed.
- ''' </param>
- '''
- ''' <param name="iWorkSoFar">
- ''' The portion of <paramref name="iWorkTotal"/> that has been completed so far.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function UpdateProgress(iWorkTotal As UInteger, iWorkSoFar As UInteger) As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Not supported.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function ResetTimer() As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Not supported.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function PauseTimer() As HResult
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Not supported.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <returns>
- ''' If this method succeeds, it returns <see cref="HResult.S_OK"/>.
- ''' Otherwise, it returns an <see cref="HResult"/> error code.
- ''' </returns>
- ''' ----------------------------------------------------------------------------------------------------
- Function ResumeTimer() As HResult
- End Interface
- End Namespace
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement