15#if defined(__BORLANDC__)
31 static const tchar shellStr[] =
_T(
"SHELL32.DLL");
32 static const char DragAcceptFilesStr[] =
"DragAcceptFiles";
33 static const char DragFinishStr[] =
"DragFinish";
34 static const char DragQueryPointStr[] =
"DragQueryPoint";
35 static const char SHAddToRecentDocsStr[]=
"SHAddToRecentDocs";
36 static const char SHChangeNotifyStr[] =
"SHChangeNotify";
37 static const char SHGetMallocStr[] =
"SHGetMalloc";
38 static const char SHGetSpecialFolderLocationStr[] =
"SHGetSpecialFolderLocation";
39 static const char SHGetDesktopFolderStr[] =
"SHGetDesktopFolder";
41 static const char DragQueryFileStr[] =
"DragQueryFileW";
42 static const char ExtractIconStr[] =
"ExtractIconW";
43 static const char ShellExecuteStr[] =
"ShellExecuteW";
44 static const char Shell_NotifyIconStr[] =
"Shell_NotifyIconW";
45 static const char SHBrowseForFolderStr[]=
"SHBrowseForFolderW";
46 static const char SHFileOperationStr[] =
"SHFileOperationW";
47 static const char SHGetFileInfoStr[] =
"SHGetFileInfoW";
48 static const char SHGetPathFromIDListStr[] =
"SHGetPathFromIDListW";
50 static const char DragQueryFileStr[] =
"DragQueryFileA";
51 static const char ExtractIconStr[] =
"ExtractIconA";
52 static const char ShellExecuteStr[] =
"ShellExecuteA";
53 static const char Shell_NotifyIconStr[] =
"Shell_NotifyIconA";
54 static const char SHBrowseForFolderStr[]=
"SHBrowseForFolderA";
55 static const char SHFileOperationStr[] =
"SHFileOperationA";
56 static const char SHGetFileInfoStr[] =
"SHGetFileInfoA";
57 static const char SHGetPathFromIDListStr[] =
"SHGetPathFromIDListA";
259 while (
pidl->mkid.cb) {
273 long size =
sizeof(Pidl->mkid.cb);
275 while (
pidl->mkid.cb) {
276 size +=
pidl->mkid.cb;
299 _T(
"IShellMalloc::Alloc failed. IShellMalloc* = ")\
332 for (
int i = 0;
i <
cnt - 1;
i++)
368 long size =
sizeof(Pidl->mkid.cb);
370 for (
i = 0;
i <
cnt - 1;
i++) {
371 size +=
pidl->mkid.cb;
377 void *p =
malloc->Alloc(size);
386 for (
i = 0;
i <
cnt - 1;
i++) {
422 Pidl =
cs.Pidl.GetLastItem();
457 _T(
"::SHGetSpecialFolderLocation failed. kind = ") <<
kind);
492 ParentFolder(
cs.ParentFolder)
520 ParentFolder(
source.ParentFolder)
532 ParentFolder =
source.ParentFolder;
544 ParentFolder =
cs.ParentFolder;
563 HRESULT hr = ParentFolder->GetAttributesOf(1, Pidl, &
req);
565 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
612 cs.ParentFolder = ParentFolder;
629 <<
hex << (
LPVOID)
this <<
_T(
" Parent LPITEMIDLIST = ")
684 0,
"::GetFileInfo returned an invalid exeType. exeType = " <<
exeType);
818 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
866 fo.fAnyOperationsAborted =
FALSE;
867 fo.hNameMappings =
nullptr;
877 if (
rc ||
fo.fAnyOperationsAborted)
942 fo.fAnyOperationsAborted =
FALSE;
943 fo.hNameMappings =
nullptr;
950 if (
rc ||
fo.fAnyOperationsAborted)
955#if defined(BI_DBCS_SUPPORT)
1028 fo.fAnyOperationsAborted =
FALSE;
1029 fo.hNameMappings =
nullptr;
1038 ParentFolder =
nullptr;
1041 if (
rc ||
fo.fAnyOperationsAborted) {
1073 <<
_T(
"failed. TShellItem* = ")
1074 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1101 <<
_T(
"failed. TShellItem* = ")
1102 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1130 <<
_T(
"failed. TShellItem* = ")
1131 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1155 <<
_T(
"failed. TShellItem* = ")
1156 <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1397 rhs.EnforceValidity();
1404 <<
_T(
" this TShellItem* = ") <<
hex << (
LPVOID)
this
1409 hr = ParentFolder->CompareIDs(0, Pidl,
rhs.Pidl);
1411 <<
_T(
" this TShellItem* = ") <<
hex << (
LPVOID)
this
1450 <<
_T(
" TShellItem* = ") <<
hex << (
LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1466 const int kind)
const
1517 cs.Pidl =
pidl.GetLastItem();
1568 cs.ParentFolder = *
this;
1614 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this
1615 <<
_T(
" source IEnumIDList* = ")
1635 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" source IEnumIDList* = ")
1681 WARNX(
OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1682 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1728 WARNX(
OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1729 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1751 WARNX(
OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1752 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1766 WARNX(
OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1767 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1774 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1796 <<
_T(
" TShellItemIterator* = ") <<
hex << (
LPVOID)
this <<
_T(
" IEnumIDList* = ")
1798 <<
_T(
" count = ") << count);
1820 <<
_T(
" TShellItemIterator* = ") <<
hex <<
this <<
_T(
" IEnumIDList* = ")
1846 Skip(index - Index - 1);
1847 else if (Index > index) {
1852 WARNX(
OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1853 <<
_T(
" TShellItemIterator* = ") <<
hex <<
this <<
_T(
" IEnumIDList* = ")
1875 if (list.Index == -1)
1878 while (list.Skip(1), Index != -1)
1891 WARNX(
OwlShell, !
I, 0,
_T(
"TShellItemIterator is not valid (IEnumIDList* == 0).")
1892 <<
_T(
" TShellItemIterator* = ") <<
hex
#define WARNX(group, condition, level, message)
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
TComRef< T > & operator=(T *iface)
Wraps the IDataObject interface (currently lightweight).
Wraps the IDropTarget interface (currently lightweight).
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
static HRESULT CoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID *)
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)
void FreePidl()
Free a pidl with the shell's allocator.
static LPITEMIDLIST Next(LPITEMIDLIST pidl)
Return next item id (in the list)
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.
TPidl StripLastItem() const
Return a TPidl with the last item id stripped off of it.
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.
TShellItem & operator=(const TShellItem &source)
TShellItem assignment (from another TShellItem)
@ Open
Retrieves the shell item's open icon.
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)
void AddToRecentDocs() const
Add to recent docs (Win95 taskbar:Start:Documents)
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...
TDisplayNameKind
Used by TShelItem::GetDisplayName() and TShellItem::Rename() See MS doc for SHGNO for more informatio...
@ 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.
TSpecialFolderKind
Used by TShellItem::TShellItem(const TSpecialFolderKind kind, HWND windowOwner = 0) See MS doc for SH...
@ Desktop
Virtual folder at the root of the namespace.
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.
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)
TPidl GetFullyQualifiedPidl() const
Get fully qualified TPidl.
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.
TAttribute
Used by TShellItem::GetAttributes See MS doc for IShellFolder::GetAttributesOf for more information,...
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.
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 IsDesktop() const
IsDesktop returns true if the TShellItem respresents the shell's desktop.
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.
void EnforceValidInterface() const
EnforceValidInterface is a protected function that checks to see that this TShellItemIterator contain...
@ Folders
For shell browser.
@ NonFolders
For default view.
TShellItemIterator(const TShellItem &folder, HWND windowOwner=0, const int kind=Folders|NonFolders)
TShellItemIterator constructor.
TShellItemIterator & operator=(const TShellItemIterator &source)
Assignment operator.
TShellItem::TCreateStruct Current()
operator Current returns the item pointed to by the "cursor"
void Skip(const ulong count)
Skip count items.
long GetCount() const
Get number of TShellItems in the list.
TShellItem::TCreateStruct operator++()
operator ++ increments the "cursor" in the iterator, then returns the item pointed to by the cursor
TShellItem::TCreateStruct operator--()
operator – decrements the "cursor" in the iterator, then returns the item pointed to by the cursor
void Next()
Next is a protected function that increments the cursor. Equivalent to Skip(1).
TShellItem::TCreateStruct operator[](const long index)
operator [] returns the item at the <index> location.
Wraps the shell's IMalloc interface.
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
TXOwl is root class of the ObjectWindows exception hierarchy.
Base Shell exception class. Handles all TShellItem and related class exceptions.
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.
Object Windows Library (OWLNext Core)
#define CONST_CAST(targetType, object)
#define REINTERPRET_CAST(targetType, object)
#define STATIC_CAST(targetType, object)
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
Definitions of Win95 Shell Clases: TShellItem, TShellItemIterator, TPidl, TShellMalloc.
TCreateStruct contains information to construct a TShellItem Typically a TCreateStruct is returned (f...