Created
November 1, 2019 03:26
-
-
Save timdetering/55f8a7b2b23ef47d5c3ddcae0c8cd635 to your computer and use it in GitHub Desktop.
DeleteToRecycleBin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeleteToRecycleBin | |
{ | |
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] | |
public struct SHFILEOPSTRUCT | |
{ | |
public IntPtr hwnd; | |
[MarshalAs(UnmanagedType.U4)] | |
public int wFunc; | |
public string pFrom; | |
public string pTo; | |
public short fFlags; | |
[MarshalAs(UnmanagedType.Bool)] | |
public bool fAnyOperationsAborted; | |
public IntPtr hNameMappings; | |
public string lpszProgressTitle; | |
} | |
[DllImport("shell32.dll", CharSet = CharSet.Auto)] | |
public static extern int SHFileOperation(ref SHFILEOPSTRUCT FileOp); | |
public const int FO_DELETE = 3; | |
public const int FOF_ALLOWUNDO = 0x40; | |
public const int FOF_NOCONFIRMATION = 0x10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment