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
LPSHFILEOPSTRUCTlpFileOp: A pointer to aSHFILEOPSTRUCTstructure 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
PCWSTRpszPath: A pointer to a null-terminated Unicode string that specifies the full path of the file.
Return Value
- Returns
TRUEif the file is in the Recycle Bin,FALSEotherwise.
SHDeleteRecycleFile(PCWSTR pszPath)
Moves a file to the Recycle Bin.
Parameters
PCWSTRpszPath: A pointer to a null-terminated Unicode string that specifies the full path of the file to be deleted.
Return Value
- Returns
TRUEon success,FALSEon failure.
Folder Operations
SHCreateDirectoryEx(HWND hwnd, PCWSTR pszPath, const SECURITY_ATTRIBUTES *psa)
Creates a new directory, including any necessary parent directories.
Parameters
HWNDhwnd: A handle to the owner window of the dialog box that the function displays to report errors.PCWSTRpszPath: 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_ATTRIBUTESstructure that specifies the security attributes of the new directory.
Return Value
- Returns
ERROR_SUCCESSif the directory was created successfully, or an error code otherwise.
SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Enables AutoComplete for a specified edit control.
Parameters
HWNDhwndEdit: The handle to the edit control.DWORDdwFlags: Flags that specify how AutoComplete should function.
Return Value
- Returns
S_OKon success, or an error code otherwise.
While not directly a file operation, it's crucial for file path input.