Comprehensive documentation for the Windows API
Functions for interacting with the Windows shell, including file operations, shortcuts, and system information.
Performs file operations such as copy, move, rename, and delete.
Header: shlobj.h
BOOL SHFileOperation(PSHFILEOPSTRUCTA lpFileOp);
or BOOL SHFileOperation(PSHFILEOPSTRUCTW lpFileOp);
lpFileOp
: A pointer to a SHFILEOPSTRUCT structure that contains all necessary information to perform the requested operation.
typedef struct _SHFILEOPSTRUCT {
HWND hwnd;
UINT wFunc;
LPCSTR pszFrom;
LPCSTR pszTo;
FILEOP_FLAGS fFlags;
BOOL fAnyOperationsAborted;
LPVOID hNameMappings;
LPCSTR lpszProgressTitle;
} SHFILEOPSTRUCT, *PSHFILEOPSTRUCT, SHFILEOPSTRUCTA, *PSHFILEOPSTRUCTA;
Opens a folder and selects one or more items within it.
Header: shlobj.h
HRESULT SHOpenFolderAndSelectItems(PCIDLIST_ABSOLUTE pidlFolder, PCUITEMID_CHILD_ARRAY apidlSelect, HWND hwnd, DWORD dwFlags);
pidlFolder
: The folder to open.apidlSelect
: An array of item IDs to select.hwnd
: The parent window handle.dwFlags
: Flags specifying how to open the folder.
HRESULT SHOpenFolderAndSelectItems(
PCIDLIST_ABSOLUTE pidlFolder,
PCUITEMID_CHILD_ARRAY apidlSelect,
HWND hwnd,
DWORD dwFlags
);
Creates a directory, including any necessary parent directories.
Header: shlobj.h
HRESULT SHCreateDirectoryEx(
HWND hwnd,
PCWSTR pszPath,
PSECURITY_ATTRIBUTES psap
);
hwnd
: The owner window.pszPath
: The path of the directory to create.psap
: Security attributes.
HRESULT SHCreateDirectoryEx(
HWND hwnd,
PCWSTR pszPath,
PSECURITY_ATTRIBUTES psap
);
Deletes an empty directory.
Header: shlobj.h
BOOL SHDeleteDirectory(PCWSTR pszPath);
pszPath
: The path of the directory to delete.
BOOL SHDeleteDirectory(
PCWSTR pszPath
);
Adds a document to the "Recent Documents" list.
Header: shlobj.h
void SHAddToRecentDocs(
UINT enumFormatID,
PCWSTR pszPath
);
enumFormatID
: The format of the document.pszPath
: The path of the document.
void SHAddToRecentDocs(
UINT enumFormatID,
PCWSTR pszPath
);