这个删除文件到回收站的代码有什么错误?请指教。
[StructLayout(LayoutKind.Sequential)]
private struct SHFILEOPSTRUCT
{
public System.IntPtr hWnd;
public System.Int32 wFunc;
[MarshalAs(UnmanagedType.LPStr)]
public System.String pFrom;
[MarshalAs(UnmanagedType.LPStr)]
public System.String pTo;
public System.Int32 fFlags;
public System.Int32 fAnyOperationsAborted;
public System.IntPtr hNameMappings;
[MarshalAs(UnmanagedType.LPStr)]
public System.String lpszProgressTitle;
}
public static int ShellDelete(string file){
SHFILEOPSTRUCT fstruct=new SHFILEOPSTRUCT();
fstruct.hWnd=IntPtr.Zero;
fstruct.wFunc=3;
fstruct.pFrom=file;
fstruct.pTo=null;
fstruct.fFlags=64;
//fstruct.fAnyOperationsAborted=false;
fstruct.hNameMappings=null;
//fstruct.lpszProgressTitle=null;
return SHFileOperation(ref fstruct);
}
用ShellDelete("G:\\1.bmp");总提示找不到文件或者磁盘。
why?