@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: SHFILEOPSTRUCT - Structure for [SHFileOperation] !!!!C# Definition: For 32-bit processes: [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)] public struct SHFILEOPSTRUCT { public IntPtr hwnd; public uint wFunc; [MarshalAs(UnmanagedType.LPTStr)] public string pFrom; [MarshalAs(UnmanagedType.LPTStr)] public string pTo; public ushort fFlags; public bool fAnyOperationsAborted; public IntPtr hNameMappings; [MarshalAs(UnmanagedType.LPTStr)] public string lpszProgressTitle; } For 64-bit processes: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct SHFILEOPSTRUCT { public IntPtr hwnd; public uint wFunc; [MarshalAs(UnmanagedType.LPTStr)] public string pFrom; [MarshalAs(UnmanagedType.LPTStr)] public string pTo; public ushort fFlags; public bool fAnyOperationsAborted; public IntPtr hNameMappings; [MarshalAs(UnmanagedType.LPTStr)] public string lpszProgressTitle; } !!!!VB.NET Definition For 32-bit processes: <StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Auto)> _ Public Structure SHFILEOPSTRUCT Public hwnd As IntPtr <MarshalAs(UnmanagedType.U4)>Public wFunc As FileFuncFlags <MarshalAs(UnmanagedType.LPTStr)>Public pFrom As String <MarshalAs(UnmanagedType.LPTStr)>Public pTo As String <MarshalAs(UnmanagedType.U2)>Public fFlags As FILEOP_FLAGS <MarshalAs(UnmanagedType.Bool)>Public fAnyOperationsAborted As Boolean Public hNameMappings As IntPtr <MarshalAs(UnmanagedType.LPTStr)>Public lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS End Structure For 64-bit processes: <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _ Public Structure SHFILEOPSTRUCT Public hwnd As IntPtr <MarshalAs(UnmanagedType.U4)>Public wFunc As FileFuncFlags <MarshalAs(UnmanagedType.LPTStr)>Public pFrom As String <MarshalAs(UnmanagedType.LPTStr)>Public pTo As String <MarshalAs(UnmanagedType.U2)>Public fFlags As FILEOP_FLAGS <MarshalAs(UnmanagedType.Bool)>Public fAnyOperationsAborted As Boolean Public hNameMappings As IntPtr <MarshalAs(UnmanagedType.LPTStr)>Public lpszProgressTitle As String ' only used if FOF_SIMPLEPROGRESS End Structure !!!!VB Definition: Public Type SHFILEOPSTRUCT hWnd As Long wFunc As FileFuncFlags pFrom As String pTo As String fFlags As FILEOP_FLAGS fAnyOperationsAborted As Long hNameMappings As Long lpszProgressTitle As String End Type !!!!User-Defined Field Types: [FileFuncFlags], [FILEOP_FLAGS] !!!!Notes: The definitions above are the same used by Microsoft.VisualBasic.CompilerServices in the Microsoft.VisualBasic.dll. The difference is that for 32-bit processes the struct fields must be packed without alignment (Pack=1), whereas for 64-bit processes the default alignment must be used. To check if your process uses 32-bit or 64-bit, do sizeof(IntPtr) which will return 4 for 32-bit processes or 8 for 64-bit processes. !!!!Alternative Managed API: You may use the functionality of the Microsoft.VisualBasic.dll/Nuget package: (.NET framework) instead: using Microsoft.VisualBasic.FileIO; FileSystem.DeleteFile(path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); Documentation: SHFILEOPSTRUCT@msdn on MSDN
Edit Structures.SHFILE...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.