15#if !defined(OWL_SHELLITM_H)
19#if defined(BI_HAS_PRAGMA_ONCE)
28#if defined(BI_COMP_MSC)
30#pragma warning(disable:4091)
35#if defined(BI_COMP_MSC)
57 static HINSTANCE
ShellExecute(HWND,LPCTSTR,LPCTSTR,LPCTSTR,LPCTSTR,INT);
62 static DWORD
SHGetFileInfo(LPCTSTR,DWORD,SHFILEINFO *,UINT,UINT);
171 static LPITEMIDLIST
Next(LPITEMIDLIST pidl);
175 TPidl(LPITEMIDLIST pidl = 0);
182 TPidl& operator = (LPITEMIDLIST pidl);
185 bool operator !()
const;
189 operator LPCITEMIDLIST ()
const;
190 operator LPITEMIDLIST ();
194 operator LPCITEMIDLIST* ()
const;
195 operator LPITEMIDLIST* ();
401 TShellItem(
const tchar* path,
bool throwOnInvalidPath =
true, HWND windowOwner = 0);
418 operator LPCITEMIDLIST()
const;
434 bool CanBeCopied(
const bool validateCachedInfo =
false)
const;
435 bool CanBeDeleted(
const bool validateCachedInfo =
false)
const;
437 bool CanBeMoved(
const bool validateCachedInfo =
false)
const;
438 bool CanBeRenamed(
const bool validateCachedInfo =
false)
const;
439 bool IsADropTarget(
const bool validateCachedInfo =
false)
const;
445 bool IsShortcut(
const bool validateCachedInfo =
false)
const;
446 bool IsReadOnly(
const bool validateCachedInfo =
false)
const;
447 bool IsShared(
const bool validateCachedInfo =
false)
const;
457 bool IsFolder(
const bool validateCachedInfo =
false)
const;
458 bool CanBeRemoved(
const bool validateCachedInfo =
false)
const;
494 void Rename(
const tchar* newName, HWND windowOwner = 0,
496 bool Copy(
const tchar* dest,
const bool destIsFolder =
true,
497 const USHORT flags = 0,
const tchar* title = 0,
498 HWND windowOwner = 0)
const;
500 HWND windowOwner = 0)
const;
501 bool Move(
const tchar* destFolder,
const USHORT flags = 0,
502 const tchar* title = 0, HWND windowOwner = 0);
504 const tchar* title = 0, HWND windowOwner = 0);
505 bool Delete(
const USHORT flags = 0,
const tchar* title = 0,
506 HWND windowOwner = 0);
521 static HRESULT
CreateShortCut(LPCITEMIDLIST pidl, LPTSTR pathLink,
537 void EnumObjects(IEnumIDList** iface, HWND windowOwner = 0,
538 const int kind = -1)
const;
542 const tchar* title = 0,
const UINT flags = 0,
543 int* image = 0,
const bool includeStatus =
false,
544 BFFCALLBACK func = 0,
const LPARAM param = 0)
const;
549 ulong* eaten =
nullptr, HWND windowOwner =
nullptr,
550 ulong* attrib =
nullptr)
const;
585 const int kind = Folders | NonFolders);
598 long GetCount()
const;
611 void Skip(
const ulong count);
619 void EnforceValidInterface()
const;
625 operator IEnumIDList**();
637 TXShell(
uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
649 static void Raise(
uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
653 static void Check(HRESULT hr,
uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
877 return Pidl ==
nullptr;
885 return reinterpret_cast<LPITEMIDLIST
>(
reinterpret_cast<char*
>(pidl) + pidl->mkid.cb);
909 LPITEMIDLIST copy = source.
CopyPidl();
935inline TPidl::operator LPCITEMIDLIST()
const
940inline TPidl::operator LPITEMIDLIST()
945inline TPidl::operator LPCITEMIDLIST*()
const
947 return const_cast<LPCITEMIDLIST*
>(&Pidl);
950inline TPidl::operator LPITEMIDLIST*()
961 return !!Pidl && !!ParentFolder;
1113inline TShellItem::operator LPCITEMIDLIST()
const
1175 return STATIC_CAST(IShellFolder*, constThis->ParentFolder) ==
1176 STATIC_CAST(IShellFolder*, constOther->ParentFolder);
TComRef< T > & operator=(T *iface)
Wraps the IDataObject interface (currently lightweight).
TDataObject(IDataObject *iface=0)
Default constructor for TDataObject.
TDataObject & operator=(const TComRef< IDataObject > &source)
TDataObject assignment operator (from TComRef<IDataObject>).
Wraps the IDropTarget interface (currently lightweight).
TDropTarget & operator=(const TComRef< IDropTarget > &source)
TDropTarget assignment operator (from TComRef<IDropTarget>).
TDropTarget(IDropTarget *iface=0)
Default constructor for TDropTarget.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPidl is an item identifier list class (ITEMIDLIST).
long GetItemCount() const
Get number of item ids in the TPidl (the TPidl can be a list of ids).
TPidl(LPITEMIDLIST pidl=0)
Construct a TPidl from an LPITEMIDLIST (pidl).
virtual ~TPidl()
TPidl destructor.
void FreePidl()
Free a pidl with the shell's allocator.
static LPITEMIDLIST Next(LPITEMIDLIST pidl)
Return next item id (in the list).
TPidl & operator=(const TPidl &source)
TPidl assignement operator (from another TPidl).
ulong GetSize() const
Get size (in bytes) of a pidl.
TPidl GetLastItem() const
Get the last item id in the TPidl.
LPITEMIDLIST CopyPidl() const
Copy a pidl.
bool operator!() const
Check to see if TPidl represents an ITEMIDLIST (return true if it does not).
TPidl StripLastItem() const
Return a TPidl with the last item id stripped off of it.
delay loading SHELL32.DLL/SHELL.DLL
static void DragFinish(HDROP)
Invokes 'DragFinish' indirectly.
static HRESULT SHGetMalloc(LPMALLOC *)
Invokes 'SHGetMalloc' indirectly.
static void SHChangeNotify(LONG, UINT, LPCVOID, LPCVOID)
Invokes 'SHChangeNotify' indirectly.
static HRESULT SHGetDesktopFolder(LPSHELLFOLDER *)
Invokes 'SHGetDesktopFolder' indirectly.
static void SHAddToRecentDocs(UINT, LPCVOID)
Invokes 'SHAddToRecentDocs' indirectly.
static BOOL SHGetPathFromIDList(LPCITEMIDLIST, TCHAR *)
Invokes 'SHGetPathFromIDList' indirectly.
static int SHFileOperation(LPSHFILEOPSTRUCT)
Invokes 'SHFileOperation' indirectly.
static void DragAcceptFiles(HWND, BOOL)
Invokes 'DragAcceptFiles' indirectly.
static HRESULT SHGetSpecialFolderLocation(HWND, int, LPITEMIDLIST *)
Invokes 'SHGetSpecialFolderLocation' indirectly.
static LPITEMIDLIST SHBrowseForFolder(LPBROWSEINFO)
Invokes 'SHBrowseForFolder' indirectly.
static HINSTANCE ShellExecute(HWND, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, INT)
Invokes 'ShellExecute' indirectly.
static BOOL DragQueryPoint(HDROP, LPPOINT)
Invokes 'DragQueryPoint' indirectly.
static TModule & GetModule()
Returns TModule object wrapping the handle of the SHELL[32].DLL module.
static UINT DragQueryFile(HDROP, UINT, TCHAR *, UINT)
Invokes 'DragQueryFile' indirectly.
static BOOL Shell_NotifyIcon(DWORD, PNOTIFYICONDATA)
Invokes 'Shell_NotifyIcon' indirectly.
static HICON ExtractIcon(HINSTANCE, LPCTSTR, UINT)
Invokes 'ExtractIcon' indirectly.
static DWORD SHGetFileInfo(LPCTSTR, DWORD, SHFILEINFO *, UINT, UINT)
Invokes 'SHGetFileInfo' indirectly.
An item in the shell's name space.
HRESULT ParseDisplayName(TCreateStruct &cs, const tchar *displayName, ulong *eaten=nullptr, HWND windowOwner=nullptr, ulong *attrib=nullptr) const
Parse a display name into a TShellItem (actually, into a TCreateStruct).
bool IsShortcut(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is a shortcut.
TShellItem(const tchar *path, bool throwOnInvalidPath=true, HWND windowOwner=0)
TShellItem constructor to make a TShellItem for a file or directory in the file system.
HICON GetIcon(TIconSize size=Shell, uint kind=0)
GetIcon returns a handle to an icon representing this TShellItem.
bool BrowseForFolder(TCreateStruct &cs, HWND windowOwner=0, const tchar *title=0, const UINT flags=0, int *image=0, const bool includeStatus=false, BFFCALLBACK func=0, const LPARAM param=0) const
Select a Foler under this TShellItem.
TShellItem ResolveShortcut(HWND windowOwner=0)
Get the TShellItem that a shortcut points to.
static HRESULT CreateShortCut(LPCTSTR objPath, TCHAR *pathLink, TCHAR *description)
Create a shortcut to a file object.
bool CanBeRenamed(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be renamed.
bool ContainsSubFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that contains a subfolder.
bool HasAPropertySheet(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that has a property sheet.
TIconKind
Used by TShellItem::GetIcon See MS doc for SHGetFileInfo for more information, Programmer's Guide to ...
@ Open
Retrieves the shell item's open icon.
@ Selected
Blends the shell item's icon with the system highlight color.
@ Link
Adds the link overlay to the shell item's icon.
bool ContainsFileSystemFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that contains a file system folder.
bool CanCreateShortcut(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item for which a shortcut can be created.
bool CanBeCopied(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be copied.
TExeKind
Returned by TShellItem::GetExeType See MS doc for SHGetFileInfo for more information,...
@ WindowsPE
Windows level (3.0, 3.5, or 4.0).
@ WindowsNE
Windows-based application.
@ MSDOS
MS-DOS .EXE, .COM, or .BAT file.
@ Win32Console
Win32-based console application.
@ NonExecutable
Nonexecutable file or an error condition.
TString GetDisplayName(const TDisplayNameKind kind=Normal) const
Get Displayname (for a TShellItem that's part of the filesystem, this is the filename).
bool operator!=(const TShellItem &rhs) const
Compare sort order of this TShellItem is not equal to another TShellItem.
bool CanBeRemoved(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be removed.
void AddToRecentDocs() const
Add to recent docs (Win95 taskbar:Start:Documents).
bool DisplayGhosted(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that should be displayed as ghosted.
bool operator<(const TShellItem &rhs) const
Compare sort order of this TShellItem is less than another TShellItem.
bool operator==(const TShellItem &rhs) const
Compare sort order of this TShellItem equals another TShellItem.
bool HaveSameParent(const TShellItem &other) const
HaveSameParent returns true if this TShellItem and other TShellItem have the same immediate parent fo...
TIconSize
Used by TShellItem::GetIcon See MS doc for SHGetFileInfo for more information, Programmer's Guide to ...
@ Small
Retrieves the shell item's small icon.
@ Shell
Retrieves the shell-sized icon (if unavailable, the normal icon is sized according to the system metr...
@ Large
Retrieves the shell item's large icon.
TDisplayNameKind
Used by TShelItem::GetDisplayName() and TShellItem::Rename() See MS doc for SHGNO for more informatio...
@ Normal
File object displayed by itself.
@ InFolder
File object displayed within a folder.
@ ForParsing
File object suitable for parsing.
TCreateStruct GetParentFolder() const
Get Parent Folder.
TPidl GetPidl() const
Get TPidl (relative to parent).
bool GetAttribute(const TAttribute at, const bool validateCachedInfo) const
GetAttribute is a protected function used by all the attribute functions except IsDesktop.
bool IsADropTarget(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item is a drop target.
TSpecialFolderKind
Used by TShellItem::TShellItem(const TSpecialFolderKind kind, HWND windowOwner = 0) See MS doc for SH...
@ DesktopFileDir
Directory used to physically store file objects on the desktop.
@ RecentDocuments
Directory containing the user's most recently used documents.
@ Fonts
Virtual folder containing fonts.
@ Desktop
Virtual folder at the root of the namespace.
@ SendTo
Directory containing Send To menu items.
@ NetworkNeighborhood
Virtual folder representing the top level of the network hierarchy.
@ CommonTemplates
Directory that serves as a repository for document templates.
@ CommonDocuments
Directory that serves as a repository for common documents.
@ RecycleBin
Directory containing file objects in the user's recycle bin.
@ StartMenu
Directory containing Start menu items.
@ ControlPanel
Virtual folder containing icons for the Control Panel.
@ Startup
Directory that corresponds to the user's Startup program group.
@ Printers
Virtual folder containing installed printers.
@ Programs
Directory containing the user's program groups.
@ NetworkNeighborhoodFileDir
Directory containing objects that appeat in the Network Neighborhood.
@ MyComputer
Virtual folder containing everything on the local computer.
TDropTarget GetDropTarget(HWND windowOwner=0)
GetDropTarget returns an interface pointer to this TShellItem's IDropTarget OLE interface.
TExeKind GetExeType(uint *major=0, uint *minor=0) const
Get type of executable file (may return NonExecutable).
void RetrieveIShellFolder() const
RetrieveIShellFolder is a protected function that checks to see if a TShellItem's IShellFolder interf...
TDataObject GetDataObject(HWND windowOwner=0)
GetDataObject returns an interface pointer to this TShellItem's IDataObject OLE interface.
TBrowseFlags
Used by TShellItem::BrowseForFolder.
@ OnlyFSDirs
Returns only file system directories.
@ OnlyPrinters
Returns only printers.
@ OnlyFSAncestors
Returns only file system ancestors.
@ OnlyComputers
Returns only computers.
@ NoNetorkFoldersBelowDomain
Does not return network folders below the domain.
bool CanBeDeleted(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be deleted.
bool Move(const tchar *destFolder, const USHORT flags=0, const tchar *title=0, HWND windowOwner=0)
Move moves this TShellItem to destination path (which must be a folder).
bool IsShared(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is shared.
TPidl GetFullyQualifiedPidl() const
Get fully qualified TPidl.
bool IsReadOnly(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is read only.
bool operator>(const TShellItem &rhs) const
Compare sort order of this TShellItem is greater than another TShellItem.
TString GetPath() const
Get path (only call if the TShellItem is part of the file system (IsPartOfFileSystem == true).
bool IsPartOfFileSystem(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is part of the file system.
bool IsFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is a folder.
bool Copy(const tchar *dest, const bool destIsFolder=true, const USHORT flags=0, const tchar *title=0, HWND windowOwner=0) const
Copy copies this TShellItem to destination path.
void EnforceValidity() const
EnforceValidity is a protected function that checks that a TShellItem is valid before proceeding with...
bool Delete(const USHORT flags=0, const tchar *title=0, HWND windowOwner=0)
Delete deletes this TShellItem.
bool operator<=(const TShellItem &rhs) const
Compare sort order of this TShellItem <= another TShellItem.
TAttribute
Used by TShellItem::GetAttributes See MS doc for IShellFolder::GetAttributesOf for more information,...
@ atCanBeRenamed
The shell item can be renamed.
@ atIsFolder
The shell item is a folder.
@ atIsShortcut
The shell item is a shortcut.
@ atIsShared
The shell item is shared.
@ atDisplayGhosted
The shell item should be displayed using a ghosted icon.
@ atContainsSubFolder
The shell item has subfolders.
@ atIsReadOnly
The shell item is readonly.
@ atCanCreateShortcut
Shortcuts can be created for the shell item.
@ atDisplayAttributeMask
Mask for the display attributes.
@ atCanBeDeleted
The shell item can be deleted.
@ atHasAPropertySheet
The shell item has a property sheet.
@ atIsPartOfFileSystem
The shell item is part of the file system.
@ atContentsMask
Mask for the contents attributes.
@ atContainsFileSystemFolder
The shell item contains one or more system folders.
@ atCanBeRemoved
The shell item is on removable media.
@ atCanBeCopied
The shell item can be copied.
@ atCapabilityMask
Mask for the capability flags.
@ atIsADropTarget
The shell item is a drop target.
@ atCanBeMoved
The shell item can be moved.
void EnumObjects(IEnumIDList **iface, HWND windowOwner=0, const int kind=-1) const
EnumObjects is a protected function that returns an IEnumIDList enumerator on a folder.
bool Valid() const
Determine if TShellItem reprsents a valid item.
TFileOpFlags
Used by TShellItem::Rename,Copy,Move,Delete See MS doc for SHFILEOPSTRUCT for more information,...
@ SimpleProgress
A simple progress dialog box is diaplayed (no file names).
@ RenameOnCollision
Renames the file being operated on if a file of the same name already exists (i.e....
@ NoConfirmation
Responds with "yes to all" for any dialog.
@ AllowUndo
Preserves undo information (if possible).
@ Silent
No progess dialog box is displayed.
@ NoConfirmMkDir
No confirmation on the creation of a new directory.
bool CanBeMoved(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be moved.
ulong GetAttributes(const ulong reqAttrib, const bool validateCachedInfo=false) const
Get Attributes of a TShellItem GetAttributes - Get Capabilities, Display, Contents,...
TExtractIcon GetExtractIcon(HWND windowOwner=0)
GetExtractIcon returns an interface pointer to this TShellItem's IExtractIcon OLE interface.
void Rename(const tchar *newName, HWND windowOwner=0, const TDisplayNameKind kind=Normal)
Rename renames this TShellItem to newName.
TString GetTypeName() const
Get type of file (e.g., "Borland C++ Header File", "Notepad File").
bool operator>=(const TShellItem &rhs) const
Compare sort order of this TShellItem >= another TShellItem.
bool IsDesktop() const
IsDesktop returns true if the TShellItem respresents the shell's desktop, i.e.
short CompareIDs(const TShellItem &rhs) const
CompareIDs is a protected function that compares a TShellItem's pidl with another TShellItem's pidl.
TContextMenu GetContextMenu(HWND windowOwner=0)
GetContextMenu returns an interface pointer to this TShellItem's IContextMenu OLE interface.
TShellItemIterator is an interator for walking through the contents of a folder.
TIncludeKind
Used by TShellItemIterator::TShellItemIterator(const TShellItem& folder, HWND windowOwner = 0,...
@ HiddenAndSystem
For hidden or system objects.
@ Folders
For shell browser.
@ NonFolders
For default view.
TShellItemIterator(const TShellItem &folder, HWND windowOwner=0, const int kind=Folders|NonFolders)
TShellItemIterator constructor.
bool Valid() const
True if iterator is still valid.
Wraps the shell's IMalloc interface.
TShellMalloc()
Default constructor for TShellMalloc.
TShellMalloc & operator=(const TComRef< IMalloc > &source)
TShellMalloc assignment operator (from TComRef<IMalloc>).
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
void Throw()
Throws the exception object.
static void Check(HRESULT hr, uint resId=IDS_SHELLFAILURE, HANDLE handle=0)
Checks an HResult and throws a TXShell if not SUCCEEDED(hr).
TXShell(uint resId=IDS_SHELLFAILURE, HANDLE handle=0)
Constructs a TXShell object with a default IDS_SHELLFAILURE message.
static void Raise(uint resId=IDS_SHELLFAILURE, HANDLE handle=0)
Constructs a TXShell exception from scratch, and throws it.
TXOwl(const tstring &msg, uint resId=0)
An OWL exception with a given message for displaying and an unsigned Id that can be used for identifi...
Object Windows Library (OWLNext Core).
General definitions used by all ObjectWindows programs.
ObjectWindows exception class & function definitions.
#define CONST_CAST(targetType, object)
#define STATIC_CAST(targetType, object)
Various types of smart pointer templatized classes.
Definition of class TString, a flexible universal string envelope class.
TCreateStruct contains information to construct a TShellItem Typically a TCreateStruct is returned (f...
TCreateStruct()
TShellItem::TCreateStruct default constructor.
TComRef< IShellFolder > ParentFolder