OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
shellitm.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definitions of Win95 Shell Clases:
7/// TShellItem, TShellItemIterator, TPidl, TShellMalloc
8///
9/// Also the following lightweight "wrapper" classes are defined:
10/// TExtractIcon, TContextMenu, TDataObject, TDropTarget
11///
12/// These are wrapper classes for the Win95 deskop.
13//----------------------------------------------------------------------------
14
15#if !defined(OWL_SHELLITM_H)
16#define OWL_SHELLITM_H
17
18#include <owl/defs.h>
19#if defined(BI_HAS_PRAGMA_ONCE)
20# pragma once
21#endif
22
23
24#include <owl/except.h>
25#include <owl/pointer.h>
26#include <owl/string.h>
27
28#if defined(BI_COMP_MSC)
29#pragma warning(push)
30#pragma warning(disable:4091) // warning C4091: 'typedef ': ignored on left of '' when no variable is declared
31#endif
32
33#include <shlobj.h>
34
35#if defined(BI_COMP_MSC)
36#pragma warning(pop)
37#endif
38
39namespace owl {
40
41#include <owl/preclass.h>
42
43/// \addtogroup winsys
44/// @{
45
46//
47/// \class TShell
48// ~~~~~ ~~~~~~
49/// delay loading SHELL32.DLL/SHELL.DLL
51 public:
52 static void DragAcceptFiles(HWND,BOOL);
53 static void DragFinish(HDROP);
54 static UINT DragQueryFile(HDROP,UINT,LPTSTR,UINT);
55 static BOOL DragQueryPoint(HDROP,LPPOINT);
56 static HICON ExtractIcon(HINSTANCE,LPCTSTR,UINT);
57 static HINSTANCE ShellExecute(HWND,LPCTSTR,LPCTSTR,LPCTSTR,LPCTSTR,INT);
58
59 static void SHAddToRecentDocs(UINT, LPCVOID);
60 static LPITEMIDLIST SHBrowseForFolder(LPBROWSEINFO);
61 static void SHChangeNotify(LONG,UINT,LPCVOID,LPCVOID);
62 static DWORD SHGetFileInfo(LPCTSTR,DWORD,SHFILEINFO *,UINT,UINT);
63 static int SHFileOperation(LPSHFILEOPSTRUCT);
64 static HRESULT SHGetDesktopFolder(LPSHELLFOLDER*);
65 static HRESULT SHGetMalloc(LPMALLOC*);
66 static BOOL SHGetPathFromIDList(LPCITEMIDLIST,LPTSTR);
67 static HRESULT SHGetSpecialFolderLocation(HWND,int,LPITEMIDLIST*);
68 static BOOL Shell_NotifyIcon(DWORD,PNOTIFYICONDATA);
69
70 static TModule& GetModule();
71};
72
73//
74/// \class TShellMalloc
75// ~~~~~ ~~~~~~~~~~~~
76/// Wraps the shell's IMalloc interface.
77/// Default constructor obtains shell's IMalloc interface.
78/// TComRef<IMalloc> and copy constructors supplied.
79/// TComRef<IMalloc> and TShellMalloc assignment operators also supplied.
80//
81//
82class TShellMalloc: public TComRef<IMalloc> {
83 public:
85 TShellMalloc(const TComRef<IMalloc>& source);
86 TShellMalloc(const TShellMalloc& source);
89};
90
91//
92/// \class TExtractIcon
93// ~~~~~ ~~~~~~~~~~~~
94/// Wraps the IExtractIcon interface (currently lightweight).
95/// A TExtractIcon is returned by TShellItem::GetExtractIcon.
96/// Default, TComRef<IExtractIcon> and copy constructors supplied.
97/// TComRef<IExtractIcon> and TExtractIcon assignment opreators also supplied.
98//
99class TExtractIcon: public TComRef<IExtractIcon> {
100 public:
101 TExtractIcon(IExtractIcon* iface = 0);
102 TExtractIcon(const TComRef<IExtractIcon>& source);
103 TExtractIcon(const TExtractIcon& source);
105 TExtractIcon& operator= (const TExtractIcon& source);
106};
107
108//
109/// \class TContextMenu
110// ~~~~~ ~~~~~~~~~~~~
111/// Wraps the IContextMenu interface (currently lightweight).
112/// A TContextMenu is returned by TShellItem::GetContextMenu.
113/// Default, TComRef<IContextMenu> and copy constructors supplied.
114/// TComRef<IContextMenu> and TContextMenu assignment opreators also supplied.
115//
116class TContextMenu: public TComRef<IContextMenu> {
117 public:
118 TContextMenu(IContextMenu* iface = 0);
119 TContextMenu(const TComRef<IContextMenu>& source);
120 TContextMenu(const TContextMenu& source);
122 TContextMenu& operator = (const TContextMenu& source);
123};
124
125//
126/// \class TDataObject
127// ~~~~~ ~~~~~~~~~~~
128/// Wraps the IDataObject interface (currently lightweight).
129/// A TDataObject is returned by TShellItem::GetDataObject.
130/// Default, TComRef<IDataObject> and copy constructors supplied.
131/// TComRef<IDataObject> and TDataObject assignment opreators also supplied.
132//
133class TDataObject: public TComRef<IDataObject> {
134 public:
135 TDataObject(IDataObject* iface = 0);
136 TDataObject(const TComRef<IDataObject>& source);
137 TDataObject(const TDataObject& source);
139 TDataObject& operator = (const TDataObject& source);
140};
141
142//
143/// \class TDropTarget
144// ~~~~~ ~~~~~~~~~~~
145/// Wraps the IDropTarget interface (currently lightweight).
146/// A TDropTarget is returned by TShellItem::GetDropTarget.
147/// Default, TComRef<IDropTarget> and copy constructors supplied.
148/// TComRef<IDropTarget> and TDropTarget assignment opreators also supplied.
149//
150class TDropTarget: public TComRef<IDropTarget> {
151 public:
152 TDropTarget(IDropTarget* iface = 0);
153 TDropTarget(const TComRef<IDropTarget>& source);
154 TDropTarget(const TDropTarget& source);
156 TDropTarget& operator = (const TDropTarget& source);
157};
158
159//
160/// \class TPidl
161// ~~~~~ ~~~~~
162/// TPidl is an item identifier list class (ITEMIDLIST). Its constructor takes an
163/// LPITEMIDLIST (a.k.a., pidl). The copy constructor and assignement operators
164/// supplied function to manipulate the ITEMIDLIST, get the size, get the number of
165/// items in the list, etc, supplied. Normally, the programmer will not have to be
166/// concerned with ITEMIDLISTs nor with the TPidl class. The TShellItem class hides
167/// all this.
168//
170 public:
171 static LPITEMIDLIST Next(LPITEMIDLIST pidl);
172
173 // TPidl constructors and destructor
174 //
175 TPidl(LPITEMIDLIST pidl = 0);
176 TPidl(const TPidl& source);
177 virtual ~TPidl();
178
179 // Assignment operators
180 //
181 TPidl& operator = (const TPidl& source);
182 TPidl& operator = (LPITEMIDLIST pidl);
183
184 // Test to see if valid pidl
185 bool operator !() const;
186
187 /// Use TPidl in place of pidl
188 //
189 operator LPCITEMIDLIST () const;
190 operator LPITEMIDLIST ();
191
192 /// Use TPidl in place of pointer to a pidl
193 //
194 operator LPCITEMIDLIST* () const;
195 operator LPITEMIDLIST* ();
196
197 /// Get size (in bytes) of a pidl
198 //
199 ulong GetSize() const;
200
201 /// Get number of item ids in the TPidl (the TPidl can be a list of ids)
202 //
203 long GetItemCount() const;
204
205 /// Get the last item id in the TPidl
206 //
207 TPidl GetLastItem() const;
208
209 /// Return a TPidl with the last item id stripped off of it
210 //
211 TPidl StripLastItem() const;
212
213 /// Copy a pidl
214 //
215 LPITEMIDLIST CopyPidl() const;
216
217 protected:
218 /// Free a pidl with the shell's allocator
219 //
220 void FreePidl();
221
223
224 /// A PIDL
225 //
226 LPITEMIDLIST Pidl;
227};
228
229//
230/// \class TShellItem
231// ~~~~~ ~~~~~~~~~~
232/// An item in the shell's name space. All items in the shell's
233/// namespace can be identified by a fully qualified pidl. Another
234/// way to uniquely identify an item is via it's parent and an item id
235/// (i.e., a single item rather than a list). A TShellItem contains a
236/// parent (TComRef<IShellFolder> ParentFolder) and the item id (TPidl pidl)
237//
238class _OWLCLASS TShellItem: public TComRef<IShellFolder> {
239 public:
240 /// Used by TShelItem::GetDisplayName() and TShellItem::Rename()
241 /// See MS doc for SHGNO for more information, Programmer's
242 /// Guide to MS Windows 95, MS Press, p. 218.
243 //
245 Normal = SHGDN_NORMAL, ///< File object displayed by itself.
246 InFolder = SHGDN_INFOLDER, ///< File object displayed within a folder.
247 ForParsing = SHGDN_FORPARSING ///< File object suitable for parsing.
248 };
249 /// Used by TShellItem::GetIcon
250 /// See MS doc for SHGetFileInfo for more information, Programmer's
251 /// Guide to MS Windows 95, MS Press, pp. 205-207.
252 enum TIconSize { Large = SHGFI_LARGEICON, ///< Retrieves the shell item's large icon
253 Small = SHGFI_SMALLICON, ///< Retrieves the shell item's small icon
254 Shell = SHGFI_SHELLICONSIZE ///< Retrieves the shell-sized icon (if unavailable, the normal icon
255 ///< is sized according to the system metric values)
256 };
257
258 /// Used by TShellItem::GetIcon
259 /// See MS doc for SHGetFileInfo for more information, Programmer's
260 /// Guide to MS Windows 95, MS Press, pp. 205-207.
261 //
263 Link = SHGFI_LINKOVERLAY, ///< Adds the link overlay to the shell item's icon
264 Open = SHGFI_OPENICON, ///< Retrieves the shell item's open icon
265 Selected = SHGFI_SELECTED ///< Blends the shell item's icon with the system highlight color
266 };
267
268 /// Used by TShellItem::TShellItem(const TSpecialFolderKind kind,
269 /// HWND windowOwner = 0)
270 /// See MS doc for SHGetSpecialFolderLocation for more information,
271 /// Programmer's Guide to MS Windows 95, MS Press, pp. 209-210.
272 //
274 RecycleBin = CSIDL_BITBUCKET, ///< Directory containing file objects in the user's recycle bin
275 ControlPanel = CSIDL_CONTROLS, ///< Virtual folder containing icons for the Control Panel
276 Desktop = CSIDL_DESKTOP, ///< Virtual folder at the root of the namespace
277 DesktopFileDir = CSIDL_DESKTOPDIRECTORY, ///< Directory used to physically store file objects on the desktop
278 MyComputer = CSIDL_DRIVES, ///< Virtual folder containing everything on the local computer
279 Fonts = CSIDL_FONTS, ///< Virtual folder containing fonts
280 NetworkNeighborhoodFileDir = CSIDL_NETHOOD, ///< Directory containing objects that appeat in the Network Neighborhood
281 NetworkNeighborhood = CSIDL_NETWORK, ///< Virtual folder representing the top level of the network hierarchy
282 CommonDocuments = CSIDL_PERSONAL, ///< Directory that serves as a repository for common documents
283 Printers = CSIDL_PRINTERS, ///< Virtual folder containing installed printers
284 Programs = CSIDL_PROGRAMS, ///< Directory containing the user's program groups
285 RecentDocuments = CSIDL_RECENT, ///< Directory containing the user's most recently used documents
286 SendTo = CSIDL_SENDTO, ///< Directory containing Send To menu items
287 StartMenu = CSIDL_STARTMENU, ///< Directory containing Start menu items
288 Startup = CSIDL_STARTUP, ///< Directory that corresponds to the user's Startup program group
289 CommonTemplates = CSIDL_TEMPLATES, ///< Directory that serves as a repository for document templates
290 Favorites = CSIDL_FAVORITES ///<
291 };
292
293 /// Used by TShellItem::GetAttributes
294 /// See MS doc for IShellFolder::GetAttributesOf for more information,
295 /// Programmer's Guide to MS Windows 95, MS Press, pp. 194-196.
296 //
298 // Capabilities
299 //
300 atCapabilityMask = SFGAO_CAPABILITYMASK, ///< Mask for the capability flags
301 atCanBeCopied = SFGAO_CANCOPY, ///< The shell item can be copied
302 atCanBeDeleted = SFGAO_CANDELETE, ///< The shell item can be deleted
303 atCanCreateShortcut = SFGAO_CANLINK, ///< Shortcuts can be created for the shell item
304 atCanBeMoved = SFGAO_CANMOVE, ///< The shell item can be moved
305 atCanBeRenamed = SFGAO_CANRENAME, ///< The shell item can be renamed
306 atIsADropTarget = SFGAO_DROPTARGET, ///< The shell item is a drop target
307 atHasAPropertySheet = SFGAO_HASPROPSHEET, ///< The shell item has a property sheet
308
309 // Display Attributes
310 //
311 atDisplayAttributeMask = SFGAO_DISPLAYATTRMASK, ///< Mask for the display attributes
312 atDisplayGhosted = SFGAO_GHOSTED, ///< The shell item should be displayed using a ghosted icon
313 atIsShortcut = SFGAO_LINK, ///< The shell item is a shortcut
314 atIsReadOnly = SFGAO_READONLY, ///< The shell item is readonly
315 atIsShared = SFGAO_SHARE, ///< The shell item is shared
316
317 // Contents
318 //
319 atContentsMask = SFGAO_CONTENTSMASK, ///< Mask for the contents attributes
320 atContainsSubFolder = SFGAO_HASSUBFOLDER, ///< The shell item has subfolders
321
322 // Miscellaneous
323 //
324 atContainsFileSystemFolder = SFGAO_FILESYSANCESTOR, ///< The shell item contains one or more system folders
325 atIsPartOfFileSystem = SFGAO_FILESYSTEM, ///< The shell item is part of the file system
326 atIsFolder = SFGAO_FOLDER, ///< The shell item is a folder
327 atCanBeRemoved = SFGAO_REMOVABLE ///< The shell item is on removable media
328 };
329
330 /// Used by TShellItem::Rename,Copy,Move,Delete
331 /// See MS doc for SHFILEOPSTRUCT for more information, Programmer's
332 /// Guide to MS Windows 95, MS Press, pp. 214-215.
333 //
335 AllowUndo = FOF_ALLOWUNDO, ///< Preserves undo information (if possible)
336 NoConfirmation = FOF_NOCONFIRMATION, ///< Responds with "yes to all" for any dialog
337 NoConfirmMkDir = FOF_NOCONFIRMMKDIR, ///< No confirmation on the creation of a new directory
338 RenameOnCollision = FOF_RENAMEONCOLLISION, ///< Renames the file being operated on if a file of the same name already exists (i.e., Copy #1 of ...)
339 Silent = FOF_SILENT, ///< No progess dialog box is displayed
340 SimpleProgress = FOF_SIMPLEPROGRESS ///< A simple progress dialog box is diaplayed (no file names)
341 };
342
343 /// Used by TShellItem::BrowseForFolder
344 ///
345 /// See the Windows API documentation for `BROWSEINFO.ulFlags` for more information about these
346 /// flags, as well as additional flags that may be used.
347 ///
348 /// \sa <a href="https://learn.microsoft.com/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfow" target="blank_">
349 /// ::%BROWSEINFO</a>
350 //
352 {
353 OnlyComputers = BIF_BROWSEFORCOMPUTER, ///< Returns only computers.
354 OnlyPrinters = BIF_BROWSEFORPRINTER, ///< Returns only printers.
355 NoNetorkFoldersBelowDomain = BIF_DONTGOBELOWDOMAIN, ///< Does not return network folders below the domain.
356 OnlyFSAncestors = BIF_RETURNFSANCESTORS, ///< Returns only file system ancestors.
357 OnlyFSDirs = BIF_RETURNONLYFSDIRS ///< Returns only file system directories.
358 };
359
360 /// Returned by TShellItem::GetExeType
361 /// See MS doc for SHGetFileInfo for more information, Programmer's
362 /// Guide to MS Windows 95, MS Press, pp. 205-207.
363 //
364 enum TExeKind {
365 NonExecutable, ///< Nonexecutable file or an error condition
366 WindowsNE, ///< Windows-based application
367 WindowsPE, ///< Windows level (3.0, 3.5, or 4.0)
368 MSDOS, ///< MS-DOS .EXE, .COM, or .BAT file
369 Win32Console ///< Win32-based console application
370 };
371
372 /// TCreateStruct contains information to construct a TShellItem
373 /// Typically a TCreateStruct is returned (for example by GetParentFolder)
374 /// and this TCreateStruct is used to construct a TshellItem
375 /// Passed in as arguments to:
376 /// - TShellItem::TShellItem(const TCreateStruct& cs)
377 /// - TShellItem::operator =(const TCreateStruct& cs)
378 /// Returned as an out argument by:
379 /// - TShellItem::BrowseForFolder
380 /// - TShellItem::ParseDisplayName
381 /// Returned by:
382 /// - TShellItem::GetParentFolder
383 /// - TShellItemIterator::operator ++ ();
384 /// - TShellItemIterator::operator ++ (int);
385 /// - TShellItemIterator::operator -- ();
386 /// - TShellItemIterator::operator -- (int);
387 /// - TShellItemIterator::operator [] (const long index);
388 /// - TShellItemIterator::Current();
389 //
398
399 // Constructors for TShellItem
400 //
401 TShellItem(const tchar* path, bool throwOnInvalidPath = true, HWND windowOwner = 0);
402 TShellItem(const TSpecialFolderKind kind, HWND windowOwner = 0);
403 TShellItem(const TCreateStruct& cs); // used with TShellItemIterator
404 TShellItem(const TPidl& Pidl, const TComRef<IShellFolder>& parentFolder);
405 TShellItem(LPITEMIDLIST pidl = nullptr, const TComRef<IShellFolder>& parentFolder = TComRef<IShellFolder>(nullptr));
406 TShellItem(const TShellItem& source);
407
408 // Assignment operators
409 //
410 TShellItem& operator =(const TShellItem& source);
411 TShellItem& operator =(const TCreateStruct& cs);
412
413 /// Determine if TShellItem reprsents a valid item
414 //
415 bool Valid() const;
416
417 /// Allow TShellItems to be used in place of pidls
418 operator LPCITEMIDLIST() const; // 05/26/98 Yura Bidus
419
420 // Get TExtractIcon, TContextMenu, TDataObject, TDropTarget for a TShellItem
421 TExtractIcon GetExtractIcon(HWND windowOwner = 0);
422 TContextMenu GetContextMenu(HWND windowOwner = 0);
423 TDataObject GetDataObject(HWND windowOwner = 0);
424 TDropTarget GetDropTarget(HWND windowOwner = 0);
425 HICON GetIcon(TIconSize size = Shell, uint kind = 0);
426
427 /// Get Attributes of a TShellItem
428 /// GetAttributes - Get Capabilities, Display, Contents, & Misc. Attributes with one call
429 //
430 ulong GetAttributes(const ulong reqAttrib, const bool validateCachedInfo = false) const;
431
432 // Attributes - Capabilties
433 //
434 bool CanBeCopied(const bool validateCachedInfo = false) const;
435 bool CanBeDeleted(const bool validateCachedInfo = false) const;
436 bool CanCreateShortcut(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;
440 bool HasAPropertySheet(const bool validateCachedInfo = false)const;
441
442 // Attributes - Display
443 //
444 bool DisplayGhosted(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;
448
449 // Attributes - Contents
450 //
451 bool ContainsSubFolder(const bool validateCachedInfo = false) const;
452
453 // Attributes - Miscellaneous
454 //
455 bool ContainsFileSystemFolder(const bool validateCachedInfo = false) const;
456 bool IsPartOfFileSystem(const bool validateCachedInfo = false) const;
457 bool IsFolder(const bool validateCachedInfo = false) const;
458 bool CanBeRemoved(const bool validateCachedInfo = false) const;
459
460 // Attributes - Additional (Not part of GetAttributes)
461 //
462 bool IsDesktop() const;
463
464 /// Get TPidl (relative to parent)
465 //
466 TPidl GetPidl() const;
467
468 /// Get fully qualified TPidl
469 //
471
472 /// Get Parent Folder
473 //
475
476 /// Get type of executable file (may return NonExecutable)
477 //
478 TExeKind GetExeType(uint* major = 0, uint* minor = 0) const;
479
480 /// Get type of file (e.g., "Borland C++ Header File", "Notepad File")
481 //
482 TString GetTypeName() const;
483
484 /// Get Displayname (for a TShellItem that's part of the filesystem, this is the filename)
485 //
486 TString GetDisplayName(const TDisplayNameKind kind = Normal) const;
487
488 /// Get path (only call if the TShellItem is part of the file system (IsPartOfFileSystem == true)
489 //
490 TString GetPath() const;
491
492 // File Opertations (Rename, Copy, Move, Delete)
493 //
494 void Rename(const tchar* newName, HWND windowOwner = 0,
495 const TDisplayNameKind kind = Normal);
496 bool Copy(const tchar* dest, const bool destIsFolder = true,
497 const USHORT flags = 0, const tchar* title = 0,
498 HWND windowOwner = 0) const;
499 bool Copy(const TShellItem& dest, const USHORT flags = 0, const tchar* title = 0,
500 HWND windowOwner = 0) const;
501 bool Move(const tchar* destFolder, const USHORT flags = 0,
502 const tchar* title = 0, HWND windowOwner = 0);
503 bool Move(const TShellItem& destFolder, const USHORT flags = 0,
504 const tchar* title = 0, HWND windowOwner = 0);
505 bool Delete(const USHORT flags = 0, const tchar* title = 0,
506 HWND windowOwner = 0);
507
508 /// Add to recent docs (Win95 taskbar:Start:Documents)
509 //
510 void AddToRecentDocs() const;
511
512 /// Get the TShellItem that a shortcut points to
513 //
514 TShellItem ResolveShortcut(HWND windowOwner = 0);
515
516 // Create a shortcut
517 // TODO: Add string-aware overloads.
518 //
519 static HRESULT CreateShortCut(LPCTSTR objPath, LPTSTR pathLink,
520 LPTSTR description);
521 static HRESULT CreateShortCut(LPCITEMIDLIST pidl, LPTSTR pathLink,
522 LPTSTR description);
523 TShellItem CreateShortCut(LPTSTR pathLink, LPTSTR description);
524
525 // Pidl compares (so that they can be ordered)
526 //
527 bool operator==(const TShellItem& rhs) const;
528 bool operator!=(const TShellItem& rhs) const;
529 bool operator<(const TShellItem& rhs) const;
530 bool operator<=(const TShellItem& rhs) const;
531 bool operator>(const TShellItem& rhs) const;
532 bool operator>=(const TShellItem& rhs) const;
533
534 // Folder Only Functions
535 // EnumObjects is called by TShellItemIterator
536 //
537 void EnumObjects(IEnumIDList** iface, HWND windowOwner = 0,
538 const int kind = -1) const;
539 /// Select a Foler under this TShellItem
540 //
541 bool BrowseForFolder(TCreateStruct& cs, HWND windowOwner = 0,
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;
545
546 /// Parse a display name into a TShellItem (actually, into a TCreateStruct)
547 //
548 HRESULT ParseDisplayName(TCreateStruct& cs, const tchar* displayName,
549 ulong* eaten = nullptr, HWND windowOwner = nullptr,
550 ulong* attrib = nullptr) const;
551 protected:
552 // CompareIDs is used by the pidl compare functions above
553 //
554 short CompareIDs(const TShellItem& rhs) const;
555 void EnforceValidity() const;
556 void RetrieveIShellFolder() const;
557 bool HaveSameParent(const TShellItem& other) const;
558 bool GetAttribute(const TAttribute at, const bool validateCachedInfo) const;
560 TPidl Pidl;
561 TComRef<IShellFolder> ParentFolder;
562};
563
564//
565/// \class TShellItemIterator
566// ~~~~~ ~~~~~~~~~~~~~~~~~~
567/// TShellItemIterator is an interator for walking through the contents of a folder.
568/// A folder is a TShellItem whose IsFolder or ContainsSubFolder attributes are true.
569//
570class _OWLCLASS TShellItemIterator: public TComRef<IEnumIDList> {
571 public:
572 /// Used by TShellItemIterator::TShellItemIterator(const TShellItem& folder,
573 /// HWND windowOwner = 0, const UINT kind = Folders | NonFolders)
574 /// See MS doc for SHCONTF for more information, Programmer's Guide to
575 /// MS Windows 95, MS Press, p. 213.
577 Folders = SHCONTF_FOLDERS, ///< For shell browser
578 NonFolders = SHCONTF_NONFOLDERS, ///< For default view
579 HiddenAndSystem = SHCONTF_INCLUDEHIDDEN ///< For hidden or system objects
580 };
581
582 // constructor for TShellItemIterator
583 //
584 TShellItemIterator(const TShellItem& folder, HWND windowOwner = 0,
585 const int kind = Folders | NonFolders);
587
588 /// Assignment operator
589 //
590 TShellItemIterator& operator= (const TShellItemIterator& source);
591
592 /// True if iterator is still valid
593 //
594 bool Valid() const;
595
596 /// Get number of TShellItems in the list
597 //
598 long GetCount() const;
599
600 // Get next item, previous item, item at index, and current item
601 //
602 TShellItem::TCreateStruct operator ++ ();
603 TShellItem::TCreateStruct operator ++ (int);
604 TShellItem::TCreateStruct operator -- ();
605 TShellItem::TCreateStruct operator -- (int);
606 TShellItem::TCreateStruct operator [] (const long index);
608
609 /// Skip count items
610 //
611 void Skip(const ulong count);
612
613 /// Reset list
614 //
615 void Reset();
616
617 protected:
618 void Next();
619 void EnforceValidInterface() const;
620
622 long Index;
623 TPidl Pidl;
625 operator IEnumIDList**();
626};
627
628//
629/// \class TXShell
630// ~~~~~ ~~~~~~~
631/// Base Shell exception class. Handles all TShellItem and related class exceptions
632//
633class _OWLCLASS TXShell: public TXOwl {
634 public:
635 // Constructor for TXShell
636 //
637 TXShell(uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
638
639 // Clone a TXShell
640 //
641 TXShell* Clone();
642
643 // Throw an exception
644 //
645 void Throw();
646
647 // Construct a TXShell exception from scratch, and throw it.
648 //
649 static void Raise(uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
650
651 // Check an HRESULT and throw a TXShell if not SUCCEEDED(hr)
652 //
653 static void Check(HRESULT hr, uint resId = IDS_SHELLFAILURE, HANDLE handle = 0);
654};
655
656/// @}
657
658#include <owl/posclass.h>
659
660
661//----------------------------------------------------------------------------
662// Inline implementations
663//
664
665/// Default constructor for TShellMalloc. For more info, see MS doc for
666/// SHGetMalloc (Prog. Guide to MS Win95, p. 208)
667//
669{
670 HRESULT hr = TShell::SHGetMalloc(*this);
671 TXShell::Check(hr, IDS_SHGETMALLOCFAIL);
672}
673
674/// TShellMalloc constructor to construct from TComRef<IMalloc>
675//
677 :TComRef<IMalloc>(source)
678{
679}
680
681/// TShellMalloc copy constructor
682//
684 :TComRef<IMalloc>(source)
685{
686}
687
688/// TShellMalloc assignment operator (from TComRef<IMalloc>)
689//
690inline TShellMalloc&
692{
693 if (&source != this)
695 return *this;
696}
697
698/// TShellMalloc assignment operator (from another TShellMalloc)
699//
700inline TShellMalloc&
702{
703 if (&source != this)
705 return *this;
706}
707
708/// Default constructor for TExtractIcon
709//
710inline TExtractIcon::TExtractIcon(IExtractIcon* iface)
711 :TComRef<IExtractIcon>(iface)
712{
713}
714
715/// TExtractIcon constructor to construct from TComRef<IExtractIcon>
716//
718 :TComRef<IExtractIcon>(source)
719{
720}
721
722/// TExtractIcon copy constructor
723//
725 :TComRef<IExtractIcon>(source)
726{
727}
728
729/// TExtractIcon assignment operator (from TComRef<IExtractIcon>)
730//
731inline TExtractIcon&
733{
734 if (&source != this)
736 return *this;
737}
738
739/// TExtractIcon assignment operator (from another TExtractIcon)
740//
741inline TExtractIcon&
743{
744 if (&source != this)
746 return *this;
747}
748
749/// Default constructor for TContextMenu
750//
751inline TContextMenu::TContextMenu(IContextMenu* iface)
752 :TComRef<IContextMenu>(iface)
753{
754}
755
756/// TContextMenu constructor to construct from TComRef<IContextMenu>
757//
759 :TComRef<IContextMenu>(source)
760{
761}
762
763/// TContextMenu copy constructor
764//
766 :TComRef<IContextMenu>(source)
767{
768}
769
770/// TContextMenu assignment operator (from TComRef<IContextMenu>)
771//
772inline TContextMenu&
774{
775 if (&source != this)
777 return *this;
778}
779
780/// TContextMenu assignment operator (from another TContextMenu)
781//
782inline TContextMenu&
784{
785 if (&source != this)
787 return *this;
788}
789
790/// Default constructor for TDataObject
791//
792inline TDataObject::TDataObject(IDataObject* iface)
793:
794 TComRef<IDataObject>(iface)
795{
796}
797
798/// TDataObject constructor to construct from TComRef<IDataObject>
799//
801 :TComRef<IDataObject>(source)
802{
803}
804
805/// TDataObject copy constructor
806//
808 :TComRef<IDataObject>(source)
809{
810}
811
812/// TDataObject assignment operator (from TComRef<IDataObject>)
813//
814inline TDataObject&
816{
817 if (&source != this)
819 return *this;
820}
821
822/// TDataObject assignment operator (from another TDataObject)
823//
824inline TDataObject&
826{
827 if (&source != this)
829 return *this;
830}
831
832/// Default constructor for TDropTarget
833//
834inline TDropTarget::TDropTarget(IDropTarget* iface)
835 :TComRef<IDropTarget>(iface)
836{
837}
838
839/// TDropTarget constructor to construct from TComRef<IDropTarget>
840//
842 :TComRef<IDropTarget>(source)
843{
844}
845
846/// TDropTarget copy constructor
847//
849 :TComRef<IDropTarget>(source)
850{
851}
852
853/// TDropTarget assignment operator (from TComRef<IDropTarget>)
854//
855inline TDropTarget&
857{
858 if (&source != this)
860 return *this;
861}
862
863/// TDropTarget assignment operator (from another TDropTarget)
864//
865inline TDropTarget&
867{
868 if (&source != this)
870 return *this;
871}
872
873/// Check to see if TPidl represents an ITEMIDLIST (return true if it does not)
874//
875inline bool TPidl::operator !() const
876{
877 return Pidl == nullptr;
878}
879
880/// Return next item id (in the list)
881//
882inline LPITEMIDLIST
883TPidl::Next(LPITEMIDLIST pidl)
884{
885 return reinterpret_cast<LPITEMIDLIST>(reinterpret_cast<char*>(pidl) + pidl->mkid.cb);
886}
887
888/// TPidl copy constructor
889//
890inline TPidl::TPidl(const TPidl& source)
891 :Pidl(source.CopyPidl())
892{
893}
894
895/// Construct a TPidl from an LPITEMIDLIST (pidl)
896//
897inline TPidl::TPidl(LPITEMIDLIST pidl)
898 :Pidl(pidl)
899{
900}
901
902/// TPidl assignement operator (from another TPidl)
903//
904inline TPidl&
906{
907 if (&source == this)
908 return *this;
909 LPITEMIDLIST copy = source.CopyPidl();
910 FreePidl();
911 Pidl = copy;
912 return *this;
913}
914
915/// TPidl assignement operator (from an LPITEMIDLIST (pidl))
916/// Takes ownership of the given PIDL; the previously owned PIDL is freed.
917//
918inline TPidl&
919TPidl::operator =(LPITEMIDLIST pidl)
920{
921 if (pidl == Pidl)
922 return *this;
923 FreePidl();
924 Pidl = pidl;
925 return *this;
926}
927
928/// TPidl destructor
929//
931{
932 FreePidl();
933}
934
935inline TPidl::operator LPCITEMIDLIST() const
936{
937 return Pidl;
938}
939
940inline TPidl::operator LPITEMIDLIST()
941{
942 return Pidl;
943}
944
945inline TPidl::operator LPCITEMIDLIST*() const
946{
947 return const_cast<LPCITEMIDLIST*>(&Pidl);
948}
949
950inline TPidl::operator LPITEMIDLIST*()
951{
952 if (Pidl)
953 FreePidl();
954 return &Pidl;
955}
956
957/// Return true if the TShellItem represents an item in the namespace
958//
959inline bool TShellItem::Valid() const
960{
961 return !!Pidl && !!ParentFolder;
962}
963
964// Attributes - Capabilties
965
966/// Return true if the TShellItem represents an item that can be copied
967//
968inline bool TShellItem::CanBeCopied(const bool validateCachedInfo) const
969{
970 return GetAttribute(atCanBeCopied, validateCachedInfo);
971}
972
973/// Return true if the TShellItem represents an item that can be deleted
974//
975inline bool TShellItem::CanBeDeleted(const bool validateCachedInfo) const
976{
977 return GetAttribute(atCanBeDeleted, validateCachedInfo);
978}
979
980/// Return true if the TShellItem represents an item for which a shortcut can
981/// be created
982//
983inline bool TShellItem::CanCreateShortcut(const bool validateCachedInfo) const
984{
985 return GetAttribute(atCanCreateShortcut, validateCachedInfo);
986}
987
988/// Return true if the TShellItem represents an item that can be moved
989//
990inline bool TShellItem::CanBeMoved(const bool validateCachedInfo) const
991{
992 return GetAttribute(atCanBeMoved, validateCachedInfo);
993}
994
995/// Return true if the TShellItem represents an item that can be renamed
996//
997inline bool TShellItem::CanBeRenamed(const bool validateCachedInfo) const
998{
999 return GetAttribute(atCanBeRenamed, validateCachedInfo);
1000}
1001
1002/// Return true if the TShellItem represents an item is a drop target
1003//
1004inline bool TShellItem::IsADropTarget(const bool validateCachedInfo) const
1005{
1006 return GetAttribute(atIsADropTarget, validateCachedInfo);
1007}
1008
1009/// Return true if the TShellItem represents an item that has a property sheet
1010//
1011inline bool TShellItem::HasAPropertySheet(const bool validateCachedInfo) const
1012{
1013 return GetAttribute(atHasAPropertySheet, validateCachedInfo);
1014}
1015
1016// Attributes - Display
1017
1018/// Return true if the TShellItem represents an item that should be displayed
1019/// as ghosted
1020//
1021inline bool TShellItem::DisplayGhosted(const bool validateCachedInfo) const
1022{
1023 return GetAttribute(atDisplayGhosted, validateCachedInfo);
1024}
1025
1026/// Return true if the TShellItem represents an item that is a shortcut
1027//
1028inline bool TShellItem::IsShortcut(const bool validateCachedInfo) const
1029{
1030 return GetAttribute(atIsShortcut, validateCachedInfo);
1031}
1032
1033/// Return true if the TShellItem represents an item that is read only
1034//
1035inline bool TShellItem::IsReadOnly(const bool validateCachedInfo) const
1036{
1037 return GetAttribute(atIsReadOnly, validateCachedInfo);
1038}
1039
1040/// Return true if the TShellItem represents an item that is shared
1041//
1042inline bool TShellItem::IsShared(const bool validateCachedInfo) const
1043{
1044 return GetAttribute(atIsShared, validateCachedInfo);
1045}
1046
1047// Attributes - Contents
1048
1049/// Return true if the TShellItem represents an item that contains a subfolder
1050//
1051inline bool TShellItem::ContainsSubFolder(const bool validateCachedInfo) const
1052{
1053 return GetAttribute(atContainsSubFolder, validateCachedInfo);
1054}
1055
1056// Attributes - Miscellaneous
1057
1058/// Return true if the TShellItem represents an item that contains a file system folder
1059//
1060inline bool TShellItem::ContainsFileSystemFolder(const bool validateCachedInfo) const
1061{
1062 return GetAttribute(atContainsFileSystemFolder, validateCachedInfo);
1063}
1064
1065/// Return true if the TShellItem represents an item that is part of the file system
1066//
1067inline bool TShellItem::IsPartOfFileSystem(const bool validateCachedInfo) const
1068{
1069 return GetAttribute(atIsPartOfFileSystem, validateCachedInfo);
1070}
1071
1072/// Return true if the TShellItem represents an item that is a folder
1073//
1074inline bool TShellItem::IsFolder(const bool validateCachedInfo) const
1075{
1076 return GetAttribute(atIsFolder, validateCachedInfo);
1077}
1078
1079/// Return true if the TShellItem represents an item that can be removed
1080//
1081inline bool TShellItem::CanBeRemoved(const bool validateCachedInfo) const
1082{
1083 return GetAttribute(atCanBeRemoved, validateCachedInfo);
1084}
1085
1086/// TShellItem::TCreateStruct default constructor
1087//
1091
1092/// TShellItem::TCreateStruct constructor (takes a TPidl and TComRef<IShellFolder>
1093//
1095 TPidl& pidl, TComRef<IShellFolder>& parentFolder)
1096:
1097 Pidl(pidl),
1098 ParentFolder(parentFolder)
1099{
1100}
1101
1102/// TShellItem::TCreateStruct copy constructor
1103//
1105:
1106Pidl(source.Pidl),
1108{
1109}
1110
1111/// use TShellItem in place of an LPITEMIDLIST (pidl)
1112//
1113inline TShellItem::operator LPCITEMIDLIST() const
1114{
1115 return Pidl;
1116}
1117
1118/// Get a TShellItem's TPidl
1119//
1121{
1122 return Pidl; // Return a copy
1123}
1124
1125/// Compare sort order of this TShellItem equals another TShellItem
1126//
1127inline bool TShellItem::operator ==(const TShellItem& rhs) const
1128{
1129 return CompareIDs(rhs) == 0;
1130}
1131
1132/// Compare sort order of this TShellItem is less than another TShellItem
1133//
1134inline bool TShellItem::operator <(const TShellItem& rhs) const
1135{
1136 return CompareIDs(rhs) < 0;
1137}
1138
1139/// Compare sort order of this TShellItem is greater than another TShellItem
1140//
1141inline bool TShellItem::operator >(const TShellItem& rhs) const
1142{
1143 return CompareIDs(rhs) > 0;
1144}
1145
1146/// Compare sort order of this TShellItem is not equal to another TShellItem
1147//
1148inline bool TShellItem::operator !=(const TShellItem& rhs) const
1149{
1150 return !operator==(rhs);
1151}
1152
1153/// Compare sort order of this TShellItem <= another TShellItem
1154//
1155inline bool TShellItem::operator <=(const TShellItem& rhs) const
1156{
1157 return !operator>(rhs);
1158}
1159
1160/// Compare sort order of this TShellItem >= another TShellItem
1161//
1162inline bool TShellItem::operator >=(const TShellItem& rhs) const
1163{
1164 return !operator<(rhs);
1165}
1166
1167/// HaveSameParent returns true if this TShellItem and other TShellItem have the
1168/// same immediate parent folder.
1169//
1170inline bool TShellItem::HaveSameParent(const TShellItem& other) const
1171{
1172 TShellItem* constThis = CONST_CAST(TShellItem*, this);
1173 TShellItem* constOther = CONST_CAST(TShellItem*, &other);
1174
1175 return STATIC_CAST(IShellFolder*, constThis->ParentFolder) ==
1176 STATIC_CAST(IShellFolder*, constOther->ParentFolder);
1177}
1178
1179/// Return true if TShellItemIterator is valid and not at end of list of items
1180//
1181inline bool TShellItemIterator::Valid() const
1182{
1183 return Index != -1;
1184}
1185
1186} // OWL namespace
1187
1188#endif // OWL_SHELLITM_H
1189
TComRef< T > & operator=(T *iface)
Definition pointer.h:230
Wraps the IContextMenu interface (currently lightweight).
Definition shellitm.h:116
TContextMenu & operator=(const TComRef< IContextMenu > &source)
TContextMenu assignment operator (from TComRef<IContextMenu>).
Definition shellitm.h:773
TContextMenu(IContextMenu *iface=0)
Default constructor for TContextMenu.
Definition shellitm.h:751
Wraps the IDataObject interface (currently lightweight).
Definition shellitm.h:133
TDataObject(IDataObject *iface=0)
Default constructor for TDataObject.
Definition shellitm.h:792
TDataObject & operator=(const TComRef< IDataObject > &source)
TDataObject assignment operator (from TComRef<IDataObject>).
Definition shellitm.h:815
Wraps the IDropTarget interface (currently lightweight).
Definition shellitm.h:150
TDropTarget & operator=(const TComRef< IDropTarget > &source)
TDropTarget assignment operator (from TComRef<IDropTarget>).
Definition shellitm.h:856
TDropTarget(IDropTarget *iface=0)
Default constructor for TDropTarget.
Definition shellitm.h:834
Wraps the IExtractIcon interface (currently lightweight).
Definition shellitm.h:99
TExtractIcon(IExtractIcon *iface=0)
Default constructor for TExtractIcon.
Definition shellitm.h:710
TExtractIcon & operator=(const TComRef< IExtractIcon > &source)
TExtractIcon assignment operator (from TComRef<IExtractIcon>).
Definition shellitm.h:732
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
TPidl is an item identifier list class (ITEMIDLIST).
Definition shellitm.h:169
long GetItemCount() const
Get number of item ids in the TPidl (the TPidl can be a list of ids).
Definition shellitm.cpp:253
TPidl(LPITEMIDLIST pidl=0)
Construct a TPidl from an LPITEMIDLIST (pidl).
Definition shellitm.h:897
virtual ~TPidl()
TPidl destructor.
Definition shellitm.h:930
void FreePidl()
Free a pidl with the shell's allocator.
Definition shellitm.cpp:239
static LPITEMIDLIST Next(LPITEMIDLIST pidl)
Return next item id (in the list).
Definition shellitm.h:883
TPidl & operator=(const TPidl &source)
TPidl assignement operator (from another TPidl).
Definition shellitm.h:905
ulong GetSize() const
Get size (in bytes) of a pidl.
Definition shellitm.cpp:271
TPidl GetLastItem() const
Get the last item id in the TPidl.
Definition shellitm.cpp:325
LPITEMIDLIST CopyPidl() const
Copy a pidl.
Definition shellitm.cpp:286
bool operator!() const
Check to see if TPidl represents an ITEMIDLIST (return true if it does not).
Definition shellitm.h:875
TPidl StripLastItem() const
Return a TPidl with the last item id stripped off of it.
Definition shellitm.cpp:358
delay loading SHELL32.DLL/SHELL.DLL
Definition shellitm.h:50
static void DragFinish(HDROP)
Invokes 'DragFinish' indirectly.
Definition shellitm.cpp:84
static HRESULT SHGetMalloc(LPMALLOC *)
Invokes 'SHGetMalloc' indirectly.
Definition shellitm.cpp:186
static void SHChangeNotify(LONG, UINT, LPCVOID, LPCVOID)
Invokes 'SHChangeNotify' indirectly.
Definition shellitm.cpp:144
static HRESULT SHGetDesktopFolder(LPSHELLFOLDER *)
Invokes 'SHGetDesktopFolder' indirectly.
Definition shellitm.cpp:164
static void SHAddToRecentDocs(UINT, LPCVOID)
Invokes 'SHAddToRecentDocs' indirectly.
Definition shellitm.cpp:124
static BOOL SHGetPathFromIDList(LPCITEMIDLIST, TCHAR *)
Invokes 'SHGetPathFromIDList' indirectly.
Definition shellitm.cpp:196
static int SHFileOperation(LPSHFILEOPSTRUCT)
Invokes 'SHFileOperation' indirectly.
Definition shellitm.cpp:154
static void DragAcceptFiles(HWND, BOOL)
Invokes 'DragAcceptFiles' indirectly.
Definition shellitm.cpp:74
static HRESULT SHGetSpecialFolderLocation(HWND, int, LPITEMIDLIST *)
Invokes 'SHGetSpecialFolderLocation' indirectly.
Definition shellitm.cpp:206
static LPITEMIDLIST SHBrowseForFolder(LPBROWSEINFO)
Invokes 'SHBrowseForFolder' indirectly.
Definition shellitm.cpp:134
static HINSTANCE ShellExecute(HWND, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, INT)
Invokes 'ShellExecute' indirectly.
Definition shellitm.cpp:216
static BOOL DragQueryPoint(HDROP, LPPOINT)
Invokes 'DragQueryPoint' indirectly.
Definition shellitm.cpp:104
static TModule & GetModule()
Returns TModule object wrapping the handle of the SHELL[32].DLL module.
Definition shellitm.cpp:65
static UINT DragQueryFile(HDROP, UINT, TCHAR *, UINT)
Invokes 'DragQueryFile' indirectly.
Definition shellitm.cpp:94
static BOOL Shell_NotifyIcon(DWORD, PNOTIFYICONDATA)
Invokes 'Shell_NotifyIcon' indirectly.
Definition shellitm.cpp:227
static HICON ExtractIcon(HINSTANCE, LPCTSTR, UINT)
Invokes 'ExtractIcon' indirectly.
Definition shellitm.cpp:114
static DWORD SHGetFileInfo(LPCTSTR, DWORD, SHFILEINFO *, UINT, UINT)
Invokes 'SHGetFileInfo' indirectly.
Definition shellitm.cpp:174
An item in the shell's name space.
Definition shellitm.h:238
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.
Definition shellitm.h:1028
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.
Definition shellitm.cpp:405
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.
Definition shellitm.h:997
bool ContainsSubFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that contains a subfolder.
Definition shellitm.h:1051
bool HasAPropertySheet(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that has a property sheet.
Definition shellitm.h:1011
TIconKind
Used by TShellItem::GetIcon See MS doc for SHGetFileInfo for more information, Programmer's Guide to ...
Definition shellitm.h:262
@ Open
Retrieves the shell item's open icon.
Definition shellitm.h:264
@ Selected
Blends the shell item's icon with the system highlight color.
Definition shellitm.h:265
@ Link
Adds the link overlay to the shell item's icon.
Definition shellitm.h:263
bool ContainsFileSystemFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that contains a file system folder.
Definition shellitm.h:1060
bool CanCreateShortcut(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item for which a shortcut can be created.
Definition shellitm.h:983
bool CanBeCopied(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be copied.
Definition shellitm.h:968
TExeKind
Returned by TShellItem::GetExeType See MS doc for SHGetFileInfo for more information,...
Definition shellitm.h:364
@ WindowsPE
Windows level (3.0, 3.5, or 4.0).
Definition shellitm.h:367
@ WindowsNE
Windows-based application.
Definition shellitm.h:366
@ MSDOS
MS-DOS .EXE, .COM, or .BAT file.
Definition shellitm.h:368
@ Win32Console
Win32-based console application.
Definition shellitm.h:369
@ NonExecutable
Nonexecutable file or an error condition.
Definition shellitm.h:365
TString GetDisplayName(const TDisplayNameKind kind=Normal) const
Get Displayname (for a TShellItem that's part of the filesystem, this is the filename).
Definition shellitm.cpp:758
bool operator!=(const TShellItem &rhs) const
Compare sort order of this TShellItem is not equal to another TShellItem.
Definition shellitm.h:1148
bool CanBeRemoved(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be removed.
Definition shellitm.h:1081
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.
Definition shellitm.h:1021
bool operator<(const TShellItem &rhs) const
Compare sort order of this TShellItem is less than another TShellItem.
Definition shellitm.h:1134
bool operator==(const TShellItem &rhs) const
Compare sort order of this TShellItem equals another TShellItem.
Definition shellitm.h:1127
bool HaveSameParent(const TShellItem &other) const
HaveSameParent returns true if this TShellItem and other TShellItem have the same immediate parent fo...
Definition shellitm.h:1170
TIconSize
Used by TShellItem::GetIcon See MS doc for SHGetFileInfo for more information, Programmer's Guide to ...
Definition shellitm.h:252
@ Small
Retrieves the shell item's small icon.
Definition shellitm.h:253
@ Shell
Retrieves the shell-sized icon (if unavailable, the normal icon is sized according to the system metr...
Definition shellitm.h:254
@ Large
Retrieves the shell item's large icon.
Definition shellitm.h:252
TDisplayNameKind
Used by TShelItem::GetDisplayName() and TShellItem::Rename() See MS doc for SHGNO for more informatio...
Definition shellitm.h:244
@ Normal
File object displayed by itself.
Definition shellitm.h:245
@ InFolder
File object displayed within a folder.
Definition shellitm.h:246
@ ForParsing
File object suitable for parsing.
Definition shellitm.h:247
TCreateStruct GetParentFolder() const
Get Parent Folder.
Definition shellitm.cpp:606
TPidl GetPidl() const
Get TPidl (relative to parent).
Definition shellitm.h:1120
bool GetAttribute(const TAttribute at, const bool validateCachedInfo) const
GetAttribute is a protected function used by all the attribute functions except IsDesktop.
Definition shellitm.cpp:579
bool IsADropTarget(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item is a drop target.
Definition shellitm.h:1004
TSpecialFolderKind
Used by TShellItem::TShellItem(const TSpecialFolderKind kind, HWND windowOwner = 0) See MS doc for SH...
Definition shellitm.h:273
@ DesktopFileDir
Directory used to physically store file objects on the desktop.
Definition shellitm.h:277
@ RecentDocuments
Directory containing the user's most recently used documents.
Definition shellitm.h:285
@ Fonts
Virtual folder containing fonts.
Definition shellitm.h:279
@ Desktop
Virtual folder at the root of the namespace.
Definition shellitm.h:276
@ SendTo
Directory containing Send To menu items.
Definition shellitm.h:286
@ NetworkNeighborhood
Virtual folder representing the top level of the network hierarchy.
Definition shellitm.h:281
@ CommonTemplates
Directory that serves as a repository for document templates.
Definition shellitm.h:289
@ CommonDocuments
Directory that serves as a repository for common documents.
Definition shellitm.h:282
@ RecycleBin
Directory containing file objects in the user's recycle bin.
Definition shellitm.h:274
@ StartMenu
Directory containing Start menu items.
Definition shellitm.h:287
@ ControlPanel
Virtual folder containing icons for the Control Panel.
Definition shellitm.h:275
@ Startup
Directory that corresponds to the user's Startup program group.
Definition shellitm.h:288
@ Printers
Virtual folder containing installed printers.
Definition shellitm.h:283
@ Programs
Directory containing the user's program groups.
Definition shellitm.h:284
@ NetworkNeighborhoodFileDir
Directory containing objects that appeat in the Network Neighborhood.
Definition shellitm.h:280
@ MyComputer
Virtual folder containing everything on the local computer.
Definition shellitm.h:278
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).
Definition shellitm.cpp:679
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.
Definition shellitm.h:352
@ OnlyFSDirs
Returns only file system directories.
Definition shellitm.h:357
@ OnlyPrinters
Returns only printers.
Definition shellitm.h:354
@ OnlyFSAncestors
Returns only file system ancestors.
Definition shellitm.h:356
@ OnlyComputers
Returns only computers.
Definition shellitm.h:353
@ NoNetorkFoldersBelowDomain
Does not return network folders below the domain.
Definition shellitm.h:355
bool CanBeDeleted(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be deleted.
Definition shellitm.h:975
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).
Definition shellitm.cpp:940
bool IsShared(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is shared.
Definition shellitm.h:1042
TPidl GetFullyQualifiedPidl() const
Get fully qualified TPidl.
Definition shellitm.cpp:649
bool IsReadOnly(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is read only.
Definition shellitm.h:1035
bool operator>(const TShellItem &rhs) const
Compare sort order of this TShellItem is greater than another TShellItem.
Definition shellitm.h:1141
TString GetPath() const
Get path (only call if the TShellItem is part of the file system (IsPartOfFileSystem == true).
Definition shellitm.cpp:792
bool IsPartOfFileSystem(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is part of the file system.
Definition shellitm.h:1067
bool IsFolder(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that is a folder.
Definition shellitm.h:1074
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.
Definition shellitm.cpp:864
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.
Definition shellitm.h:1155
TAttribute
Used by TShellItem::GetAttributes See MS doc for IShellFolder::GetAttributesOf for more information,...
Definition shellitm.h:297
@ atCanBeRenamed
The shell item can be renamed.
Definition shellitm.h:305
@ atIsFolder
The shell item is a folder.
Definition shellitm.h:326
@ atIsShortcut
The shell item is a shortcut.
Definition shellitm.h:313
@ atIsShared
The shell item is shared.
Definition shellitm.h:315
@ atDisplayGhosted
The shell item should be displayed using a ghosted icon.
Definition shellitm.h:312
@ atContainsSubFolder
The shell item has subfolders.
Definition shellitm.h:320
@ atIsReadOnly
The shell item is readonly.
Definition shellitm.h:314
@ atCanCreateShortcut
Shortcuts can be created for the shell item.
Definition shellitm.h:303
@ atDisplayAttributeMask
Mask for the display attributes.
Definition shellitm.h:311
@ atCanBeDeleted
The shell item can be deleted.
Definition shellitm.h:302
@ atHasAPropertySheet
The shell item has a property sheet.
Definition shellitm.h:307
@ atIsPartOfFileSystem
The shell item is part of the file system.
Definition shellitm.h:325
@ atContentsMask
Mask for the contents attributes.
Definition shellitm.h:319
@ atContainsFileSystemFolder
The shell item contains one or more system folders.
Definition shellitm.h:324
@ atCanBeRemoved
The shell item is on removable media.
Definition shellitm.h:327
@ atCanBeCopied
The shell item can be copied.
Definition shellitm.h:301
@ atCapabilityMask
Mask for the capability flags.
Definition shellitm.h:300
@ atIsADropTarget
The shell item is a drop target.
Definition shellitm.h:306
@ atCanBeMoved
The shell item can be moved.
Definition shellitm.h:304
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.
Definition shellitm.h:959
TFileOpFlags
Used by TShellItem::Rename,Copy,Move,Delete See MS doc for SHFILEOPSTRUCT for more information,...
Definition shellitm.h:334
@ SimpleProgress
A simple progress dialog box is diaplayed (no file names).
Definition shellitm.h:340
@ RenameOnCollision
Renames the file being operated on if a file of the same name already exists (i.e....
Definition shellitm.h:338
@ NoConfirmation
Responds with "yes to all" for any dialog.
Definition shellitm.h:336
@ AllowUndo
Preserves undo information (if possible).
Definition shellitm.h:335
@ Silent
No progess dialog box is displayed.
Definition shellitm.h:339
@ NoConfirmMkDir
No confirmation on the creation of a new directory.
Definition shellitm.h:337
bool CanBeMoved(const bool validateCachedInfo=false) const
Return true if the TShellItem represents an item that can be moved.
Definition shellitm.h:990
ulong GetAttributes(const ulong reqAttrib, const bool validateCachedInfo=false) const
Get Attributes of a TShellItem GetAttributes - Get Capabilities, Display, Contents,...
Definition shellitm.cpp:559
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.
Definition shellitm.cpp:817
TString GetTypeName() const
Get type of file (e.g., "Borland C++ Header File", "Notepad File").
Definition shellitm.cpp:727
bool operator>=(const TShellItem &rhs) const
Compare sort order of this TShellItem >= another TShellItem.
Definition shellitm.h:1162
bool IsDesktop() const
IsDesktop returns true if the TShellItem respresents the shell's desktop, i.e.
Definition shellitm.cpp:594
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.
Definition shellitm.h:570
TIncludeKind
Used by TShellItemIterator::TShellItemIterator(const TShellItem& folder, HWND windowOwner = 0,...
Definition shellitm.h:576
@ HiddenAndSystem
For hidden or system objects.
Definition shellitm.h:579
@ Folders
For shell browser.
Definition shellitm.h:577
@ NonFolders
For default view.
Definition shellitm.h:578
TShellItemIterator(const TShellItem &folder, HWND windowOwner=0, const int kind=Folders|NonFolders)
TShellItemIterator constructor.
bool Valid() const
True if iterator is still valid.
Definition shellitm.h:1181
Wraps the shell's IMalloc interface.
Definition shellitm.h:82
TShellMalloc()
Default constructor for TShellMalloc.
Definition shellitm.h:668
TShellMalloc & operator=(const TComRef< IMalloc > &source)
TShellMalloc assignment operator (from TComRef<IMalloc>).
Definition shellitm.h:691
Reference to reference counted string object TUString Lightweight reference object consisting of a po...
Definition string.h:67
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 * Clone()
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...
Definition except.cpp:123
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
unsigned long ulong
Definition number.h:26
char tchar
Definition defs.h:77
unsigned int uint
Definition number.h:25
General definitions used by all ObjectWindows programs.
#define protected_data
Definition defs.h:208
ObjectWindows exception class & function definitions.
#define CONST_CAST(targetType, object)
Definition defs.h:273
#define _OWLCLASS
Definition defs.h:338
#define STATIC_CAST(targetType, object)
Definition defs.h:271
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...
Definition shellitm.h:390
TCreateStruct()
TShellItem::TCreateStruct default constructor.
Definition shellitm.h:1088
TComRef< IShellFolder > ParentFolder
Definition shellitm.h:396