Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SHFILEOPSTRUCT (Structures)
 
.
Summary
TODO - a short description

C# Definition:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]

struct SHFILEOPSTRUCT

{

    public IntPtr hwnd;
    public FO_Func wFunc;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string pFrom;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string pTo;
    public ushort fFlags;
    public bool fAnyOperationsAborted;
    public IntPtr hNameMappings;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string lpszProgressTitle;

}

VB Definition:

Structure SHFILEOPSTRUCT
   Public TODO
End Structure

User-Defined Field Types:

FO_Func

Notes:

I tried to use this to send files to the recycle bin. It failed (Marshal.GetLastWin32Error was 6, invalid handle) and sometimes threw a NullReferenceException. To make it work I did the following;

    public IntPtr pFrom;
    public IntPtr pTo;

  • Always set hwnd to my main app window (I was using IntPtr.Zero, this might not be required)
  • Correctly treat pTo and pFrom as zero delimited double zero terminated.

In my case I only needed pTo so I just added a null byte to the end and used Marshal.StringToHGlobalUni() to set the value

Documentation

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.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions