IFolderWindowsGetFolderOperationControlAsync Method |
IT Hit User File System
Method returns whether the Shell should perform the operation.
Namespace:
ITHit.FileSystem.Windows
Assembly:
ITHit.FileSystem.Windows (in ITHit.FileSystem.Windows.dll) Version: 9.0.29527.0
SyntaxTask<FolderOperationControl> GetFolderOperationControlAsync(
FolderOperation fileOperation,
string targetUserFileSystemPath,
IntPtr parentWindow,
FolderControlFlags flags,
FileAttributes sourceAttributes,
FileAttributes targetAttributes
)
Function GetFolderOperationControlAsync (
fileOperation As FolderOperation,
targetUserFileSystemPath As String,
parentWindow As IntPtr,
flags As FolderControlFlags,
sourceAttributes As FileAttributes,
targetAttributes As FileAttributes
) As Task(Of FolderOperationControl)
Task<FolderOperationControl>^ GetFolderOperationControlAsync(
FolderOperation fileOperation,
String^ targetUserFileSystemPath,
IntPtr parentWindow,
FolderControlFlags flags,
FileAttributes sourceAttributes,
FileAttributes targetAttributes
)
abstract GetFolderOperationControlAsync :
fileOperation : FolderOperation *
targetUserFileSystemPath : string *
parentWindow : IntPtr *
flags : FolderControlFlags *
sourceAttributes : FileAttributes *
targetAttributes : FileAttributes -> Task<FolderOperationControl>
Parameters
- fileOperation
- Type: ITHit.FileSystem.WindowsFolderOperation
The operation to perform.
- targetUserFileSystemPath
- Type: SystemString
Name of the destination folder. This parameter is provided for copy, move and rename operations only. Null for all other operations.
- parentWindow
- Type: SystemIntPtr
A handle to the window that the copy hook handler should use as the parent for
any user interface elements the handler may need to display. If FOF_SILENT is specified in operation,
the method should ignore this parameter.
- flags
- Type: ITHit.FileSystem.WindowsFolderControlFlags
The flags that control the operation FolderControlFlags enum.
- sourceAttributes
- Type: System.IOFileAttributes
The attributes of the source folder.
- targetAttributes
- Type: System.IOFileAttributes
The attributes of the destination folder.
Return Value
Type:
TaskFolderOperationControl
Value that indicates whether the Shell should perform the operation.
Remarks
To allow or forbid Shell from performing operations, follow these steps:
-
Derive your class from one of the [!:StorageProviderCopyHookBase] class descendants.
Add the GuidAttribute,
ProgIdAttribute and
ComVisibleAttribute attributes to your class.
You do not need to implement any methods in your class.
-
Register the COM server in your Package.appxmanifest (in case of packaged app).
-
To register a copy hook handler for cloud folders, call the [!:ShellExtensionRegistrar.RegisterHandler]
passing "CopyHook" as a handler name.
Note that unlike other handlers, CopyHook must be registered in all cases, regardless if your app is running with or without identity.
-
Implement the GetFolderOperationControlAsync(FolderOperation, String, IntPtr, FolderControlFlags, FileAttributes, FileAttributes) with your logic.
CopyHook functionality does NOT require package or application identity.
ExamplesThe code below is part of 'VirtualDrive' C# sample provided with the SDK.
[ComVisible(true)]
[ProgId("VirtualDrive.StorageProviderCopyHook")]
[Guid("4E813313-2227-42AE-BDC9-53C17A9CF812")]
internal class StorageProviderCopyHookIntegrated : StorageProviderCopyHookIntegratedBase
{
public StorageProviderCopyHookIntegrated() : base(ServiceProvider.GetService<VirtualEngine>())
{
}
}
See Also