diff --git a/PInvoke/Shell32/ShObjIdl.ICopyHook.cs b/PInvoke/Shell32/ShObjIdl.ICopyHook.cs new file mode 100644 index 00000000..0f646745 --- /dev/null +++ b/PInvoke/Shell32/ShObjIdl.ICopyHook.cs @@ -0,0 +1,60 @@ +using System; +using System.Runtime.InteropServices; + +namespace Vanara.PInvoke +{ + public static partial class Shell32 + { + /// Exposes a method that creates a copy hook handler. A copy hook handler is a Shell extension that determines if a Shell folder or printer object can be moved, copied, renamed, or deleted. The Shell calls the ICopyHook::CopyCallback method prior to performing one of these operations. + [ComImport, Guid("000214EF-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [PInvokeData("Shlobj.h")] + public interface ICopyHookA + { + /// + /// Determines whether the Shell will be allowed to move, copy, delete, or rename a folder or printer object. + /// + /// The HWND.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 wFunc, the method should ignore this parameter. + /// The operation to perform. This parameter can be one of the values listed under the wFunc member of the SHFILEOPSTRUCT structure. + /// The flags that control the operation. This parameter can be one or more of the values listed under the fFlags member of the SHFILEOPSTRUCT structure. + /// A pointer to a string that contains the name of the source folder. + /// The attributes of the source folder. This parameter can be a combination of any of the file attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files. See File Attribute Constants. + /// A pointer to a string that contains the name of the destination folder. + /// The attributes of the destination folder. This parameter can be a combination of any of the file attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files. See File Attribute Constants. + /// Returns an integer value that indicates whether the Shell should perform the operation. One of the following: + /// + /// Return codeDescription + /// IDYES (0x06)Allows the operation. + /// IDNO (0x07)Prevents the operation on this folder but continues with any other operations that have been approved (for example, a batch copy operation). + /// IDCANCEL (0x02)Prevents the current operation and cancels any pending operations. + /// + /// + int CopyCallback([In, Optional] IntPtr hwnd, ShellFileOperation wFunc, FILEOP_FLAGS wFlags, [In, MarshalAs(UnmanagedType.LPStr)] string pszSrcFile, FileFlagsAndAttributes dwSrcAttribs, [In, Optional, MarshalAs(UnmanagedType.LPStr)] string pszDestFile, FileFlagsAndAttributes dwDestAttribs); + } + + /// Exposes a method that creates a copy hook handler. A copy hook handler is a Shell extension that determines if a Shell folder or printer object can be moved, copied, renamed, or deleted. The Shell calls the ICopyHook::CopyCallback method prior to performing one of these operations. + [ComImport, Guid("000214FC-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [PInvokeData("Shlobj.h")] + public interface ICopyHookW + { + /// + /// Determines whether the Shell will be allowed to move, copy, delete, or rename a folder or printer object. + /// + /// The HWND.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 wFunc, the method should ignore this parameter. + /// The operation to perform. This parameter can be one of the values listed under the wFunc member of the SHFILEOPSTRUCT structure. + /// The flags that control the operation. This parameter can be one or more of the values listed under the fFlags member of the SHFILEOPSTRUCT structure. + /// A pointer to a string that contains the name of the source folder. + /// The attributes of the source folder. This parameter can be a combination of any of the file attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files. See File Attribute Constants. + /// A pointer to a string that contains the name of the destination folder. + /// The attributes of the destination folder. This parameter can be a combination of any of the file attribute flags (FILE_ATTRIBUTE_*) defined in the Windows header files. See File Attribute Constants. + /// Returns an integer value that indicates whether the Shell should perform the operation. One of the following: + /// + /// Return codeDescription + /// IDYES (0x06)Allows the operation. + /// IDNO (0x07)Prevents the operation on this folder but continues with any other operations that have been approved (for example, a batch copy operation). + /// IDCANCEL (0x02)Prevents the current operation and cancels any pending operations. + /// + /// + int CopyCallback([In, Optional] IntPtr hwnd, ShellFileOperation wFunc, FILEOP_FLAGS wFlags, [In, MarshalAs(UnmanagedType.LPWStr)] string pszSrcFile, FileFlagsAndAttributes dwSrcAttribs, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string pszDestFile, FileFlagsAndAttributes dwDestAttribs); + } + } +} \ No newline at end of file