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";
67 static TModule shellModule(shellStr,
true,
true,
false);
76 static TModuleProcV2<HWND,BOOL>
77 dragAcceptFiles(
GetModule(), DragAcceptFilesStr);
78 dragAcceptFiles(p1,p2);
86 static TModuleProcV1<HDROP>
96 static TModuleProc4<UINT,HDROP,UINT,LPTSTR,UINT>
97 dragQueryFile(
GetModule(), DragQueryFileStr);
98 return dragQueryFile(p1, p2, p3, p4);
106 static TModuleProc2<BOOL,HDROP,LPPOINT>
107 dragQueryPoint(
GetModule(), DragQueryPointStr);
108 return dragQueryPoint(p1, p2);
116 static TModuleProc3<HICON,HINSTANCE,LPCTSTR,UINT>
117 extractIcon(
GetModule(), ExtractIconStr);
118 return extractIcon(p1, p2, p3);
126 static TModuleProcV2<UINT,LPCVOID>
127 sHAddToRecentDocs(
GetModule(), SHAddToRecentDocsStr);
128 sHAddToRecentDocs(p1, p2);
136 static TModuleProc1<LPITEMIDLIST,LPBROWSEINFO>
137 sHBrowseForFolder(
GetModule(), SHBrowseForFolderStr);
138 return sHBrowseForFolder(p1);
146 static TModuleProcV4<LONG,UINT,LPCVOID,LPCVOID>
147 sHChangeNotify(
GetModule(), SHChangeNotifyStr);
148 sHChangeNotify(p1, p2, p3, p4);
156 static TModuleProc1<int,LPSHFILEOPSTRUCT>
157 sHFileOperation(
GetModule(), SHFileOperationStr);
158 return sHFileOperation(p1);
166 static TModuleProc1<HRESULT,LPSHELLFOLDER*>
167 sHGetDesktopFolder(
GetModule(), SHGetDesktopFolderStr);
168 return sHGetDesktopFolder(p1);
177 static TModuleProc5<UINT,LPCTSTR,DWORD,SHFILEINFO *,UINT,UINT>
178 sHGetFileInfo(
GetModule(), SHGetFileInfoStr);
179 return sHGetFileInfo(p1, p2, p3, p4, p5);
188 static TModuleProc1<HRESULT,LPMALLOC*>
189 sHGetMalloc(
GetModule(), SHGetMallocStr);
190 return sHGetMalloc(p1);
198 static TModuleProc2<BOOL,LPCITEMIDLIST,LPTSTR>
199 sHGetPathFromIDList(
GetModule(), SHGetPathFromIDListStr);
200 return sHGetPathFromIDList(p1, p2);
208 static TModuleProc3<HRESULT,HWND,int,LPITEMIDLIST*>
209 sHGetSpecialFolderLocation(
GetModule(), SHGetSpecialFolderLocationStr);
210 return sHGetSpecialFolderLocation(p1, p2, p3);
219 static TModuleProc6<HINSTANCE,HWND,LPCTSTR,LPCTSTR,LPCTSTR,LPCTSTR,INT>
220 shellExecute(
GetModule(), ShellExecuteStr);
221 return shellExecute(p1, p2, p3, p4, p5, p6);
229 static TModuleProc2<BOOL,DWORD,PNOTIFYICONDATA>
230 shell_NotifyIcon(
GetModule(), Shell_NotifyIconStr);
231 return shell_NotifyIcon(p1, p2);
258 LPITEMIDLIST pidl = Pidl;
259 while (pidl->mkid.cb) {
273 long size =
sizeof(Pidl->mkid.cb);
274 LPITEMIDLIST pidl = Pidl;
275 while (pidl->mkid.cb) {
276 size += pidl->mkid.cb;
291 LPITEMIDLIST newPidl;
295 void *p = malloc->Alloc(
GetSize());
296 newPidl =
reinterpret_cast<LPITEMIDLIST
>(p);
298 WARNX(OwlShell, !newPidl, 0, \
299 _T(
"IShellMalloc::Alloc failed. IShellMalloc* = ")\
303 LPITEMIDLIST pidlSrc = Pidl;
304 LPITEMIDLIST pidlDest = newPidl;
305 while (pidlSrc->mkid.cb) {
306 CopyMemory(pidlDest, pidlSrc, pidlSrc->mkid.cb);
307 pidlDest =
Next(pidlDest);
308 pidlSrc =
Next(pidlSrc);
311 CopyMemory(pidlDest, &zero,
sizeof(
ushort));
331 LPITEMIDLIST pidl = Pidl;
332 for (
int i = 0; i < cnt - 1; i++)
334 LPITEMIDLIST newPidl;
338 void *p = malloc->Alloc(pidl->mkid.cb + sizeof (pidl->mkid.cb));
339 newPidl =
reinterpret_cast<LPITEMIDLIST
>(p);
341 WARNX(OwlShell, !newPidl, 0,
_T(
"IShellMalloc::Alloc failed. IShellMalloc* = ")
346 CopyMemory(newPidl, pidl, pidl->mkid.cb);
347 LPITEMIDLIST pidlDest =
Next(newPidl);
349 CopyMemory(pidlDest, &zero,
sizeof (USHORT));
368 long size =
sizeof(Pidl->mkid.cb);
369 LPITEMIDLIST pidl = Pidl;
370 for (i = 0; i < cnt - 1; i++) {
371 size += pidl->mkid.cb;
374 LPITEMIDLIST newPidl;
377 void *p = malloc->Alloc(size);
378 newPidl =
reinterpret_cast<LPITEMIDLIST
>(p);
380 WARNX(OwlShell, !newPidl, 0,
_T(
"IShellMalloc::Alloc failed. IShellMalloc* = ")
384 LPITEMIDLIST pidlSrc = Pidl;
385 LPITEMIDLIST pidlDest = newPidl;
386 for (i = 0; i < cnt - 1; i++) {
387 CopyMemory(pidlDest, pidlSrc, pidlSrc->mkid.cb);
388 pidlDest =
Next(pidlDest);
389 pidlSrc =
Next(pidlSrc);
392 CopyMemory(pidlDest, &zero,
sizeof (USHORT));
406 :
TComRef<IShellFolder>(nullptr), Pidl(nullptr), ParentFolder(nullptr)
413 WARNX(OwlShell, FAILED(hr), 0,
_T(
"Invalid path. Path = ") << path);
416 if (throwOnInvalidPath)
425 void *p =
STATIC_CAST(IShellFolder**, ParentFolder);
433 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::BindToObject failed. TShellItem* = ")
434 << hex << (LPVOID)
this <<
_T(
" IShellFolder* = ")
447 :
TComRef<IShellFolder>(nullptr), Pidl(nullptr), ParentFolder(nullptr)
449 IShellFolder* desktop;
451 WARNX(OwlShell, FAILED(hr), 0,
_T(
"::SHGetDesktopFolder failed."));
456 WARNX(OwlShell, FAILED(hr), 0, \
457 _T(
"::SHGetSpecialFolderLocation failed. kind = ") << kind);
464 hr = desktop->BindToObject(pidl,
nullptr, IID_IShellFolder,
466 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::BindToObject failed. Desktop IShellFolder* = ")
471 ParentFolder = desktop;
491 :
TComRef<IShellFolder>(nullptr), Pidl(cs.Pidl),
492 ParentFolder(cs.ParentFolder)
502 :
TComRef<IShellFolder>(nullptr), Pidl(pidl), ParentFolder(parentFolder)
511 :
TComRef<IShellFolder>(nullptr), Pidl(pidl), ParentFolder(parentFolder)
519 :
TComRef<IShellFolder>(source), Pidl(source.Pidl),
520 ParentFolder(source.ParentFolder)
529 if (&source !=
this) {
532 ParentFolder = source.ParentFolder;
562 ulong req = reqAttrib | ((validateCachedInfo)? SFGAO_VALIDATE: 0);
563 HRESULT hr = ParentFolder->GetAttributesOf(1, Pidl, &req);
564 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetAttributesOf failed. TShellItem* = ")
565 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
598 return ILIsEmpty(
static_cast<LPCITEMIDLIST
>(pidl));
622 HRESULT hr = desktop->BindToObject(newFullPidl.
StripLastItem(),
nullptr, IID_IShellFolder,
629 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::BindToObject failed. TShellItem* = ")
630 << hex << (LPVOID)
this <<
_T(
" Parent LPITEMIDLIST = ")
653 PIDLIST_ABSOLUTE parentPidl =
nullptr;
654 if (SUCCEEDED(::SHGetIDListFromObject(parentFolder, &parentPidl)))
656 LPITEMIDLIST pidl = ::ILCombine(parentPidl, Pidl);
657 ::ILFree(parentPidl);
658 WARNX(OwlShell, !pidl, 0,
_T(
"::ILCombine failed. TShellItem* = ") << hex << (LPVOID)
this);
688 short exeType = LOWORD(rc);
697 *major = HIBYTE(HIWORD(rc));
699 *minor = LOBYTE(HIWORD(rc));
702 rc && ::strncmp(
"PE", charType, 2) && ::strncmp(
"NE", charType, 2) && ::strncmp(
"MZ", charType, 2),
703 0,
"::GetFileInfo returned an invalid exeType. exeType = " << exeType);
707 else if (!::strncmp(
"PE", charType, 2))
709 else if (!::strncmp(
"NE", charType, 2))
711 else if (!::strncmp(
"MZ", charType, 2))
733 DWORD_PTR rc = ::SHGetFileInfo(
734 reinterpret_cast<const tchar*
>(
static_cast<LPCITEMIDLIST
>(pidl)),
735 0, &fi,
sizeof (fi), SHGFI_TYPENAME | SHGFI_PIDL);
740 typeName = fi.szTypeName;
764 strRet.uType = STRRET_WSTR;
765 HRESULT hr = ParentFolder->GetDisplayNameOf(Pidl, kind, &strRet);
766 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetDisplayNameOf failed. TShellItem* = ")
767 << hex << (LPVOID)
this);
770 switch (strRet.uType) {
774 malloc->Free(strRet.pOleStr);
781 s =
reinterpret_cast<const char*
>(
static_cast<LPCITEMIDLIST
>(Pidl)) + strRet.uOffset;
797 WARNX(OwlShell, !success, 0,
"::SHGetPathFromIDList failed. TShellItem* = "
798 << hex << (LPVOID)
this);
827 memset(oldPath, 0,
sizeof(oldPath));
831 memset(newPath, 0,
sizeof (newPath));
835 HRESULT hr = ParentFolder->SetNameOf(windowOwner, Pidl,
TString(newName), kind, &pidl);
836 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::SetNameOf failed. TShellItem* = ")
837 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
865 const USHORT flags,
const tchar* title,
866 HWND windowOwner)
const
874 fo.hwnd = windowOwner;
877 ::memset(srcPath, 0,
sizeof (srcPath));
881 ::memset(destPath, 0,
sizeof (destPath));
885 fo.fAnyOperationsAborted = FALSE;
886 fo.hNameMappings =
nullptr;
887 fo.lpszProgressTitle = title;
890 fo.fFlags |= FOF_MULTIDESTFILES;
896 if (rc || fo.fAnyOperationsAborted)
920 HWND windowOwner)
const
949 fo.hwnd = windowOwner;
953 ::memset(oldPath, 0,
sizeof (oldPath));
957 ::memset(destPath, 0,
sizeof (destPath));
961 fo.fAnyOperationsAborted = FALSE;
962 fo.hNameMappings =
nullptr;
963 fo.lpszProgressTitle = title;
969 if (rc || fo.fAnyOperationsAborted)
974#if defined(BI_DBCS_SUPPORT)
975 if (*
AnsiPrev(newPath, newPath + ::strlen(newPath)) !=
'\\')
1009 const tchar* title, HWND windowOwner)
1039 fo.hwnd = windowOwner;
1040 fo.wFunc = FO_DELETE;
1042 memset(path, 0,
sizeof (path));
1047 fo.fAnyOperationsAborted = FALSE;
1048 fo.hNameMappings =
nullptr;
1049 fo.lpszProgressTitle = title;
1057 ParentFolder =
nullptr;
1060 if (rc || fo.fAnyOperationsAborted) {
1082 IExtractIcon* iface;
1086 HRESULT hr = ParentFolder->GetUIObjectOf(windowOwner, 1, Pidl, IID_IExtractIcon,
1091 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetUIObjectOf(IExtractIcon) ")
1092 <<
_T(
"failed. TShellItem* = ")
1093 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1110 IContextMenu* iface;
1114 HRESULT hr = ParentFolder->GetUIObjectOf(windowOwner, 1, Pidl, IID_IContextMenu,
1119 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetUIObjectOf(IContextMenu) ")
1120 <<
_T(
"failed. TShellItem* = ")
1121 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1142 HRESULT hr = ParentFolder->GetUIObjectOf(windowOwner, 1, Pidl, IID_IDataObject
1148 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetUIObjectOf(IDataObject) ")
1149 <<
_T(
"failed. TShellItem* = ")
1150 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1167 HRESULT hr = ParentFolder->GetUIObjectOf(windowOwner, 1, Pidl, IID_IDropTarget
1173 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::GetUIObjectOf(IDropTarget) ")
1174 <<
_T(
"failed. TShellItem* = ")
1175 << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1195 uint inFlags = (size &
Shell)? GIL_FORSHELL: 0 | (kind &
Open)? GIL_OPENICON: 0;
1203 HRESULT hr = extractIcon->GetIconLocation(inFlags, fileName,
COUNTOF(fileName),
1207 if (outFlags & GIL_NOTFILENAME || outFlags & GIL_DONTCACHE) {
1208 hr = extractIcon->Extract(fileName, index, &largeIcon, &smallIcon, GetSystemMetrics(SM_CXICON));
1211 return (size ==
Small)? smallIcon: largeIcon;
1221 uint flags = SHGFI_ICON | kind | size;
1224 0, &fi,
sizeof (fi), flags | SHGFI_PIDL);
1225 WARNX(OwlShell, !fi.hIcon, 0,
_T(
"::SHGetFileInfo failed. TShellItem* = ")
1226 << hex << (LPVOID)
this);
1258 hr = shellLink->QueryInterface(IID_IPersistFile,
1262 hr = persistFile->Load(shortcutFile, STGM_READ);
1265 hr = shellLink->Resolve(windowOwner, SLR_ANY_MATCH | SLR_UPDATE);
1273 hr = shellLink->GetIDList(resolvedPidl);
1315 hr = shellLink->SetPath(
TString(objPath));
1317 hr = shellLink->SetDescription(
TString(description));
1324 hr = shellLink->QueryInterface(IID_IPersistFile,
1330 hr = persistFile->Save(
TString(pathLink), TRUE);
1352 shellLink->SetIDList(pidl);
1353 shellLink->SetDescription(description);
1359 hr = shellLink->QueryInterface(IID_IPersistFile,
1365 hr = persistFile->Save(
TString(pathLink), TRUE);
1419 HRESULT hr = desktop.ParseDisplayName(cs, name);
1439 hr = desktop->
CompareIDs(0, GetNormalizedPidl(*
this), GetNormalizedPidl(rhs));
1440 WARNX(OwlShell, FAILED(hr), 0,
_T(
"Desktop->CompareIDs failed.")
1441 <<
_T(
" this TShellItem* = ") << hex << (LPVOID)
this
1442 <<
_T(
" other TShellItem* = ") << (LPVOID)&rhs);
1446 hr = ParentFolder->CompareIDs(0, Pidl, rhs.Pidl);
1447 WARNX(OwlShell, FAILED(hr), 0,
_T(
"SameParent->CompareIDs failed.")
1448 <<
_T(
" this TShellItem* = ") << hex << (LPVOID)
this
1449 <<
_T(
" other TShellItem* = ") << (LPVOID)&rhs);
1463 WARNX(OwlShell, !
Valid(), 0,
_T(
"TShellItem is not valid.")
1464 <<
_T(
" TShellItem* = ") << hex << (LPVOID)
this);
1483 IShellFolder* iface;
1484 HRESULT hr = ParentFolder->BindToObject(Pidl,
nullptr, IID_IShellFolder,
1486 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::BindToObject failed.")
1487 <<
_T(
" TShellItem* = ") << hex << (LPVOID)
this <<
_T(
" Parent IShellFolder* = ")
1503 const int kind)
const
1509 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::EnumObjects failed.")
1510 <<
_T(
" TShellItem* = ") << hex << (LPVOID)
this);
1527 const tchar* title,
const UINT flags,
int* image,
1528 const bool includeStatus, BFFCALLBACK func,
1529 const LPARAM param)
const
1536 bi.hwndOwner = windowOwner;
1538 bi.pidlRoot = fullPidl;
1539 bi.pszDisplayName = displayName;
1540 bi.lpszTitle = title;
1543 bi.ulFlags |= BIF_STATUSTEXT;
1558 HRESULT hr = desktop->BindToObject(pidl.
StripLastItem(),
nullptr, IID_IShellFolder
1564 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellFolder::BindToObject failed.")
1565 <<
_T(
" TShellItem* = ") << hex << (LPVOID)
this
1566 <<
_T(
" Desktop IShellFolder* = ") <<
STATIC_CAST(IShellFolder*, desktop));
1587 ulong* eaten, HWND windowOwner,
1588 ulong* attrib)
const
1596 HRESULT hr =
I->ParseDisplayName(windowOwner,
nullptr,
TString(displayName),
1597 &charsEaten, pidl, &attributes);
1599 if (hr == NOERROR) {
1601 *eaten = charsEaten;
1603 *attrib = attributes;
1642 Index(source.Index),
1644 Folder(source.Folder)
1649 HRESULT hr = source.I->Clone(*this);
1650 WARNX(OwlShell, FAILED(hr), 0, _T(
"IEnumIDList::Clone failed.")
1651 << _T(
" TShellItemIterator* = ") << hex << (LPVOID)this
1652 << _T(
" source IEnumIDList* = ")
1653 << STATIC_CAST(IEnumIDList*, CONST_CAST(TShellItemIterator&, source)));
1654 TXShell::Check(hr, IDS_CLONEFAIL);
1666 if (&source !=
this) {
1670 HRESULT hr = source.
I->Clone(*
this);
1671 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IEnumIDList::Clone failed.")
1672 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" source IEnumIDList* = ")
1675 Index = source.Index;
1677 Folder = source.Folder;
1687TShellItemIterator::operator IEnumIDList**()
1718 WARNX(OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1719 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1765 WARNX(OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1766 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1788 WARNX(OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1789 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1803 WARNX(OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1804 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1809 HRESULT hr =
I->Next(1, Pidl,
nullptr);
1810 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellItemIterator::Next failed.")
1811 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1831 HRESULT hr =
I->Skip(count);
1832 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellItemIterator::Skip failed.")
1833 <<
_T(
" TShellItemIterator* = ") << hex << (LPVOID)
this <<
_T(
" IEnumIDList* = ")
1835 <<
_T(
" count = ") << count);
1855 HRESULT hr =
I->Reset();
1856 WARNX(OwlShell, FAILED(hr), 0,
_T(
"IShellItemIterator::Reset failed.")
1857 <<
_T(
" TShellItemIterator* = ") << hex <<
this <<
_T(
" IEnumIDList* = ")
1883 Skip(index - Index - 1);
1884 else if (Index > index) {
1889 WARNX(OwlShell, Index == -1, 0,
_T(
"Attempt to read past end of TShellItemIterator")
1890 <<
_T(
" TShellItemIterator* = ") << hex <<
this <<
_T(
" IEnumIDList* = ")
1912 if (list.Index == -1)
1915 while (list.Skip(1), Index != -1)
1928 WARNX(OwlShell, !
I, 0,
_T(
"TShellItemIterator is not valid (IEnumIDList* == 0).")
1929 <<
_T(
" TShellItemIterator* = ") << hex
1964 TXShell(resId, handle).Throw();
1973 Raise(resID, handle);
#define WARNX(group, condition, level, message)
TComRef< T > & operator=(T *iface)
Wraps the IDataObject interface (currently lightweight).
TDataObject(IDataObject *iface=0)
Default constructor for TDataObject.
Wraps the IDropTarget interface (currently lightweight).
TDropTarget(IDropTarget *iface=0)
Default constructor for TDropTarget.
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.
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, 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.
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...
TString(const char *s=0)
Construct a TString from any type of string.
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.
static tstring MakeMessage(uint resId, const tstring &infoStr, TModule *module=&GetGlobalModule())
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).
DIAG_DEFINE_GROUP_INIT(OWL_INI, OwlApp, 1, 0)
#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...
TComRef< IShellFolder > ParentFolder