Shell32: File Operations
This section provides documentation for functions in the Shell32 library that are used for performing file and folder operations in Windows.
Core File Operations
SHFileOperation(LPSHFILEOPSTRUCT lpFileOp)
Performs a number of file operations, including copy, move, rename, and delete.
Parameters
LPSHFILEOPSTRUCT
lpFileOp: A pointer to aSHFILEOPSTRUCT
structure that contains all the information necessary for the function to perform the requested operation.
Return Value
- Returns zero if the operation was successful, or a non-zero error value otherwise.
This is the primary function for performing high-level file operations. It handles user interaction, progress dialogs, and error reporting.
SHQueryRecycleFile(PCWSTR pszPath)
Determines if a file is currently in the Recycle Bin.
Parameters
PCWSTR
pszPath: A pointer to a null-terminated Unicode string that specifies the full path of the file.
Return Value
- Returns
TRUE
if the file is in the Recycle Bin,FALSE
otherwise.
SHDeleteRecycleFile(PCWSTR pszPath)
Moves a file to the Recycle Bin.
Parameters
PCWSTR
pszPath: A pointer to a null-terminated Unicode string that specifies the full path of the file to be deleted.
Return Value
- Returns
TRUE
on success,FALSE
on failure.
Folder Operations
SHCreateDirectoryEx(HWND hwnd, PCWSTR pszPath, const SECURITY_ATTRIBUTES *psa)
Creates a new directory, including any necessary parent directories.
Parameters
HWND
hwnd: A handle to the owner window of the dialog box that the function displays to report errors.PCWSTR
pszPath: A pointer to a null-terminated Unicode string that specifies the path of the directory to create.const SECURITY_ATTRIBUTES *
psa: A pointer to aSECURITY_ATTRIBUTES
structure that specifies the security attributes of the new directory.
Return Value
- Returns
ERROR_SUCCESS
if the directory was created successfully, or an error code otherwise.
SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Enables AutoComplete for a specified edit control.
Parameters
HWND
hwndEdit: The handle to the edit control.DWORD
dwFlags: Flags that specify how AutoComplete should function.
Return Value
- Returns
S_OK
on success, or an error code otherwise.
While not directly a file operation, it's crucial for file path input.