Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Structures, prefix the name with the module name and a period.
SHFILEOPSTRUCT (Structures)
.
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
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);
The SHFileOperation API
3/5/2023 2:08:07 PM - Quaint Mako-88.174.61.36
FileFuncFlags - Flags for wFunc member of [SHFILEOPSTRUCT]
2/6/2014 2:40:14 AM - -212.250.153.162
FILEOP_FLAGS - Flags for fFlags member of [SHFILEOPSTRUCT]
2/13/2013 3:55:11 AM - -202.74.138.1
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips?
corrections to the existing content?
alternate definitions?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.