Partager via


SHFILEOPSTRUCT

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This structure contains information that the SHFileOperation function uses to perform file operations.

Syntax

typedef struct _SHFILEOPSTRUCT {
  HWND hwnd;
  UINT wFunc;
  LPCWSTR pFrom;
  LPCWSTR pTo;
  FILEOP_FLAGS fFlags;
  BOOL fAnyOperationsAborted;
  LPVOID hNameMappings;
  LPCWSTR lpszProgressTitle;
} SHFILEOPSTRUCT, *LPSHFILEOPSTRUCT;

Members

  • hwnd
    Window handle to the dialog box to display information about the status of the file operation.
  • wFunc
    Value that indicates which operation to perform. The following table shows the possible values.

    Value Description

    FO_COPY

    Copies the files specified in the pFrom member to the location specified in the pTo member.

    FO_DELETE

    Deletes the files specified in pFrom.

    FO_MOVE

    Moves the files specified in pFrom to the location specified in pTo.

    FO_RENAME

    Renames the file specified in pFrom. You cannot use this flag to rename multiple files with a single function call. Use FO_MOVE instead.

  • pFrom
    Address of a buffer to specify one or more source file names. These names must be fully qualified paths. Standard Microsoft® MS-DOS® wildcards, such as "*", are permitted in the file name position. Although this member is declared as a null-terminated string, it is used as a buffer to hold multiple file names. Each file name must be terminated by a single NULL character. An additional NULL character must be appended to the end of the final name to indicate the end of pFrom.
  • pTo
    Address of a buffer to contain the name of the destination file or directory. This parameter must be set to NULL if it is not used. Like pFrom, the pTo member is also a double-null terminated string and is handled in much the same way. However, pTo must meet the following specifications:

    • Wildcard characters are not supported.
    • Copy and Move operations can specify destination directories that do not exist and the system attempts to create them. The system usually displays a dialog box to ask the user if they want to create the new directory. To suppress this dialog box and have the directories created silently, set the FOF_NOCONFIRMMKDIR flag in fFlags.
    • For Copy and Move operations, the buffer can contain multiple destination file names if the fFlags member specifies FOF_MULTIDESTFILES.
    • Pack multiple names into the string in the same way as for pFrom.
    • Use only fully qualified paths. Using relative paths have unpredictable results.
  • fFlags
    Flags that control the file operation. The following table shows the possible values.

    Flag Description

    FOF_ALLOWUNDO

    Preserve Undo information, if possible. If pFrom does not contain fully qualified path and file names, this flag is ignored.

    FOF_FILESONLY

    Not supported.

    FOF_MULTIDESTFILES

    Not supported.

    FOF_NO_CONNECTED_ELEMENTS

    Not supported.

    FOF_NOCONFIRMATION

    Respond with "Yes to All" for any dialog box that is displayed.

    FOF_NOCONFIRMMKDIR

    Do not confirm the creation of a new directory if the operation requires one to be created.

    FOF_NOCOPYSECURITYATTRIBS

    Not supported.

    FOF_NOERRORUI

    Do not display a user interface if an error occurs.

    FOF_NORECURSION

    Not supported.

    FOF_RENAMEONCOLLISION

    Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.

    FOF_SILENT

    Do not display a progress dialog box.

    FOF_SIMPLEPROGRESS

    Display a progress dialog box but do not show the file names.

    FOF_WANTMAPPINGHANDLE

    Not supported.

    FOF_WANTNUKEWARNING

    Not supported.

  • fAnyOperationsAborted
    Not supported.
  • hNameMappings
    Not supported.
  • lpszProgressTitle
    Address of a string to use as the title of a progress dialog box. This member is used only if fFlags includes the FOF_SIMPLEPROGRESS flag.

Remarks

If pFrom is set to a file name, deleting the file with FO_DELETE does not move it to the Recycle Bin, even if the FOF_ALLOWUNDO flag is set. You must use a full path.

Requirements

Header shellapi.h
Windows Embedded CE Windows CE .NET 4.2 and later

See Also

Reference

Standard Shell Structures
SHFileOperation