ReactOS 0.4.15-dev-6703-g6528ab8
explorerband.cpp
Go to the documentation of this file.
1/*
2 * ReactOS Explorer
3 *
4 * Copyright 2016 Sylvain Deverre <deverre dot sylv at gmail dot com>
5 * Copyright 2020 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include "precomp.h"
23#include <commoncontrols.h>
24#include <undocshell.h>
25
26#if 1
27#undef UNIMPLEMENTED
28
29#define UNIMPLEMENTED DbgPrint("%s is UNIMPLEMENTED!\n", __FUNCTION__)
30#endif
31
32/*
33 * TODO:
34 * - Monitor correctly "external" shell interrupts (seems like we need to register/deregister them for each folder)
35 * - find and fix what cause explorer crashes sometimes (seems to be explorer that does more releases than addref)
36 * - TESTING
37 */
38
39typedef struct _PIDLDATA
40{
44
45#define PT_GUID 0x1F
46#define PT_SHELLEXT 0x2E
47#define PT_YAGUID 0x70
48
50{
51 LPPIDLDATA lpPData = (LPPIDLDATA)&pidl->mkid.abID;
52
53 return (pidl &&
54 ((lpPData && (PT_GUID == lpPData->type || PT_SHELLEXT== lpPData->type ||
55 PT_YAGUID == lpPData->type)) || (pidl && pidl->mkid.cb == 0x00)));
56}
57
59{
60 IShellFolder *pShellFolder = NULL;
61 LPCITEMIDLIST pidlRelative = NULL;
62 STRRET str;
63 HRESULT hr;
64
65 if (pidlDirectory == NULL || szDisplayName == NULL)
66 {
67 return E_FAIL;
68 }
69
70 hr = SHBindToParent(pidlDirectory, IID_PPV_ARG(IShellFolder, &pShellFolder), &pidlRelative);
71
72 if (SUCCEEDED(hr))
73 {
74 hr = pShellFolder->GetDisplayNameOf(pidlRelative,uFlags,&str);
75 if (SUCCEEDED(hr))
76 {
77 hr = StrRetToBuf(&str,pidlDirectory,szDisplayName,cchMax);
78 }
79 pShellFolder->Release();
80 }
81 return hr;
82}
83
84/*
85 This is a Windows hack, because shell event messages in Windows gives an
86 ill-formed PIDL stripped from useful data that parses incorrectly with SHGetFileInfo.
87 So we need to re-enumerate subfolders until we find one with the same name.
88 */
90{
91 HRESULT hr;
94 CComPtr<IEnumIDList> pEnumIDList;
95 LPITEMIDLIST childPidl;
96 LPITEMIDLIST correctChild;
97 LPITEMIDLIST correctParent;
98 ULONG fetched;
99 DWORD EnumFlags;
100
101
102 EnumFlags = SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN;
103 hr = SHBindToParent(buggyPidl, IID_PPV_ARG(IShellFolder, &folder), (LPCITEMIDLIST*)&childPidl);
104 *cleanPidl = NULL;
105 if (!SUCCEEDED(hr))
106 {
107 ERR("Can't bind to parent folder\n");
108 return hr;
109 }
110 hr = folder->QueryInterface(IID_PPV_ARG(IPersistFolder2, &persist));
111 if (!SUCCEEDED(hr))
112 {
113 ERR("PIDL doesn't belong to the shell namespace, aborting\n");
114 return hr;
115 }
116
117 hr = persist->GetCurFolder(&correctParent);
118 if (!SUCCEEDED(hr))
119 {
120 ERR("Unable to get current folder\n");
121 return hr;
122 }
123
124 hr = folder->EnumObjects(NULL,EnumFlags,&pEnumIDList);
125 // avoid broken IShellFolder implementations that return null pointer with success
126 if (!SUCCEEDED(hr) || !pEnumIDList)
127 {
128 ERR("Can't enum the folder !\n");
129 return hr;
130 }
131
132 while(SUCCEEDED(pEnumIDList->Next(1, &correctChild, &fetched)) && correctChild && fetched)
133 {
134 if (!folder->CompareIDs(0, childPidl, correctChild))
135 {
136 *cleanPidl = ILCombine(correctParent, correctChild);
137 ILFree(correctChild);
138 goto Cleanup;
139 }
140 ILFree(correctChild);
141 }
142Cleanup:
143 ILFree(correctParent);
144 return hr;
145}
146
148 : m_pSite(NULL)
149 , m_fVisible(FALSE)
150 , m_bNavigating(FALSE)
151 , m_dwBandID(0)
152 , m_isEditing(FALSE)
153 , m_pidlCurrent(NULL)
154{
155}
156
158{
159 if (m_pidlCurrent)
160 {
162 }
163}
164
166{
167 // Init the treeview here
168 HRESULT hr;
169 LPITEMIDLIST pidl;
170 CComPtr<IWebBrowser2> browserService;
172
175 return;
176
177 hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidl);
179 return;
180
181 IImageList * piml;
184 return;
185
187
188 // Insert the root node
189 m_hRoot = InsertItem(0, m_pDesktop, pidl, pidl, FALSE);
190 if (!m_hRoot)
191 {
192 ERR("Failed to create root item\n");
193 return;
194 }
195
196 NodeInfo* pNodeInfo = GetNodeInfo(m_hRoot);
197
198 // Insert child nodes
199 InsertSubitems(m_hRoot, pNodeInfo);
201
202 // Navigate to current folder position
204
205 // Register shell notification
206 shcne.pidl = pidl;
207 shcne.fRecursive = TRUE;
209 m_hWnd,
213 1,
214 &shcne);
215 if (!m_shellRegID)
216 {
217 ERR("Something went wrong, error %08x\n", GetLastError());
218 }
219 // Register browser connection endpoint
220 hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
222 return;
223
224 hr = AtlAdvise(browserService, dynamic_cast<IDispatch*>(this), DIID_DWebBrowserEvents, &m_adviseCookie);
226 return;
227
228 ILFree(pidl);
229}
230
232{
233 HRESULT hr;
234 CComPtr <IWebBrowser2> browserService;
235
236 TRACE("Cleaning up explorer band ...\n");
237
238 hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
240 return;
241
242 hr = AtlUnadvise(browserService, DIID_DWebBrowserEvents, m_adviseCookie);
243 /* Remove all items of the treeview */
244 RevokeDragDrop(m_hWnd);
247 m_hRoot = NULL;
248 TRACE("Cleanup done !\n");
249}
250
252{
253 TVITEM tvItem;
254
255 tvItem.mask = TVIF_PARAM;
256 tvItem.hItem = hItem;
257
258 if (!TreeView_GetItem(m_hWnd, &tvItem))
259 return 0;
260
261 return reinterpret_cast<NodeInfo*>(tvItem.lParam);
262}
263
265{
266 CComPtr<IOleWindow> pBrowserOleWnd;
267 CMINVOKECOMMANDINFO cmi;
268 HWND browserWnd;
269 HRESULT hr;
270
273 return hr;
274
275 hr = pBrowserOleWnd->GetWindow(&browserWnd);
277 return hr;
278
279 ZeroMemory(&cmi, sizeof(cmi));
280 cmi.cbSize = sizeof(cmi);
281 cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
282 cmi.hwnd = browserWnd;
283 if (GetKeyState(VK_SHIFT) & 0x8000)
284 cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
285 if (GetKeyState(VK_CONTROL) & 0x8000)
286 cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
287
288 return menu->InvokeCommand(&cmi);
289}
290
292{
293 CComPtr<IShellBrowser> pBrowserService;
294 HRESULT hr;
295
296 hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IShellBrowser, &pBrowserService));
298 return hr;
299
300 hr = pBrowserService->BrowseObject(pidlGoto, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
302 return hr;
303
304 if (m_pidlCurrent)
305 {
307 m_pidlCurrent = ILClone(pidlGoto);
308 }
309 return hr;
310}
311
312// *** notifications handling ***
314{
315 NodeInfo *pNodeInfo;
316
317 if (pnmtv->action == TVE_COLLAPSE) {
318 if (pnmtv->itemNew.hItem == m_hRoot)
319 {
320 // Prenvent root from collapsing
321 pnmtv->itemNew.mask |= TVIF_STATE;
322 pnmtv->itemNew.stateMask |= TVIS_EXPANDED;
323 pnmtv->itemNew.state &= ~TVIS_EXPANDED;
324 pnmtv->action = TVE_EXPAND;
325 return TRUE;
326 }
327 }
328 if (pnmtv->action == TVE_EXPAND) {
329 // Grab our directory PIDL
330 pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
331 // We have it, let's try
332 if (pNodeInfo && !pNodeInfo->expanded)
333 if (!InsertSubitems(pnmtv->itemNew.hItem, pNodeInfo)) {
334 // remove subitem "+" since we failed to add subitems
335 TV_ITEM tvItem;
336
337 tvItem.mask = TVIF_CHILDREN;
338 tvItem.hItem = pnmtv->itemNew.hItem;
339 tvItem.cChildren = 0;
340
341 TreeView_SetItem(m_hWnd, &tvItem);
342 }
343 }
344 return FALSE;
345}
346
348{
349 /* Destroy memory associated to our node */
350 NodeInfo* ptr = GetNodeInfo(pnmtv->itemNew.hItem);
351 if (ptr)
352 {
353 ILFree(ptr->relativePidl);
354 ILFree(ptr->absolutePidl);
355 delete ptr;
356 }
357 return TRUE;
358}
359
361{
362 NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
363
364 /* Prevents navigation if selection is initiated inside the band */
365 if (m_bNavigating)
366 return;
367
368 UpdateBrowser(pNodeInfo->absolutePidl);
369
370 SetFocus();
371 // Expand the node
372 //TreeView_Expand(m_hWnd, pnmtv->itemNew.hItem, TVE_EXPAND);
373}
374
376{
377 CComPtr<IShellFolder> pSrcFolder;
379 LPCITEMIDLIST pLast;
380 HRESULT hr;
381 DWORD dwEffect;
382 DWORD dwEffect2;
383
384 dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
385 if (!pnmtv->itemNew.lParam)
386 return;
387 NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
388 hr = SHBindToParent(pNodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pSrcFolder), &pLast);
389 if (!SUCCEEDED(hr))
390 return;
391 hr = pSrcFolder->GetUIObjectOf(m_hWnd, 1, &pLast, IID_IDataObject, 0, reinterpret_cast<void**>(&pObj));
392 if (!SUCCEEDED(hr))
393 return;
394 DoDragDrop(pObj, this, dwEffect, &dwEffect2);
395 return;
396}
397
398
399// *** ATL event handlers ***
401{
403 NodeInfo *info;
404 HMENU treeMenu;
405 WORD x;
406 WORD y;
407 CComPtr<IShellFolder> pFolder;
408 CComPtr<IContextMenu> contextMenu;
409 HRESULT hr;
410 UINT uCommand;
411 LPITEMIDLIST pidlChild;
412
413 treeMenu = NULL;
414 item = TreeView_GetSelection(m_hWnd);
415 bHandled = TRUE;
416 if (!item)
417 {
418 goto Cleanup;
419 }
420
421 x = LOWORD(lParam);
422 y = HIWORD(lParam);
423 if (x == -1 && y == -1)
424 {
425 // TODO: grab position of tree item and position it correctly
426 }
427
429 if (!info)
430 {
431 ERR("No node data, something has gone wrong !\n");
432 goto Cleanup;
433 }
434 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pFolder),
435 (LPCITEMIDLIST*)&pidlChild);
436 if (!SUCCEEDED(hr))
437 {
438 ERR("Can't bind to folder!\n");
439 goto Cleanup;
440 }
441 hr = pFolder->GetUIObjectOf(m_hWnd, 1, (LPCITEMIDLIST*)&pidlChild, IID_IContextMenu,
442 NULL, reinterpret_cast<void**>(&contextMenu));
443 if (!SUCCEEDED(hr))
444 {
445 ERR("Can't get IContextMenu interface\n");
446 goto Cleanup;
447 }
448
449 IUnknown_SetSite(contextMenu, (IDeskBand *)this);
450
451 treeMenu = CreatePopupMenu();
452 hr = contextMenu->QueryContextMenu(treeMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST,
453 CMF_EXPLORE);
454 if (!SUCCEEDED(hr))
455 {
456 WARN("Can't get context menu for item\n");
457 DestroyMenu(treeMenu);
458 goto Cleanup;
459 }
461 x, y, 0, m_hWnd, NULL);
462
463 ExecuteCommand(contextMenu, uCommand);
464
465Cleanup:
466 if (contextMenu)
467 IUnknown_SetSite(contextMenu, NULL);
468 if (treeMenu)
469 DestroyMenu(treeMenu);
473 return TRUE;
474}
475
477{
478 bHandled = FALSE;
479 if (uMsg == WM_RBUTTONDOWN)
480 {
482 info.pt.x = LOWORD(lParam);
483 info.pt.y = HIWORD(lParam);
484 info.flags = TVHT_ONITEM;
485 info.hItem = NULL;
486
487 // Save the current location
489
490 // Move to the item selected by the treeview (don't change right pane)
491 TreeView_HitTest(m_hWnd, &info);
493 TreeView_SelectItem(m_hWnd, info.hItem);
495 }
496 return FALSE; /* let the wndproc process the message */
497}
498
500{
502 LPITEMIDLIST clean;
503 HTREEITEM pItem;
504
506 /* TODO: handle shell notifications */
507 switch(lParam & ~SHCNE_INTERRUPT)
508 {
509 case SHCNE_MKDIR:
510 if (!SUCCEEDED(_ReparsePIDL(dest[0], &clean)))
511 {
512 ERR("Can't reparse PIDL to a valid one\n");
513 return FALSE;
514 }
515 NavigateToPIDL(clean, &pItem, FALSE, TRUE, FALSE);
516 ILFree(clean);
517 break;
518 case SHCNE_RMDIR:
519 DeleteItem(dest[0]);
520 break;
522 if (!SUCCEEDED(_ReparsePIDL(dest[1], &clean)))
523 {
524 ERR("Can't reparse PIDL to a valid one\n");
525 return FALSE;
526 }
527 if (NavigateToPIDL(dest[0], &pItem, FALSE, FALSE, FALSE))
528 RenameItem(pItem, clean);
529 ILFree(clean);
530 break;
531 case SHCNE_UPDATEDIR:
532 // We don't take care of this message
533 TRACE("Directory updated\n");
534 break;
535 default:
536 TRACE("Unhandled message\n");
537 }
538 return TRUE;
539}
540
542{
544 IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), TRUE);
545 bHandled = FALSE;
546 return TRUE;
547}
548
550{
551 IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), FALSE);
552 bHandled = FALSE;
553 return TRUE;
554}
555
556// *** Helper functions ***
558{
559 TV_INSERTSTRUCT tvInsert;
560 HTREEITEM htiCreated;
561
562 /* Get the attributes of the node */
563 SFGAOF attrs = SFGAO_STREAM | SFGAO_HASSUBFOLDER;
564 HRESULT hr = psfParent->GetAttributesOf(1, &pEltRelative, &attrs);
566 return NULL;
567
568 /* Ignore streams */
569 if ((attrs & SFGAO_STREAM))
570 {
571 TRACE("Ignoring stream\n");
572 return NULL;
573 }
574
575 /* Get the name of the node */
576 WCHAR wszDisplayName[MAX_PATH];
577 STRRET strret;
578 hr = psfParent->GetDisplayNameOf(pEltRelative, SHGDN_INFOLDER, &strret);
580 return NULL;
581
582 hr = StrRetToBufW(&strret, pEltRelative, wszDisplayName, MAX_PATH);
584 return NULL;
585
586 /* Get the icon of the node */
587 INT iIcon = SHMapPIDLToSystemImageListIndex(psfParent, pEltRelative, NULL);
588
589 NodeInfo* pChildInfo = new NodeInfo;
590 if (!pChildInfo)
591 {
592 ERR("Failed to allocate NodeInfo\n");
593 return FALSE;
594 }
595
596 // Store our node info
597 pChildInfo->absolutePidl = ILClone(pElt);
598 pChildInfo->relativePidl = ILClone(pEltRelative);
599 pChildInfo->expanded = FALSE;
600
601 // Set up our treeview template
602 tvInsert.hParent = hParent;
603 tvInsert.hInsertAfter = TVI_LAST;
605 tvInsert.item.cchTextMax = MAX_PATH;
606 tvInsert.item.pszText = wszDisplayName;
607 tvInsert.item.iImage = tvInsert.item.iSelectedImage = iIcon;
608 tvInsert.item.cChildren = (attrs & SFGAO_HASSUBFOLDER) ? 1 : 0;
609 tvInsert.item.lParam = (LPARAM)pChildInfo;
610
611 htiCreated = TreeView_InsertItem(m_hWnd, &tvInsert);
612
613 if (bSort)
614 {
615 TVSORTCB sortCallback;
616 sortCallback.hParent = hParent;
617 sortCallback.lpfnCompare = CompareTreeItems;
618 sortCallback.lParam = (LPARAM)this;
619 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
620 }
621
622 return htiCreated;
623}
624
625/* This is the slow version of the above method */
627{
628 CComPtr<IShellFolder> psfFolder;
629 HRESULT hr = SHBindToParent(pElt, IID_PPV_ARG(IShellFolder, &psfFolder), NULL);
631 return NULL;
632
633 return InsertItem(hParent, psfFolder, pElt, pEltRelative, bSort);
634}
635
637{
638 CComPtr<IEnumIDList> pEnumIDList;
639 LPITEMIDLIST pidlSub;
641 SHCONTF EnumFlags;
642 HRESULT hr;
643 ULONG fetched;
644 ULONG uItemCount;
645 CComPtr<IShellFolder> pFolder;
646 TVSORTCB sortCallback;
647
648 entry = pNodeInfo->absolutePidl;
649 fetched = 1;
650 uItemCount = 0;
651 EnumFlags = SHCONTF_FOLDERS;
652
653 hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidlSub);
654 if (!SUCCEEDED(hr))
655 {
656 ERR("Can't get desktop PIDL !\n");
657 return FALSE;
658 }
659
660 if (!m_pDesktop->CompareIDs(NULL, pidlSub, entry))
661 {
662 // We are the desktop, so use pDesktop as pFolder
663 pFolder = m_pDesktop;
664 }
665 else
666 {
667 // Get an IShellFolder of our pidl
668 hr = m_pDesktop->BindToObject(entry, NULL, IID_PPV_ARG(IShellFolder, &pFolder));
669 if (!SUCCEEDED(hr))
670 {
671 ILFree(pidlSub);
672 ERR("Can't bind folder to desktop !\n");
673 return FALSE;
674 }
675 }
676 ILFree(pidlSub);
677
678 // TODO: handle hidden folders according to settings !
679 EnumFlags |= SHCONTF_INCLUDEHIDDEN;
680
681 // Enum through objects
682 hr = pFolder->EnumObjects(NULL,EnumFlags,&pEnumIDList);
683
684 // avoid broken IShellFolder implementations that return null pointer with success
685 if (!SUCCEEDED(hr) || !pEnumIDList)
686 {
687 ERR("Can't enum the folder !\n");
688 return FALSE;
689 }
690
691 /* Don't redraw while we add stuff into the tree */
693 while(SUCCEEDED(pEnumIDList->Next(1, &pidlSub, &fetched)) && pidlSub && fetched)
694 {
695 LPITEMIDLIST pidlSubComplete;
696 pidlSubComplete = ILCombine(entry, pidlSub);
697
698 if (InsertItem(hItem, pFolder, pidlSubComplete, pidlSub, FALSE))
699 uItemCount++;
700 ILFree(pidlSubComplete);
701 ILFree(pidlSub);
702 }
703 pNodeInfo->expanded = TRUE;
704 /* Let's do sorting */
705 sortCallback.hParent = hItem;
706 sortCallback.lpfnCompare = CompareTreeItems;
707 sortCallback.lParam = (LPARAM)this;
708 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
709
710 /* Now we can redraw */
712
713 return (uItemCount > 0) ? TRUE : FALSE;
714}
715
725 BOOL bSelect)
726{
728 HTREEITEM tmp;
730 NodeInfo *nodeData;
731 LPITEMIDLIST relativeChild;
732 TVITEM tvItem;
733
734 if (!item)
735 return FALSE;
736
738 parent = NULL;
739 while (TRUE)
740 {
741 nodeData = GetNodeInfo(current);
742 if (!nodeData)
743 {
744 ERR("Something has gone wrong, no data associated to node !\n");
745 *item = NULL;
746 return FALSE;
747 }
748 // If we found our node, give it back
749 if (!m_pDesktop->CompareIDs(0, nodeData->absolutePidl, dest))
750 {
751 if (bSelect)
753 *item = current;
754 return TRUE;
755 }
756
757 // Check if we are a parent of the requested item
758 relativeChild = ILFindChild(nodeData->absolutePidl, dest);
759 if (relativeChild != 0)
760 {
761 // Notify treeview we have children
762 tvItem.mask = TVIF_CHILDREN;
763 tvItem.hItem = current;
764 tvItem.cChildren = 1;
765 TreeView_SetItem(m_hWnd, &tvItem);
766
767 // If we can expand and the node isn't expanded yet, do it
768 if (bExpand)
769 {
770 if (!nodeData->expanded)
771 InsertSubitems(current, nodeData);
773 }
774
775 // Try to get a child
776 tmp = TreeView_GetChild(m_hWnd, current);
777 if (tmp)
778 {
779 // We have a child, let's continue with it
780 parent = current;
781 current = tmp;
782 continue;
783 }
784
785 if (bInsert && nodeData->expanded)
786 {
787 // Happens when we have to create a subchild inside a child
788 current = InsertItem(current, dest, relativeChild, TRUE);
789 }
790 // We end up here, without any children, so we found nothing
791 // Tell the parent node it has children
792 ZeroMemory(&tvItem, sizeof(tvItem));
793 *item = NULL;
794 return FALSE;
795 }
796
797 // Find sibling
798 tmp = TreeView_GetNextSibling(m_hWnd, current);
799 if (tmp)
800 {
801 current = tmp;
802 continue;
803 }
804 if (bInsert)
805 {
807 *item = current;
808 return TRUE;
809 }
810 *item = NULL;
811 return FALSE;
812 }
814}
815
817{
818 LPITEMIDLIST explorerPidl;
819 CComPtr<IBrowserService> pBrowserService;
820 HRESULT hr;
822 BOOL result;
823 explorerPidl = NULL;
824
825 hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &pBrowserService));
826 if (!SUCCEEDED(hr))
827 {
828 ERR("Can't get IBrowserService !\n");
829 return FALSE;
830 }
831
832 hr = pBrowserService->GetPidl(&explorerPidl);
833 if (!SUCCEEDED(hr) || !explorerPidl)
834 {
835 ERR("Unable to get browser PIDL !\n");
836 return FALSE;
837 }
839 /* find PIDL into our explorer */
840 result = NavigateToPIDL(explorerPidl, &dummy, TRUE, FALSE, TRUE);
842 return result;
843}
844
846{
847 HTREEITEM toDelete;
848 TVITEM tvItem;
849 HTREEITEM parentNode;
850
851 if (!NavigateToPIDL(idl, &toDelete, FALSE, FALSE, FALSE))
852 return FALSE;
853
854 // TODO: check that the treeview item is really deleted
855
856 parentNode = TreeView_GetParent(m_hWnd, toDelete);
857 // Navigate to parent when deleting child item
858 if (!m_pDesktop->CompareIDs(0, idl, m_pidlCurrent))
859 {
860 TreeView_SelectItem(m_hWnd, parentNode);
861 }
862
863 // Remove the child item
864 TreeView_DeleteItem(m_hWnd, toDelete);
865 // Probe parent to see if it has children
866 if (!TreeView_GetChild(m_hWnd, parentNode))
867 {
868 // Decrement parent's child count
869 ZeroMemory(&tvItem, sizeof(tvItem));
870 tvItem.mask = TVIF_CHILDREN;
871 tvItem.hItem = parentNode;
872 tvItem.cChildren = 0;
873 TreeView_SetItem(m_hWnd, &tvItem);
874 }
875 return TRUE;
876}
877
879{
880 WCHAR wszDisplayName[MAX_PATH];
881 TVITEM itemInfo;
882 LPCITEMIDLIST relPidl;
883 NodeInfo *treeInfo;
884 TVSORTCB sortCallback;
886
887 ZeroMemory(&itemInfo, sizeof(itemInfo));
888 itemInfo.mask = TVIF_PARAM;
889 itemInfo.hItem = toRename;
890
891 // Change PIDL associated to the item
892 relPidl = ILFindLastID(newPidl);
893 TreeView_GetItem(m_hWnd, &itemInfo);
894 if (!itemInfo.lParam)
895 {
896 ERR("Unable to fetch lParam\n");
897 return FALSE;
898 }
900 treeInfo = (NodeInfo*)itemInfo.lParam;
901 ILFree(treeInfo->absolutePidl);
902 ILFree(treeInfo->relativePidl);
903 treeInfo->absolutePidl = ILClone(newPidl);
904 treeInfo->relativePidl = ILClone(relPidl);
905
906 // Change the display name
907 GetDisplayName(newPidl, wszDisplayName, MAX_PATH, SHGDN_INFOLDER);
908 ZeroMemory(&itemInfo, sizeof(itemInfo));
909 itemInfo.hItem = toRename;
910 itemInfo.mask = TVIF_TEXT;
911 itemInfo.pszText = wszDisplayName;
912 TreeView_SetItem(m_hWnd, &itemInfo);
913
914 if((child = TreeView_GetChild(m_hWnd, toRename)) != NULL)
915 {
916 RefreshTreePidl(child, newPidl);
917 }
918
919 // Sorting
920 sortCallback.hParent = TreeView_GetParent(m_hWnd, toRename);
921 sortCallback.lpfnCompare = CompareTreeItems;
922 sortCallback.lParam = (LPARAM)this;
923 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
925 return TRUE;
926}
927
929{
930 HTREEITEM tmp;
931 NodeInfo *pInfo;
932
933 // Update our node data
934 pInfo = GetNodeInfo(tree);
935 if (!pInfo)
936 {
937 WARN("No tree info !\n");
938 return FALSE;
939 }
940 ILFree(pInfo->absolutePidl);
941 pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
942 if (!pInfo->absolutePidl)
943 {
944 WARN("PIDL allocation failed\n");
945 return FALSE;
946 }
947 // Recursively update children
948 if ((tmp = TreeView_GetChild(m_hWnd, tree)) != NULL)
949 {
950 RefreshTreePidl(tmp, pInfo->absolutePidl);
951 }
952
953 tmp = TreeView_GetNextSibling(m_hWnd, tree);
954 while(tmp != NULL)
955 {
956 pInfo = GetNodeInfo(tmp);
957 if(!pInfo)
958 {
959 WARN("No tree info !\n");
960 continue;
961 }
962 ILFree(pInfo->absolutePidl);
963 pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
964 tmp = TreeView_GetNextSibling(m_hWnd, tmp);
965 }
966 return TRUE;
967}
968
969// *** Tree item sorting callback ***
971{
972 /*
973 * We first sort drive letters (Path root), then PIDLs and then regular folder
974 * display name.
975 * This is not how Windows sorts item, but it gives decent results.
976 */
977 NodeInfo *info1;
978 NodeInfo *info2;
979 CExplorerBand *pThis;
980 WCHAR wszFolder1[MAX_PATH];
981 WCHAR wszFolder2[MAX_PATH];
982
983 info1 = (NodeInfo*)p1;
984 info2 = (NodeInfo*)p2;
985 pThis = (CExplorerBand*)p3;
986
987 GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_FORPARSING);
988 GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_FORPARSING);
989 if (PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
990 {
991 return lstrcmpiW(wszFolder1,wszFolder2);
992 }
993 if (PathIsRoot(wszFolder1) && !PathIsRoot(wszFolder2))
994 {
995 return -1;
996 }
997 if (!PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
998 {
999 return 1;
1000 }
1001 // Now, we compare non-root folders, grab display name
1002 GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_INFOLDER);
1003 GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_INFOLDER);
1004
1006 {
1007 return -1;
1008 }
1010 {
1011 return 1;
1012 }
1014 {
1015 HRESULT hr;
1016 hr = pThis->m_pDesktop->CompareIDs(0, info1->absolutePidl, info2->absolutePidl);
1017 if (!hr) return 0;
1018 return (hr > 0) ? -1 : 1;
1019 }
1020 return StrCmpLogicalW(wszFolder1, wszFolder2);
1021}
1022
1023// *** IOleWindow methods ***
1025{
1026 if (!lphwnd)
1027 return E_INVALIDARG;
1028 *lphwnd = m_hWnd;
1029 return S_OK;
1030}
1031
1033{
1035 return E_NOTIMPL;
1036}
1037
1038
1039// *** IDockingWindow methods ***
1041{
1042 // We do nothing, we don't have anything to save yet
1043 TRACE("CloseDW called\n");
1044 return S_OK;
1045}
1046
1047HRESULT STDMETHODCALLTYPE CExplorerBand::ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
1048{
1049 /* Must return E_NOTIMPL according to MSDN */
1050 return E_NOTIMPL;
1051}
1052
1054{
1055 m_fVisible = fShow;
1056 ShowWindow(fShow);
1057 return S_OK;
1058}
1059
1060
1061// *** IDeskBand methods ***
1063{
1064 if (!pdbi)
1065 {
1066 return E_INVALIDARG;
1067 }
1068 this->m_dwBandID = dwBandID;
1069
1070 if (pdbi->dwMask & DBIM_MINSIZE)
1071 {
1072 pdbi->ptMinSize.x = 200;
1073 pdbi->ptMinSize.y = 30;
1074 }
1075
1076 if (pdbi->dwMask & DBIM_MAXSIZE)
1077 {
1078 pdbi->ptMaxSize.y = -1;
1079 }
1080
1081 if (pdbi->dwMask & DBIM_INTEGRAL)
1082 {
1083 pdbi->ptIntegral.y = 1;
1084 }
1085
1086 if (pdbi->dwMask & DBIM_ACTUAL)
1087 {
1088 pdbi->ptActual.x = 200;
1089 pdbi->ptActual.y = 30;
1090 }
1091
1092 if (pdbi->dwMask & DBIM_TITLE)
1093 {
1094 if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_FOLDERSLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
1096 }
1097
1098 if (pdbi->dwMask & DBIM_MODEFLAGS)
1099 {
1100 pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
1101 }
1102
1103 if (pdbi->dwMask & DBIM_BKCOLOR)
1104 {
1105 pdbi->dwMask &= ~DBIM_BKCOLOR;
1106 }
1107 return S_OK;
1108}
1109
1110
1111// *** IObjectWithSite methods ***
1113{
1114 HRESULT hr;
1115 HWND parentWnd;
1116
1117 if (pUnkSite == m_pSite)
1118 return S_OK;
1119
1120 TRACE("SetSite called \n");
1121 if (!pUnkSite)
1122 {
1124 DestroyWindow();
1125 m_hWnd = NULL;
1126 }
1127
1128 if (pUnkSite != m_pSite)
1129 {
1130 m_pSite = NULL;
1131 }
1132
1133 if(!pUnkSite)
1134 return S_OK;
1135
1136 hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
1137 if (!SUCCEEDED(hr))
1138 {
1139 ERR("Could not get parent's window ! Status: %08lx\n", hr);
1140 return E_INVALIDARG;
1141 }
1142
1143 m_pSite = pUnkSite;
1144
1145 if (m_hWnd)
1146 {
1147 // Change its parent
1148 SetParent(parentWnd);
1149 }
1150 else
1151 {
1153 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TVS_HASLINES | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS /* | TVS_SINGLEEXPAND*/ , // remove TVS_SINGLEEXPAND for now since it has strange behaviour
1154 0, 0, 0, 0, parentWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
1155
1156 // Subclass the window
1157 SubclassWindow(wnd);
1158
1159 // Initialize our treeview now
1161 RegisterDragDrop(m_hWnd, dynamic_cast<IDropTarget*>(this));
1162 }
1163 return S_OK;
1164}
1165
1167{
1168 if (!ppvSite)
1169 return E_POINTER;
1170 *ppvSite = m_pSite;
1171 return S_OK;
1172}
1173
1174
1175// *** IOleCommandTarget methods ***
1176HRESULT STDMETHODCALLTYPE CExplorerBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
1177{
1179 return E_NOTIMPL;
1180}
1181
1182HRESULT STDMETHODCALLTYPE CExplorerBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
1183{
1185 return E_NOTIMPL;
1186}
1187
1188
1189// *** IServiceProvider methods ***
1191{
1192 /* FIXME: we probably want to handle more services here */
1194}
1195
1196
1197// *** IInputObject methods ***
1199{
1200 if (fActivate)
1201 {
1202 //SetFocus();
1204 }
1205 // TODO: handle message
1206 if(lpMsg)
1207 {
1208 TranslateMessage(lpMsg);
1209 DispatchMessage(lpMsg);
1210 }
1211 return S_OK;
1212}
1213
1215{
1216 return m_bFocused ? S_OK : S_FALSE;
1217}
1218
1220{
1221 if (lpMsg->hwnd == m_hWnd ||
1222 (m_isEditing && IsChild(lpMsg->hwnd)))
1223 {
1224 TranslateMessage(lpMsg);
1225 DispatchMessage(lpMsg);
1226 return S_OK;
1227 }
1228
1229 return S_FALSE;
1230}
1231
1232// *** IPersist methods ***
1234{
1235 if (!pClassID)
1236 return E_POINTER;
1237 memcpy(pClassID, &CLSID_ExplorerBand, sizeof(CLSID));
1238 return S_OK;
1239}
1240
1241
1242// *** IPersistStream methods ***
1244{
1246 return E_NOTIMPL;
1247}
1248
1250{
1252 return E_NOTIMPL;
1253}
1254
1256{
1258 return E_NOTIMPL;
1259}
1260
1262{
1263 // TODO: calculate max size
1265 return E_NOTIMPL;
1266}
1267
1268
1269// *** IWinEventHandler methods ***
1271{
1272 BOOL bHandled;
1274
1275 if (uMsg == WM_NOTIFY)
1276 {
1277 NMHDR *pNotifyHeader = (NMHDR*)lParam;
1278 switch (pNotifyHeader->code)
1279 {
1280 case TVN_ITEMEXPANDING:
1282 if (theResult)
1283 *theResult = result;
1284 break;
1285 case TVN_SELCHANGED:
1287 break;
1288 case TVN_DELETEITEM:
1290 break;
1291 case NM_RCLICK:
1292 OnContextMenu(WM_CONTEXTMENU, (WPARAM)m_hWnd, GetMessagePos(), bHandled);
1293 if (theResult)
1294 *theResult = 1;
1295 break;
1296 case TVN_BEGINDRAG:
1297 case TVN_BEGINRDRAG:
1299 break;
1301 {
1302 // TODO: put this in a function ? (mostly copypasta from CDefView)
1303 DWORD dwAttr = SFGAO_CANRENAME;
1306 LPCITEMIDLIST pChild;
1307 HRESULT hr;
1308
1309 if (theResult)
1310 *theResult = 1;
1311 NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1312 if (!info)
1313 return E_FAIL;
1314 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pChild);
1315 if (!SUCCEEDED(hr) || !pParent.p)
1316 return E_FAIL;
1317
1318 hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
1319 if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME))
1320 {
1321 if (theResult)
1322 *theResult = 0;
1323 m_isEditing = TRUE;
1324 }
1325 return S_OK;
1326 }
1327 case TVN_ENDLABELEDITW:
1328 {
1330 NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1331 HRESULT hr;
1332
1334 if (theResult)
1335 *theResult = 0;
1336 if (dispInfo->item.pszText)
1337 {
1338 LPITEMIDLIST pidlNew;
1340 LPCITEMIDLIST pidlChild;
1341
1342 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pidlChild);
1343 if (!SUCCEEDED(hr) || !pParent.p)
1344 return E_FAIL;
1345
1346 hr = pParent->SetNameOf(0, pidlChild, dispInfo->item.pszText, SHGDN_INFOLDER, &pidlNew);
1347 if(SUCCEEDED(hr) && pidlNew)
1348 {
1349 CComPtr<IPersistFolder2> pPersist;
1350 LPITEMIDLIST pidlParent, pidlNewAbs;
1351
1353 if(!SUCCEEDED(hr))
1354 return E_FAIL;
1355
1356 hr = pPersist->GetCurFolder(&pidlParent);
1357 if(!SUCCEEDED(hr))
1358 return E_FAIL;
1359 pidlNewAbs = ILCombine(pidlParent, pidlNew);
1360
1361 // Navigate to our new location
1362 UpdateBrowser(pidlNewAbs);
1363
1364 ILFree(pidlParent);
1365 ILFree(pidlNewAbs);
1366 ILFree(pidlNew);
1367 if (theResult)
1368 *theResult = 1;
1369 }
1370 return S_OK;
1371 }
1372 }
1373 default:
1374 break;
1375 }
1376 }
1377 return S_OK;
1378}
1379
1381{
1382 return (hWnd == m_hWnd) ? S_OK : S_FALSE;
1383}
1384
1385// *** IBandNavigate methods ***
1387{
1389 return E_NOTIMPL;
1390}
1391
1392// *** INamespaceProxy ***
1393HRESULT STDMETHODCALLTYPE CExplorerBand::GetNavigateTarget(long paramC, long param10, long param14)
1394{
1396 return E_NOTIMPL;
1397}
1398
1400{
1402 return E_NOTIMPL;
1403}
1404
1406{
1408 return E_NOTIMPL;
1409}
1410
1411HRESULT STDMETHODCALLTYPE CExplorerBand::RefreshFlags(long paramC, long param10, long param14)
1412{
1414 return E_NOTIMPL;
1415}
1416
1418{
1420 return E_NOTIMPL;
1421}
1422
1423// *** IDispatch methods ***
1425{
1427 return E_NOTIMPL;
1428}
1429
1431{
1433 return E_NOTIMPL;
1434}
1435
1437{
1439 return E_NOTIMPL;
1440}
1441
1442HRESULT STDMETHODCALLTYPE CExplorerBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1443{
1444 switch (dispIdMember)
1445 {
1448 TRACE("DISPID_NAVIGATECOMPLETE2 received\n");
1450 return S_OK;
1451 }
1452 TRACE("Unknown dispid requested: %08x\n", dispIdMember);
1453 return E_INVALIDARG;
1454}
1455
1456// *** IDropTarget methods ***
1458{
1459 ERR("Entering drag\n");
1460 m_pCurObject = pObj;
1462 return DragOver(glfKeyState, pt, pdwEffect);
1463}
1464
1466{
1468 CComPtr<IShellFolder> pShellFldr;
1469 NodeInfo *nodeInfo;
1470 //LPCITEMIDLIST pChild;
1471 HRESULT hr;
1472
1473 info.pt.x = pt.x;
1474 info.pt.y = pt.y;
1475 info.flags = TVHT_ONITEM;
1476 info.hItem = NULL;
1477 ScreenToClient(&info.pt);
1478
1479 // Move to the item selected by the treeview (don't change right pane)
1480 TreeView_HitTest(m_hWnd, &info);
1481
1482 if (info.hItem)
1483 {
1485 TreeView_SelectItem(m_hWnd, info.hItem);
1487 // Delegate to shell folder
1488 if (m_pDropTarget && info.hItem != m_childTargetNode)
1489 {
1491 }
1492 if (info.hItem != m_childTargetNode)
1493 {
1494 nodeInfo = GetNodeInfo(info.hItem);
1495 if (!nodeInfo)
1496 return E_FAIL;
1497#if 0
1498 hr = SHBindToParent(nodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pShellFldr), &pChild);
1499 if (!SUCCEEDED(hr))
1500 return E_FAIL;
1501 hr = pShellFldr->GetUIObjectOf(m_hWnd, 1, &pChild, IID_IDropTarget, NULL, reinterpret_cast<void**>(&pDropTarget));
1502 if (!SUCCEEDED(hr))
1503 return E_FAIL;
1504#endif
1505 if(_ILIsDesktop(nodeInfo->absolutePidl))
1506 pShellFldr = m_pDesktop;
1507 else
1508 {
1509 hr = m_pDesktop->BindToObject(nodeInfo->absolutePidl, 0, IID_PPV_ARG(IShellFolder, &pShellFldr));
1510 if (!SUCCEEDED(hr))
1511 {
1512 /* Don't allow dnd since we couldn't get our folder object */
1513 ERR("Can't bind to folder object\n");
1514 *pdwEffect = DROPEFFECT_NONE;
1515 return E_FAIL;
1516 }
1517 }
1518 hr = pShellFldr->CreateViewObject(m_hWnd, IID_PPV_ARG(IDropTarget, &m_pDropTarget));
1519 if (!SUCCEEDED(hr))
1520 {
1521 /* Don't allow dnd since we couldn't get our drop target */
1522 ERR("Can't get drop target for folder object\n");
1523 *pdwEffect = DROPEFFECT_NONE;
1524 return E_FAIL;
1525 }
1526 hr = m_pDropTarget->DragEnter(m_pCurObject, glfKeyState, pt, pdwEffect);
1527 m_childTargetNode = info.hItem;
1528 }
1529 if (m_pDropTarget)
1530 {
1531 hr = m_pDropTarget->DragOver(glfKeyState, pt, pdwEffect);
1532 }
1533 }
1534 else
1535 {
1538 *pdwEffect = DROPEFFECT_NONE;
1539 }
1540 return S_OK;
1541}
1542
1544{
1549 if (m_pCurObject)
1550 {
1552 }
1553 return S_OK;
1554}
1555
1557{
1558 if (!m_pDropTarget)
1559 return E_FAIL;
1560 m_pDropTarget->Drop(pObj, glfKeyState, pt, pdwEffect);
1561 DragLeave();
1562 return S_OK;
1563}
1564
1565// *** IDropSource methods ***
1567{
1568 if (fEscapePressed)
1569 return DRAGDROP_S_CANCEL;
1570 if ((grfKeyState & MK_LBUTTON) || (grfKeyState & MK_RBUTTON))
1571 return S_OK;
1572 return DRAGDROP_S_DROP;
1573}
1574
1576{
1578}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
UINT cchMax
HWND hWnd
Definition: settings.c:17
BOOL GetDisplayName(LPCTSTR ServiceName)
Definition: name.c:12
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define UNIMPLEMENTED
Definition: debug.h:115
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
return
Definition: dirsup.c:529
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
LPITEMIDLIST relativePidl
Definition: explorerband.h:50
LPITEMIDLIST absolutePidl
Definition: explorerband.h:49
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
HTREEITEM m_hRoot
Definition: explorerband.h:65
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
HTREEITEM m_oldSelected
Definition: explorerband.h:66
void DestroyExplorerBand()
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
void OnSelectionChanged(LPNMTREEVIEW pnmtv)
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
HRESULT ExecuteCommand(CComPtr< IContextMenu > &menu, UINT nCmd)
virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14)
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty)
virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14)
BOOL m_bNavigating
Definition: explorerband.h:60
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
virtual HRESULT STDMETHODCALLTYPE DragLeave()
virtual HRESULT STDMETHODCALLTYPE Select(long paramC)
void InitializeExplorerBand()
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
HTREEITEM m_childTargetNode
Definition: explorerband.h:75
DWORD m_dwBandID
Definition: explorerband.h:62
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd)
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm)
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC)
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
BOOL DeleteItem(LPITEMIDLIST toDelete)
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow)
BOOL NavigateToCurrentFolder()
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:67
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:76
void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick)
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
DWORD m_adviseCookie
Definition: explorerband.h:70
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
NodeInfo * GetNodeInfo(HTREEITEM hItem)
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize)
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect)
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT ContextMenuHack(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite)
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
BOOL OnTreeItemDeleted(LPNMTREEVIEW pnmtv)
CComPtr< IDropTarget > m_pDropTarget
Definition: explorerband.h:74
ULONG m_shellRegID
Definition: explorerband.h:71
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved)
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
LRESULT OnShellEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC)
virtual HRESULT STDMETHODCALLTYPE IsDirty()
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
virtual ~CExplorerBand()
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl)
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxobject.cpp:255
static BOOL bInsert
Definition: cmdinput.c:121
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:45
HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
Definition: atl.c:73
UINT uFlags
Definition: api.c:59
#define IDS_FOLDERSLABEL
Definition: resource.h:127
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3093
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1497
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1332
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4688
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1407
INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:2296
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
static const WCHAR Cleanup[]
Definition: register.c:80
#define pt(x, y)
Definition: drawing.c:79
r parent
Definition: btrfs.c:3010
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83
struct _PIDLDATA * LPPIDLDATA
struct _PIDLDATA PIDLDATA
#define PT_GUID
HRESULT _ReparsePIDL(LPITEMIDLIST buggyPidl, LPITEMIDLIST *cleanPidl)
HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags)
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
#define PT_YAGUID
#define PT_SHELLEXT
#define WM_USER_SHELLEVENT
Definition: explorerband.h:24
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxObject * pParent
Definition: fxdpcapi.cpp:86
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint64EXT * result
Definition: glext.h:11304
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder *sh, LPCITEMIDLIST pidl, int *pIndex)
Definition: iconcache.cpp:783
REFIID riid
Definition: atlbase.h:39
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
uint32_t entry
Definition: isohybrid.c:63
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct task_struct * current
Definition: linux.c:32
static PVOID ptr
Definition: dispmode.c:27
static char * dest
Definition: rtl.c:135
static LPOLESTR
Definition: stg_prop.c:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static SHCONTF
Definition: ordinal.c:64
static VARIANTARG static DISPID
Definition: ordinal.c:52
static HWND child
Definition: cursoricon.c:298
static ATOM item
Definition: dde.c:856
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
unsigned int UINT
Definition: ndis.h:50
#define UNREACHABLE
const GUID IID_IDataObject
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:929
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:703
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1341
PUIDLIST_RELATIVE WINAPI ILFindChild(PIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
Definition: pidl.c:645
#define TVN_DELETEITEM
Definition: commctrl.h:3742
#define TVITEM
Definition: commctrl.h:3365
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define TVN_BEGINDRAG
Definition: commctrl.h:3740
#define TVI_LAST
Definition: commctrl.h:3370
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3417
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3547
#define TVIF_TEXT
Definition: commctrl.h:3266
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define TVHT_ONITEM
Definition: commctrl.h:3527
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define LPNMTREEVIEW
Definition: commctrl.h:3643
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3252
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define TVS_HASLINES
Definition: commctrl.h:3248
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TV_INSERTSTRUCT
Definition: commctrl.h:3377
#define WC_TREEVIEW
Definition: commctrl.h:3245
#define TV_ITEM
Definition: commctrl.h:3300
#define TVN_BEGINRDRAG
Definition: commctrl.h:3741
#define TVE_COLLAPSE
Definition: commctrl.h:3422
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
#define TVIS_EXPANDED
Definition: commctrl.h:3284
#define NM_RCLICK
Definition: commctrl.h:133
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3710
#define TVIF_PARAM
Definition: commctrl.h:3268
#define LPNMTVDISPINFO
Definition: commctrl.h:3676
#define TVS_EDITLABELS
Definition: commctrl.h:3250
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
#define TVIF_STATE
Definition: commctrl.h:3269
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415
#define REFIID
Definition: guiddef.h:118
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
const WCHAR * str
DWORD LCID
Definition: nls.h:13
#define SHIL_SMALL
Definition: shellapi.h:182
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2406
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
HRESULT hr
Definition: shlfolder.c:183
#define SID_SShellBrowser
Definition: shlguid.h:128
#define SID_SWebBrowserApp
Definition: shlguid.h:111
#define SHCNRF_RecursiveInterrupt
Definition: shlobj.h:1793
#define SHCNE_RMDIR
Definition: shlobj.h:1750
#define SHCNE_MKDIR
Definition: shlobj.h:1749
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1758
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1763
#define SHCNE_DISKEVENTS
Definition: shlobj.h:1768
#define SHCNRF_ShellLevel
Definition: shlobj.h:1792
#define CSIDL_DESKTOP
Definition: shlobj.h:2029
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:511
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1791
#define SHCNE_INTERRUPT
Definition: shlobj.h:1771
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:545
#define StrRetToBuf
Definition: shlwapi.h:1769
#define PathIsRoot
Definition: shlwapi.h:955
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:68
#define TRACE(s)
Definition: solgame.cpp:4
Definition: scsiwmi.h:51
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1742
int cChildren
Definition: treeview.c:154
Definition: fci.c:116
WCHAR wszTitle[256]
Definition: shobjidl.idl:2380
HWND hwnd
Definition: winuser.h:3104
UINT code
Definition: winuser.h:3149
LPARAM lParam
Definition: commctrl.h:3616
HTREEITEM hParent
Definition: commctrl.h:3614
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3615
HTREEITEM hItem
Definition: treelist.h:37
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define DeleteItem
Definition: userenv.h:210
#define DISPID_NAVIGATECOMPLETE2
Definition: webchild.h:54
#define DISPID_DOWNLOADCOMPLETE
Definition: webchild.h:39
#define ZeroMemory
Definition: winbase.h:1700
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define S_FALSE
Definition: winerror.h:2357
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648
#define DRAGDROP_S_DROP
Definition: winerror.h:2646
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define MK_RBUTTON
Definition: winuser.h:2358
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define VK_CONTROL
Definition: winuser.h:2193
#define CreateWindow
Definition: winuser.h:5744
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)
HWND WINAPI SetActiveWindow(_In_ HWND)
#define TPM_LEFTALIGN
Definition: winuser.h:2367
#define SendMessage
Definition: winuser.h:5833
#define TPM_LEFTBUTTON
Definition: winuser.h:2369
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MK_LBUTTON
Definition: winuser.h:2357
#define VK_SHIFT
Definition: winuser.h:2192
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define DispatchMessage
Definition: winuser.h:5755
#define TPM_RETURNCMD
Definition: winuser.h:2377
BOOL WINAPI DestroyWindow(_In_ HWND)
SHORT WINAPI GetKeyState(_In_ int)
#define WM_SETREDRAW
Definition: winuser.h:1606
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define IID_PPV_ARG(Itype, ppType)
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193