Hi!
I've been following the example on SHFILEOPSTRUCT here in the group,
but I keep getting the message: 'Cannot read from sourcefile'.
Here's the code:
SHFILEOPSTRUCT shf = new SHFILEOPSTRUCT();
shf.wFunc = FO_DELETE;
shf.pFrom = myFile;
///'myFile' keeps the filelocation
shf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION;
SHFileOperation(ref shf);
And my question is:
Do you think I have put the declaration code in the wrong place or...?
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.Unicode)]
public static extern int SHFileOperation(ref SHFILEOPSTRUCT FileOp);
const int FO_DELETE = 3;
const int FOF_ALLOWUNDO = 0x40;
const int FOF_NOCONFIRMATION = 0x0010; //Don't prompt the user.;
I have put this code just after the 'static void Main()' procedure.
Please guide me!
Me.Name