ReactOS  0.4.14-dev-1331-g167fa2c
CDefView.cpp
Go to the documentation of this file.
1 /*
2  * ShellView
3  *
4  * Copyright 1998,1999 <juergen.schmied@debitel.net>
5  *
6  * This is the view visualizing the data provided by the shellfolder.
7  * No direct access to data from pidls should be done from here.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * FIXME: CheckToolbar: handle the "new folder" and "folder up" button
24  */
25 
26 /*
27 TODO:
28 - Load/Save the view state from/into the stream provided by the ShellBrowser.
29 - When editing starts on item, set edit text to for editing value.
30 - Fix shell view to handle view mode popup exec.
31 - The background context menu should have a pidl just like foreground menus. This
32  causes crashes when dynamic handlers try to use the NULL pidl.
33 - Reorder of columns doesn't work - might be bug in comctl32
34 */
35 
36 #include "precomp.h"
37 
38 #include <atlwin.h>
39 #include <rosctrls.h>
40 
42 
43 #undef SV_CLASS_NAME
44 
45 static const WCHAR SV_CLASS_NAME[] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0};
46 
47 typedef struct
48 {
53 
54 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
55 
56 /* For the context menu of the def view, the id of the items are based on 1 because we need
57  to call TrackPopupMenu and let it use the 0 value as an indication that the menu was canceled */
58 #define CONTEXT_MENU_BASE_ID 1
59 
60 class CDefView :
61  public CWindowImpl<CDefView, CWindow, CControlWinTraits>,
62  public CComObjectRootEx<CComMultiThreadModelNoCS>,
63  public IShellView2,
64  public IFolderView,
65  public IShellFolderView,
66  public IOleCommandTarget,
67  public IDropTarget,
68  public IDropSource,
69  public IViewObject,
70  public IServiceProvider
71 {
72  private:
82  HMENU m_hMenu; /* Handle to the menu bar of the browser */
83  HMENU m_hMenuArrangeModes; /* Handle to the popup menu with the arrange modes */
84  HMENU m_hMenuViewModes; /* Handle to the popup menu with the view modes */
85  HMENU m_hContextMenu; /* Handle to the open context menu */
92  ULONG m_hNotify; /* Change notification handle */
93  HACCEL m_hAccel;
97  // for drag and drop
99  CComPtr<IDropTarget> m_pCurDropTarget; /* The sub-item, which is currently dragged over */
100  CComPtr<IDataObject> m_pCurDataObject; /* The dragged data-object */
101  LONG m_iDragOverItem; /* Dragged over item's index, iff m_pCurDropTarget != NULL */
102  UINT m_cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
103  POINT m_ptLastMousePos; /* Mouse position at last DragOver call */
104  POINT m_ptFirstMousePos; /* Mouse position when the drag operation started */
106  //
108 
110 
114 
115  private:
117  BOOL _Sort();
119 
120  public:
121  CDefView();
122  ~CDefView();
123  HRESULT WINAPI Initialize(IShellFolder *shellFolder);
127  void UpdateStatusbar();
128  void CheckToolbar();
129  BOOL CreateList();
130  void UpdateListColors();
131  BOOL InitList();
133  static INT CALLBACK ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
134 
138  int LV_AddItem(PCUITEMID_CHILD pidl);
143  HRESULT FillList();
147  HRESULT FillArrangeAsMenu(HMENU hmenuArrange);
148  HRESULT CheckViewMode(HMENU hmenuView);
151  void OnDeactivate();
152  void DoActivate(UINT uState);
153  HRESULT drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
155  LRESULT OnExplorerCommand(UINT uCommand, BOOL bUseSelection);
156 
157  // *** IOleWindow methods ***
158  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
160 
161  // *** IShellView methods ***
163  virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable);
164  virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState);
166  virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvPrevious, LPCFOLDERSETTINGS pfs, IShellBrowser *psb, RECT *prcView, HWND *phWnd);
172  virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv);
173 
174  // *** IShellView2 methods ***
179 
180  // *** IShellView3 methods ***
181  virtual HRESULT STDMETHODCALLTYPE CreateViewWindow3(IShellBrowser *psb, IShellView *psvPrevious, SV3CVW3_FLAGS view_flags, FOLDERFLAGS mask, FOLDERFLAGS flags, FOLDERVIEWMODE mode, const SHELLVIEWID *view_id, RECT *prcView, HWND *hwnd);
182 
183  // *** IFolderView methods ***
184  virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode);
187  virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, PITEMID_CHILD *ppidl);
190  virtual HRESULT STDMETHODCALLTYPE GetSelectionMarkedItem(int *piItem);
191  virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem);
196  virtual HRESULT STDMETHODCALLTYPE SelectItem(int iItem, DWORD dwFlags);
198 
199  // *** IShellFolderView methods ***
214  virtual HRESULT STDMETHODCALLTYPE IsDropOnSource(IDropTarget *drop_target);
219  virtual HRESULT STDMETHODCALLTYPE IsBkDropTarget(IDropTarget *drop_target);
223  virtual HRESULT STDMETHODCALLTYPE SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb);
225  virtual HRESULT STDMETHODCALLTYPE QuerySupport(UINT *support);
227 
228  // *** IOleCommandTarget methods ***
229  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
230  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
231 
232  // *** IDropTarget methods ***
233  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
234  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
236  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
237 
238  // *** IDropSource methods ***
239  virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
240  virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
241 
242  // *** IViewObject methods ***
243  virtual HRESULT STDMETHODCALLTYPE Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd,
244  HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds,
245  BOOL ( STDMETHODCALLTYPE *pfnContinue )(ULONG_PTR dwContinue), ULONG_PTR dwContinue);
246  virtual HRESULT STDMETHODCALLTYPE GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect,
247  DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet);
248  virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze);
249  virtual HRESULT STDMETHODCALLTYPE Unfreeze(DWORD dwFreeze);
250  virtual HRESULT STDMETHODCALLTYPE SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink);
251  virtual HRESULT STDMETHODCALLTYPE GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink);
252 
253  // *** IServiceProvider methods ***
254  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
255 
256  // Message handlers
257  LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
258  LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
259  LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
264  LRESULT OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
265  LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
266  LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
268  LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
269  LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
270  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
271  LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
272  LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
273  LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
275  LRESULT OnCustomItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
278 
280  {
281  static ATL::CWndClassInfo wc =
282  {
284  0, 0, NULL, NULL,
286  },
287  NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
288  };
289  return wc;
290  }
291 
293  {
294  return WindowProc;
295  }
296 
298  {
299  CDefView *pThis;
300  LRESULT result;
301 
302  // Must hold a reference during message handling
303  pThis = reinterpret_cast<CDefView *>(hWnd);
304  pThis->AddRef();
306  pThis->Release();
307  return result;
308  }
309 
333  END_MSG_MAP()
334 
336  // Windows returns E_NOINTERFACE for IOleWindow
337  // COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
338  COM_INTERFACE_ENTRY_IID(IID_IShellView, IShellView)
339  COM_INTERFACE_ENTRY_IID(IID_CDefView, IShellView)
340  COM_INTERFACE_ENTRY_IID(IID_IShellView2, IShellView2)
341  COM_INTERFACE_ENTRY_IID(IID_IFolderView, IFolderView)
342  COM_INTERFACE_ENTRY_IID(IID_IShellFolderView, IShellFolderView)
343  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
344  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
345  COM_INTERFACE_ENTRY_IID(IID_IDropSource, IDropSource)
347  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
348  END_COM_MAP()
349 };
350 
351 /*menu items */
352 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
353 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
354 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
355 
356 #define ID_LISTVIEW 1
357 
358 /*windowsx.h */
359 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
360 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
361 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
362 
364 
366  m_ListView(),
368  m_hMenu(NULL),
373  m_uState(0),
374  m_cidl(0),
375  m_apidl(NULL),
377  m_hNotify(0),
378  m_hAccel(NULL),
379  m_dwAspects(0),
380  m_dwAdvf(0),
381  m_iDragOverItem(0),
382  m_cScrollDelay(0),
385 {
387  ZeroMemory(&m_sortInfo, sizeof(m_sortInfo));
389  ZeroMemory(&m_Category, sizeof(m_Category));
393 }
394 
396 {
397  TRACE(" destroying IShellView(%p)\n", this);
398 
400  {
403  }
404 
405  if (m_hWnd)
406  {
408  }
409 
410  SHFree(m_apidl);
411 }
412 
414 {
415  m_pSFParent = shellFolder;
417 
418  return S_OK;
419 }
420 
421 /**********************************************************
422  *
423  * ##### helperfunctions for communication with ICommDlgBrowser #####
424  */
426 {
427  HRESULT ret = S_OK;
428 
429  if (m_pCommDlgBrowser.p != NULL)
430  {
431  TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
432  ret = m_pCommDlgBrowser->IncludeObject(this, pidl);
433  TRACE("-- returns 0x%08x\n", ret);
434  }
435 
436  return ret;
437 }
438 
440 {
441  HRESULT ret = S_FALSE;
442 
443  if (m_pCommDlgBrowser.p != NULL)
444  {
445  TRACE("ICommDlgBrowser::OnDefaultCommand\n");
446  ret = m_pCommDlgBrowser->OnDefaultCommand(this);
447  TRACE("-- returns 0x%08x\n", ret);
448  }
449 
450  return ret;
451 }
452 
454 {
455  HRESULT ret = S_FALSE;
456 
457  if (m_pCommDlgBrowser.p != NULL)
458  {
459  TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
460  ret = m_pCommDlgBrowser->OnStateChange(this, uFlags);
461  TRACE("--\n");
462  }
463 
464  return ret;
465 }
466 /**********************************************************
467  * set the toolbar of the filedialog buttons
468  *
469  * - activates the buttons from the shellbrowser according to
470  * the view state
471  */
473 {
474  LRESULT result;
475 
476  TRACE("\n");
477 
478  if (m_pCommDlgBrowser != NULL)
479  {
480  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
482  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_CHECKBUTTON,
484  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
486  m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ENABLEBUTTON,
488  }
489 }
490 
492 {
493  WCHAR szFormat[MAX_PATH] = {0};
494  WCHAR szObjects[MAX_PATH] = {0};
495  UINT cSelectedItems;
496 
497  cSelectedItems = m_ListView.GetSelectedCount();
498  if (cSelectedItems)
499  {
501  StringCchPrintfW(szObjects, MAX_PATH, szFormat, cSelectedItems);
502  }
503  else
504  {
505  LoadStringW(shell32_hInstance, IDS_OBJECTS, szFormat, _countof(szFormat));
506  StringCchPrintfW(szObjects, MAX_PATH, szFormat, m_ListView.GetItemCount());
507  }
508  m_pShellBrowser->SetStatusTextSB(szObjects);
509 }
510 
511 /**********************************************************
512  *
513  * ##### helperfunctions for initializing the view #####
514  */
515 
516 /**********************************************************
517 * ShellView_CreateList()
518 *
519 * - creates the list view window
520 */
522 {
523  HRESULT hr;
524  DWORD dwStyle, dwExStyle;
525  UINT ViewMode;
526 
527  TRACE("%p\n", this);
528 
531  dwExStyle = WS_EX_CLIENTEDGE;
532 
534  dwStyle |= LVS_ALIGNLEFT;
535  else
536  dwStyle |= LVS_ALIGNTOP | LVS_SHOWSELALWAYS;
537 
538  ViewMode = m_FolderSettings.ViewMode;
540  if (SUCCEEDED(hr))
541  {
542  if (ViewMode >= FVM_FIRST && ViewMode <= FVM_LAST)
543  m_FolderSettings.ViewMode = ViewMode;
544  else
545  ERR("Ignoring invalid ViewMode from SFVM_DEFVIEWMODE: %u (was: %u)\n", ViewMode, m_FolderSettings.ViewMode);
546  }
547 
548  switch (m_FolderSettings.ViewMode)
549  {
550  case FVM_ICON:
551  dwStyle |= LVS_ICON;
552  break;
553 
554  case FVM_DETAILS:
555  dwStyle |= LVS_REPORT;
556  break;
557 
558  case FVM_SMALLICON:
559  dwStyle |= LVS_SMALLICON;
560  break;
561 
562  case FVM_LIST:
563  dwStyle |= LVS_LIST;
564  break;
565 
566  default:
567  dwStyle |= LVS_LIST;
568  break;
569  }
570 
572  dwStyle |= LVS_AUTOARRANGE;
573 
576 
578  dwStyle |= LVS_SINGLESEL;
579 
581  dwExStyle &= ~WS_EX_CLIENTEDGE;
582 
583  RECT rcListView = {0,0,0,0};
584  m_ListView.Create(m_hWnd, rcListView, L"FolderView", dwStyle, dwExStyle, ID_LISTVIEW);
585 
586  if (!m_ListView)
587  return FALSE;
588 
590  m_sortInfo.nHeaderID = -1;
592 
593  /* UpdateShellSettings(); */
594  return TRUE;
595 }
596 
598 {
600  {
601  /* Check if drop shadows option is enabled */
602  BOOL bDropShadow = FALSE;
603  DWORD cbDropShadow = sizeof(bDropShadow);
604 
605  /*
606  * The desktop ListView always take the default desktop colours, by
607  * remaining transparent and letting user32/win32k paint itself the
608  * desktop background color, if any.
609  */
611 
612  SHGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
613  L"ListviewShadow", NULL, &bDropShadow, &cbDropShadow);
614  if (bDropShadow)
615  {
616  /* Set the icon background transparent */
618  m_ListView.SetTextColor(RGB(255, 255, 255));
619  m_ListView.SetExtendedListViewStyle(LVS_EX_TRANSPARENTSHADOWTEXT, LVS_EX_TRANSPARENTSHADOWTEXT);
620  }
621  else
622  {
623  /* Set the icon background as the same colour as the desktop */
624  COLORREF crDesktop = GetSysColor(COLOR_DESKTOP);
625  m_ListView.SetTextBkColor(crDesktop);
626  if (GetRValue(crDesktop) + GetGValue(crDesktop) + GetBValue(crDesktop) > 128 * 3)
627  m_ListView.SetTextColor(RGB(0, 0, 0));
628  else
629  m_ListView.SetTextColor(RGB(255, 255, 255));
630  m_ListView.SetExtendedListViewStyle(0, LVS_EX_TRANSPARENTSHADOWTEXT);
631  }
632  }
633  else
634  {
635  // text background color
636  COLORREF clrTextBack = m_viewinfo_data.clrTextBack;
637  m_ListView.SetTextBkColor(clrTextBack);
638 
639  // text color
640  COLORREF clrText;
642  clrText = m_viewinfo_data.clrText;
643  else
644  clrText = GetSysColor(COLOR_WINDOWTEXT);
645 
646  m_ListView.SetTextColor(clrText);
647 
648  // Background is painted by the parent via WM_PRINTCLIENT.
649  m_ListView.SetExtendedListViewStyle(LVS_EX_TRANSPARENTBKGND, LVS_EX_TRANSPARENTBKGND);
650  }
651 }
652 
653 /**********************************************************
654 * ShellView_InitList()
655 *
656 * - adds all needed columns to the shellview
657 */
659 {
661  WCHAR szTemp[50];
662  HIMAGELIST big_icons, small_icons;
663 
664  TRACE("%p\n", this);
665 
667 
669 
670  if (m_pSF2Parent)
671  {
672  for (int i = 0; 1; i++)
673  {
674  if (FAILED(m_pSF2Parent->GetDetailsOf(NULL, i, &sd)))
675  break;
676  StrRetToStrNW( szTemp, 50, &sd.str, NULL);
677  m_ListView.InsertColumn(i, szTemp, sd.fmt, sd.cxChar * 8);
678 
679  InsertMenuW(m_hMenuArrangeModes, -1, MF_STRING, 0x30 + i, szTemp);
680  }
681 
683  }
684  else
685  {
686  FIXME("no m_pSF2Parent\n");
687  }
688 
689  Shell_GetImageLists(&big_icons, &small_icons);
691  m_ListView.SetImageList(small_icons, LVSIL_SMALL);
692 
693  return TRUE;
694 }
695 
696 /*************************************************************************
697  * ShellView_ListViewCompareItems
698  *
699  * Compare Function for the Listview (FileOpen Dialog)
700  *
701  * PARAMS
702  * lParam1 [I] the first ItemIdList to compare with
703  * lParam2 [I] the second ItemIdList to compare with
704  * lpData [I] The column ID for the header Ctrl to process
705  *
706  * RETURNS
707  * A negative value if the first item should precede the second,
708  * a positive value if the first item should follow the second,
709  * or zero if the two items are equivalent
710  */
712 {
713  PCUIDLIST_RELATIVE pidl1 = reinterpret_cast<PCUIDLIST_RELATIVE>(lParam1);
714  PCUIDLIST_RELATIVE pidl2 = reinterpret_cast<PCUIDLIST_RELATIVE>(lParam2);
715  CDefView *pThis = reinterpret_cast<CDefView*>(lpData);
716 
717  HRESULT hres = pThis->m_pSFParent->CompareIDs(pThis->m_sortInfo.nHeaderID, pidl1, pidl2);
719  return 0;
720 
721  SHORT nDiff = HRESULT_CODE(hres);
722  if (!pThis->m_sortInfo.bIsAscending)
723  nDiff = -nDiff;
724  return nDiff;
725 }
726 
728 {
729  HWND hHeader;
730  HDITEM hColumn;
731 
732  if (m_ListView.GetWindowLongPtr(GWL_STYLE) & LVS_NOSORTHEADER)
733  return TRUE;
734 
735  hHeader = (HWND)m_ListView.SendMessage(LVM_GETHEADER, 0, 0);
736  ZeroMemory(&hColumn, sizeof(hColumn));
737 
738  /* If the sorting column changed, remove the sorting style from the old column */
739  if ( (m_sortInfo.nLastHeaderID != -1) &&
741  {
742  hColumn.mask = HDI_FORMAT;
743  Header_GetItem(hHeader, m_sortInfo.nLastHeaderID, &hColumn);
744  hColumn.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
745  Header_SetItem(hHeader, m_sortInfo.nLastHeaderID, &hColumn);
746  }
747 
748  /* Set the sorting style to the new column */
749  hColumn.mask = HDI_FORMAT;
750  Header_GetItem(hHeader, m_sortInfo.nHeaderID, &hColumn);
751 
752  hColumn.fmt &= (m_sortInfo.bIsAscending ? ~HDF_SORTDOWN : ~HDF_SORTUP );
753  hColumn.fmt |= (m_sortInfo.bIsAscending ? HDF_SORTUP : HDF_SORTDOWN);
754  Header_SetItem(hHeader, m_sortInfo.nHeaderID, &hColumn);
755 
756  /* Sort the list, using the current values of nHeaderID and bIsAscending */
759 }
760 
762 {
763  return reinterpret_cast<PCUITEMID_CHILD>(m_ListView.GetItemData(i));
764 }
765 
767 {
768  return reinterpret_cast<PCUITEMID_CHILD>(lvItem.lParam);
769 }
770 
771 /**********************************************************
772 * LV_FindItemByPidl()
773 */
775 {
776  int cItems = m_ListView.GetItemCount();
777 
778  for (int i = 0; i<cItems; i++)
779  {
780  PCUITEMID_CHILD currentpidl = _PidlByItem(i);
781  HRESULT hr = m_pSFParent->CompareIDs(0, pidl, currentpidl);
782 
783  if (SUCCEEDED(hr) && !HRESULT_CODE(hr))
784  {
785  return i;
786  }
787  }
788  return -1;
789 }
790 
791 /**********************************************************
792 * LV_AddItem()
793 */
795 {
796  LVITEMW lvItem;
797 
798  TRACE("(%p)(pidl=%p)\n", this, pidl);
799 
800  lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
801  lvItem.iItem = m_ListView.GetItemCount(); /*add the item to the end of the list*/
802  lvItem.iSubItem = 0;
803  lvItem.lParam = reinterpret_cast<LPARAM>(ILClone(pidl)); /*set the item's data*/
804  lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/
805  lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
806  lvItem.stateMask = LVIS_CUT;
807 
808  return m_ListView.InsertItem(&lvItem);
809 }
810 
811 /**********************************************************
812 * LV_DeleteItem()
813 */
815 {
816  int nIndex;
817 
818  TRACE("(%p)(pidl=%p)\n", this, pidl);
819 
820  nIndex = LV_FindItemByPidl(pidl);
821 
822  return (-1 == m_ListView.DeleteItem(nIndex)) ? FALSE : TRUE;
823 }
824 
825 /**********************************************************
826 * LV_RenameItem()
827 */
829 {
830  int nItem;
831  LVITEMW lvItem;
832 
833  TRACE("(%p)(pidlold=%p pidlnew=%p)\n", this, pidlOld, pidlNew);
834 
835  nItem = LV_FindItemByPidl(pidlOld);
836 
837  if ( -1 != nItem )
838  {
839  lvItem.mask = LVIF_PARAM; /* only the pidl */
840  lvItem.iItem = nItem;
841  lvItem.iSubItem = 0;
842  m_ListView.GetItem(&lvItem);
843 
844  SHFree(reinterpret_cast<LPVOID>(lvItem.lParam));
845  lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
846  lvItem.iItem = nItem;
847  lvItem.iSubItem = 0;
848  lvItem.lParam = reinterpret_cast<LPARAM>(ILClone(pidlNew)); /* set the item's data */
849  lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
850  m_ListView.SetItem(&lvItem);
851  m_ListView.Update(nItem);
852  return TRUE; /* FIXME: better handling */
853  }
854 
855  return FALSE;
856 }
857 
858 /**********************************************************
859 * LV_ProdItem()
860 */
862 {
863  int nItem;
864  LVITEMW lvItem;
865 
866  TRACE("(%p)(pidl=%p)\n", this, pidl);
867 
868  nItem = LV_FindItemByPidl(pidl);
869 
870  if (-1 != nItem)
871  {
872  lvItem.mask = LVIF_IMAGE;
873  lvItem.iItem = nItem;
874  lvItem.iSubItem = 0;
876  m_ListView.SetItem(&lvItem);
877  m_ListView.Update(nItem);
878  return TRUE;
879  }
880 
881  return FALSE;
882 }
883 
884 /**********************************************************
885 * ShellView_FillList()
886 *
887 * - gets the objectlist from the shellfolder
888 * - sorts the list
889 * - fills the list into the view
890 */
892 {
893  PITEMID_CHILD pidl = static_cast<PITEMID_CHILD>(ptr);
894  CDefView *pThis = static_cast<CDefView *>(arg);
895 
896  /* in a commdlg This works as a filemask*/
897  if (pThis->IncludeObject(pidl) == S_OK)
898  pThis->LV_AddItem(pidl);
899 
900  SHFree(pidl);
901  return TRUE;
902 }
903 
905 {
906  CComPtr<IEnumIDList> pEnumIDList;
907  PITEMID_CHILD pidl;
908  DWORD dwFetched;
909  HRESULT hRes;
910  HDPA hdpa;
911  DWORD dFlags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS;
912  DWORD dwValue, cbValue;
913 
914  TRACE("%p\n", this);
915 
916  /* determine if there is a setting to show all the hidden files/folders */
917  dwValue = 1;
918  cbValue = sizeof(dwValue);
920  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
921  L"Hidden", NULL, &dwValue, &cbValue);
922  if (dwValue == 1)
923  {
924  dFlags |= SHCONTF_INCLUDEHIDDEN;
925  m_ListView.SendMessageW(LVM_SETCALLBACKMASK, LVIS_CUT, 0);
926  }
927 
928  dwValue = 0;
929  cbValue = sizeof(dwValue);
931  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
932  L"ShowSuperHidden", NULL, &dwValue, &cbValue);
933  if (dwValue)
934  {
935  dFlags |= SHCONTF_INCLUDESUPERHIDDEN;
936  m_ListView.SendMessageW(LVM_SETCALLBACKMASK, LVIS_CUT, 0);
937  }
938 
939  /* get the itemlist from the shfolder */
940  hRes = m_pSFParent->EnumObjects(m_hWnd, dFlags, &pEnumIDList);
941  if (hRes != S_OK)
942  {
943  if (hRes == S_FALSE)
944  return(NOERROR);
945  return(hRes);
946  }
947 
948  /* create a pointer array */
949  hdpa = DPA_Create(16);
950  if (!hdpa)
951  {
952  return(E_OUTOFMEMORY);
953  }
954 
955  /* copy the items into the array*/
956  while((S_OK == pEnumIDList->Next(1, &pidl, &dwFetched)) && dwFetched)
957  {
958  if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
959  {
960  SHFree(pidl);
961  }
962  }
963 
964  /*turn the listview's redrawing off*/
966 
967  DPA_DestroyCallback( hdpa, fill_list, this);
968 
969  /* sort the array */
970  if (m_pSF2Parent)
971  {
972  m_pSF2Parent->GetDefaultColumn(NULL, (ULONG*)&m_sortInfo.nHeaderID, NULL);
973  }
974  else
975  {
976  FIXME("no m_pSF2Parent\n");
977  }
979  _Sort();
980 
982  {
985  }
986 
987  // load custom background image and custom text color
990 
991  /*turn the listview's redrawing back on and force it to draw*/
993 
995 
997  {
998  // redraw now
999  m_ListView.InvalidateRect(NULL, TRUE);
1000  }
1001 
1003 
1004  return S_OK;
1005 }
1006 
1008 {
1009  m_ListView.UpdateWindow();
1010  bHandled = FALSE;
1011  return 0;
1012 }
1013 
1015 {
1016  return m_ListView.SendMessageW(uMsg, 0, 0);
1017 }
1018 
1020 {
1021  if (!m_Destroyed)
1022  {
1023  m_Destroyed = TRUE;
1024  if (m_hMenu)
1025  {
1027  m_hMenu = NULL;
1028  }
1031  m_hNotify = NULL;
1033  m_pidlParent = NULL;
1034  }
1035  bHandled = FALSE;
1036  return 0;
1037 }
1038 
1040 {
1041  /* redirect to parent */
1044 
1045  bHandled = FALSE;
1046  return 0;
1047 }
1048 
1049 static VOID
1051 {
1052  INT x0 = prc->left, y0 = prc->top, x1 = prc->right, y1 = prc->bottom;
1053  x0 += dx;
1054  y0 += dy;
1055 
1056  HDC hMemDC = CreateCompatibleDC(hDC);
1057  HGDIOBJ hbmOld = SelectObject(hMemDC, hbm);
1058 
1059  for (INT y = y0; y < y1; y += nHeight)
1060  {
1061  for (INT x = x0; x < x1; x += nWidth)
1062  {
1063  BitBlt(hDC, x, y, nWidth, nHeight, hMemDC, 0, 0, SRCCOPY);
1064  }
1065  }
1066 
1067  SelectObject(hMemDC, hbmOld);
1068  DeleteDC(hMemDC);
1069 }
1070 
1072 {
1073  HDC hDC = (HDC)wParam;
1074 
1075  RECT rc;
1077 
1079  {
1080  BITMAP bm;
1081  if (::GetObject(m_viewinfo_data.hbmBack, sizeof(BITMAP), &bm))
1082  {
1083  INT dx = -(::GetScrollPos(m_ListView, SB_HORZ) % bm.bmWidth);
1084  INT dy = -(::GetScrollPos(m_ListView, SB_VERT) % bm.bmHeight);
1085  DrawTileBitmap(hDC, &rc, m_viewinfo_data.hbmBack, bm.bmWidth, bm.bmHeight, dx, dy);
1086  }
1087  }
1088  else
1089  {
1091  }
1092 
1093  bHandled = TRUE;
1094 
1095  return TRUE;
1096 }
1097 
1099 {
1100  /* Update desktop labels color */
1101  UpdateListColors();
1102 
1103  /* Forward WM_SYSCOLORCHANGE to common controls */
1104  return m_ListView.SendMessageW(uMsg, 0, 0);
1105 }
1106 
1108 {
1109  return reinterpret_cast<LRESULT>(m_pShellBrowser.p);
1110 }
1111 
1113 {
1114  this->AddRef();
1115  bHandled = FALSE;
1116  return 0;
1117 }
1118 
1120 {
1121  this->Release();
1122  bHandled = FALSE;
1123  return 0;
1124 }
1125 
1126 /**********************************************************
1127 * ShellView_OnCreate()
1128 */
1130 {
1132  SHChangeNotifyEntry ntreg;
1134 
1135  TRACE("%p\n", this);
1136 
1138  {
1139  if (FAILED(RegisterDragDrop(m_hWnd, pdt)))
1140  ERR("Registering Drag Drop Failed");
1141  }
1142 
1143  /* register for receiving notifications */
1144  m_pSFParent->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
1145  if (ppf2)
1146  {
1147  ppf2->GetCurFolder(&m_pidlParent);
1148  ntreg.fRecursive = TRUE;
1149  ntreg.pidl = m_pidlParent;
1151  }
1152 
1153  if (CreateList())
1154  {
1155  if (InitList())
1156  {
1157  FillList();
1158  }
1159  }
1160 
1161  /* _DoFolderViewCB(SFVM_GETNOTIFY, ?? ??) */
1162 
1164 
1165  UpdateStatusbar();
1166 
1167  return S_OK;
1168 }
1169 
1170 /**********************************************************
1171  * #### Handling of the menus ####
1172  */
1173 
1174 extern "C" DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID);
1175 
1177 {
1178  MENUITEMINFOW mii = {sizeof(mii), MIIM_SUBMENU};
1179  if (::GetMenuItemInfoW(hmenu, id, FALSE, &mii))
1180  return mii.hSubMenu;
1181 
1182  return NULL;
1183 }
1184 
1185 /* ReallyGetMenuItemID returns the id of an item even if it opens a submenu,
1186  GetMenuItemID returns -1 if the specified item opens a submenu */
1188 {
1189  MENUITEMINFOW mii = {sizeof(mii), MIIM_ID};
1190  if (::GetMenuItemInfoW(hmenu, i, TRUE, &mii))
1191  return mii.wID;
1192 
1193  return UINT_MAX;
1194 }
1195 
1197 {
1199  if (!hFileMenu)
1200  return E_FAIL;
1201 
1202  /* Cleanup the items added previously */
1203  for (int i = GetMenuItemCount(hFileMenu) - 1; i >= 0; i--)
1204  {
1205  UINT id = GetMenuItemID(hFileMenu, i);
1207  DeleteMenu(hFileMenu, i, MF_BYPOSITION);
1208  }
1209 
1211 
1212  /* Store the context menu in m_pCM and keep it in order to invoke the selected command later on */
1215  if (FAILED_UNEXPECTEDLY(hr))
1216  return hr;
1217 
1219 
1220  hr = m_pCM->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
1221  if (FAILED_UNEXPECTEDLY(hr))
1222  return hr;
1223 
1224  // TODO: filter or something
1225 
1226  Shell_MergeMenus(hFileMenu, hmenu, 0, 0, 0xFFFF, MM_ADDSEPARATOR | MM_SUBMENUSHAVEIDS);
1227 
1229 
1230  return S_OK;
1231 }
1232 
1234 {
1236  if (!hEditMenu)
1237  return E_FAIL;
1238 
1239  HMENU hmenuContents = ::LoadMenuW(shell32_hInstance, L"MENU_003");
1240  if (!hmenuContents)
1241  return E_FAIL;
1242 
1243  Shell_MergeMenus(hEditMenu, hmenuContents, 0, 0, 0xFFFF, 0);
1244 
1245  ::DestroyMenu(hmenuContents);
1246 
1247  return S_OK;
1248 }
1249 
1251 {
1253  if (!hViewMenu)
1254  return E_FAIL;
1255 
1257  if (!m_hMenuViewModes)
1258  return E_FAIL;
1259 
1262 
1263  return S_OK;
1264 }
1265 
1267 {
1268  /* We only need to fill this once */
1269  if (GetMenuItemID(hmenuArrange, 0) == FCIDM_SHVIEW_AUTOARRANGE)
1270  {
1271  Shell_MergeMenus(hmenuArrange, m_hMenuArrangeModes, 0, 0, 0xFFFF,0);
1272  }
1273 
1274  /* Also check the menu item according to which we sort */
1275  CheckMenuRadioItem(hmenuArrange,
1276  0x30,
1277  0x100,
1278  m_sortInfo.nHeaderID + 0x30,
1279  MF_BYCOMMAND);
1280 
1282  {
1284  }
1285  else
1286  {
1288 
1289  if (GetAutoArrange() == S_OK)
1291  }
1292 
1293 
1294  return S_OK;
1295 }
1296 
1298 {
1300  {
1301  UINT iItemFirst = FCIDM_SHVIEW_BIGICON;
1302  UINT iItemLast = iItemFirst + FVM_LAST - FVM_FIRST;
1303  UINT iItem = iItemFirst + m_FolderSettings.ViewMode - FVM_FIRST;
1304  CheckMenuRadioItem(hmenuView, iItemFirst, iItemLast, iItem, MF_BYCOMMAND);
1305  }
1306 
1307  return S_OK;
1308 }
1309 
1310 /**********************************************************
1311 * ShellView_GetSelections()
1312 *
1313 * - fills the m_apidl list with the selected objects
1314 *
1315 * RETURNS
1316 * number of selected items
1317 */
1319 {
1320  SHFree(m_apidl);
1321 
1323  m_apidl = static_cast<PCUITEMID_CHILD*>(SHAlloc(m_cidl * sizeof(PCUITEMID_CHILD)));
1324  if (!m_apidl)
1325  {
1326  m_cidl = 0;
1327  return 0;
1328  }
1329 
1330  TRACE("-- Items selected =%u\n", m_cidl);
1331 
1332  UINT i = 0;
1333  int lvIndex = -1;
1334  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
1335  {
1336  m_apidl[i] = _PidlByItem(lvIndex);
1337  i++;
1338  if (i == m_cidl)
1339  break;
1340  TRACE("-- selected Item found\n");
1341  }
1342 
1343  return m_cidl;
1344 }
1345 
1347 {
1348  CMINVOKECOMMANDINFO cmi;
1349 
1350  ZeroMemory(&cmi, sizeof(cmi));
1351  cmi.cbSize = sizeof(cmi);
1352  cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1353  cmi.hwnd = m_hWnd;
1354 
1355  if (GetKeyState(VK_SHIFT) & 0x8000)
1356  cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
1357 
1358  if (GetKeyState(VK_CONTROL) & 0x8000)
1359  cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
1360 
1361  HRESULT hr = m_pCM->InvokeCommand(&cmi);
1362  if (FAILED_UNEXPECTEDLY(hr))
1363  return hr;
1364 
1365  return S_OK;
1366 }
1367 
1368 /**********************************************************
1369  * ShellView_OpenSelectedItems()
1370  */
1372 {
1373  HMENU hMenu;
1374  UINT uCommand;
1375  HRESULT hResult;
1376 
1378  if (m_cidl == 0)
1379  return S_OK;
1380 
1381  hResult = OnDefaultCommand();
1382  if (hResult == S_OK)
1383  return hResult;
1384 
1385  hMenu = CreatePopupMenu();
1386  if (!hMenu)
1387  return E_FAIL;
1388 
1390  if (FAILED_UNEXPECTEDLY(hResult))
1391  goto cleanup;
1392 
1393  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_DEFAULTONLY);
1394  if (FAILED_UNEXPECTEDLY(hResult))
1395  goto cleanup;
1396 
1397  uCommand = GetMenuDefaultItem(hMenu, FALSE, 0);
1398  if (uCommand == (UINT)-1)
1399  {
1400  hResult = E_FAIL;
1401  goto cleanup;
1402  }
1403 
1404  InvokeContextMenuCommand(uCommand);
1405 
1406 cleanup:
1407 
1408  if (hMenu)
1409  DestroyMenu(hMenu);
1410 
1411  if (m_pCM)
1412  {
1414  m_pCM.Release();
1415  }
1416 
1417  return hResult;
1418 }
1419 
1420 /**********************************************************
1421  * ShellView_DoContextMenu()
1422  */
1424 {
1425  int x, y;
1426  UINT uCommand;
1427  HRESULT hResult;
1428 
1429  TRACE("(%p)\n", this);
1430 
1432  if (!m_hContextMenu)
1433  return E_FAIL;
1434 
1435  if (lParam != ~0) // unless app key (menu key) was pressed
1436  {
1437  x = GET_X_LPARAM(lParam);
1438  y = GET_Y_LPARAM(lParam);
1439 
1440  LV_HITTESTINFO hittest = { { x, y } };
1441  ScreenToClient(&hittest.pt);
1442  m_ListView.HitTest(&hittest);
1443 
1444  // Right-Clicked item is selected? If selected, no selection change.
1445  // If not selected, then reset the selection and select the item.
1446  if ((hittest.flags & LVHT_ONITEM) &&
1448  {
1449  SelectItem(hittest.iItem, SVSI_SELECT | SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE);
1450  }
1451  }
1452 
1454 
1456  if (FAILED_UNEXPECTEDLY(hResult))
1457  goto cleanup;
1458 
1459  /* Use 1 as the first id as we want 0 the mean that the user canceled the menu */
1460  hResult = m_pCM->QueryContextMenu(m_hContextMenu, 0, CONTEXT_MENU_BASE_ID, FCIDM_SHVIEWLAST, CMF_NORMAL);
1461  if (FAILED_UNEXPECTEDLY(hResult))
1462  goto cleanup;
1463 
1464  /* There is no position requested, so try to find one */
1465  if (lParam == ~0)
1466  {
1467  HWND hFocus = ::GetFocus();
1468  int lvIndex = -1;
1469  POINT pt;
1470 
1471  if (hFocus == m_ListView.m_hWnd || m_ListView.IsChild(hFocus))
1472  {
1473  /* Is there an item focused and selected? */
1475  /* If not, find the first selected item */
1476  if (lvIndex < 0)
1477  lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED);
1478  }
1479 
1480  /* We got something */
1481  if (lvIndex > -1)
1482  {
1483  /* Let's find the center of the icon */
1484  RECT rc = { LVIR_ICON };
1485  m_ListView.SendMessage(LVM_GETITEMRECT, lvIndex, (LPARAM)&rc);
1486  pt.x = (rc.right + rc.left) / 2;
1487  pt.y = (rc.bottom + rc.top) / 2;
1488  }
1489  else
1490  {
1491  /* We have to drop it somewhere.. */
1492  pt.x = pt.y = 0;
1493  }
1494 
1495  m_ListView.ClientToScreen(&pt);
1496  x = pt.x;
1497  y = pt.y;
1498  }
1499 
1500  uCommand = TrackPopupMenu(m_hContextMenu,
1502  x, y, 0, m_hWnd, NULL);
1503  if (uCommand == 0)
1504  goto cleanup;
1505 
1506  if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
1507  goto cleanup;
1508 
1510 
1511 cleanup:
1512  if (m_pCM)
1513  {
1515  m_pCM.Release();
1516  }
1517 
1518  if (m_hContextMenu)
1519  {
1521  m_hContextMenu = NULL;
1522  }
1523 
1524  return 0;
1525 }
1526 
1528 {
1529  HRESULT hResult;
1530  HMENU hMenu;
1531 
1532  hMenu = CreatePopupMenu();
1533  if (!hMenu)
1534  return 0;
1535 
1536  hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
1537  if (FAILED_UNEXPECTEDLY( hResult))
1538  goto cleanup;
1539 
1540  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
1541  if (FAILED_UNEXPECTEDLY( hResult))
1542  goto cleanup;
1543 
1544  InvokeContextMenuCommand(uCommand);
1545 
1546 cleanup:
1547  if (m_pCM)
1548  {
1550  m_pCM.Release();
1551  }
1552 
1553  if (hMenu)
1554  DestroyMenu(hMenu);
1555 
1556  return 0;
1557 }
1558 
1559 /**********************************************************
1560  * ##### message handling #####
1561  */
1562 
1563 /**********************************************************
1564 * ShellView_OnSize()
1565 */
1567 {
1568  WORD wWidth, wHeight;
1569 
1570  wWidth = LOWORD(lParam);
1571  wHeight = HIWORD(lParam);
1572 
1573  TRACE("%p width=%u height=%u\n", this, wWidth, wHeight);
1574 
1575  /* Resize the ListView to fit our window */
1576  if (m_ListView)
1577  {
1578  ::MoveWindow(m_ListView, 0, 0, wWidth, wHeight, TRUE);
1579  }
1580 
1581  _DoFolderViewCB(SFVM_SIZE, 0, 0);
1582 
1583  return 0;
1584 }
1585 
1586 /**********************************************************
1587 * ShellView_OnDeactivate()
1588 *
1589 * NOTES
1590 * internal
1591 */
1593 {
1594  TRACE("%p\n", this);
1595 
1596  if (m_uState != SVUIA_DEACTIVATE)
1597  {
1598  // TODO: cleanup menu after deactivation
1599 
1601  }
1602 }
1603 
1605 {
1606  TRACE("%p uState=%x\n", this, uState);
1607 
1608  /*don't do anything if the state isn't really changing */
1609  if (m_uState == uState)
1610  {
1611  return;
1612  }
1613 
1614  if (uState == SVUIA_DEACTIVATE)
1615  {
1616  OnDeactivate();
1617  }
1618  else
1619  {
1621  {
1622  FillEditMenu();
1623  FillViewMenu();
1624  m_pShellBrowser->SetMenuSB(m_hMenu, 0, m_hWnd);
1626  }
1627 
1628  if (SVUIA_ACTIVATE_FOCUS == uState)
1629  {
1630  m_ListView.SetFocus();
1631  }
1632  }
1633 
1634  m_uState = uState;
1635  TRACE("--\n");
1636 }
1637 
1638 /**********************************************************
1639 * ShellView_OnActivate()
1640 */
1642 {
1644  return 0;
1645 }
1646 
1647 /**********************************************************
1648 * ShellView_OnSetFocus()
1649 *
1650 */
1652 {
1653  TRACE("%p\n", this);
1654 
1655  /* Tell the browser one of our windows has received the focus. This
1656  should always be done before merging menus (OnActivate merges the
1657  menus) if one of our windows has the focus.*/
1658 
1659  m_pShellBrowser->OnViewWindowActive(this);
1661 
1662  /* Set the focus to the listview */
1663  m_ListView.SetFocus();
1664 
1665  /* Notify the ICommDlgBrowser interface */
1666  OnStateChange(CDBOSC_SETFOCUS);
1667 
1668  return 0;
1669 }
1670 
1671 /**********************************************************
1672 * ShellView_OnKillFocus()
1673 */
1675 {
1676  TRACE("(%p) stub\n", this);
1677 
1679  /* Notify the ICommDlgBrowser */
1680  OnStateChange(CDBOSC_KILLFOCUS);
1681 
1682  return 0;
1683 }
1684 
1685 /**********************************************************
1686 * ShellView_OnCommand()
1687 *
1688 * NOTES
1689 * the CmdID's are the ones from the context menu
1690 */
1692 {
1693  DWORD dwCmdID;
1694  DWORD dwCmd;
1695  HWND hwndCmd;
1696  int nCount;
1697 
1698  dwCmdID = GET_WM_COMMAND_ID(wParam, lParam);
1699  dwCmd = GET_WM_COMMAND_CMD(wParam, lParam);
1700  hwndCmd = GET_WM_COMMAND_HWND(wParam, lParam);
1701 
1702  TRACE("(%p)->(0x%08x 0x%08x %p) stub\n", this, dwCmdID, dwCmd, hwndCmd);
1703 
1704  switch (dwCmdID)
1705  {
1708  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_SMALLICON);
1709  CheckToolbar();
1710  break;
1711 
1712  case FCIDM_SHVIEW_BIGICON:
1714  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_ICON);
1715  CheckToolbar();
1716  break;
1717 
1718  case FCIDM_SHVIEW_LISTVIEW:
1720  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_LIST);
1721  CheckToolbar();
1722  break;
1723 
1726  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
1727  CheckToolbar();
1728  break;
1729 
1730  /* the menu-ID's for sorting are 0x30... see shrec.rc */
1731  case 0x30:
1732  case 0x31:
1733  case 0x32:
1734  case 0x33:
1735  m_sortInfo.nHeaderID = dwCmdID - 0x30;
1737  _Sort();
1738  break;
1739 
1741  //FIXME
1742  break;
1744  if (GetAutoArrange() == S_OK)
1745  m_ListView.ModifyStyle(LVS_AUTOARRANGE, 0);
1746  else
1747  AutoArrange();
1748  break;
1751  break;
1752 
1754  nCount = m_ListView.GetItemCount();
1755  for (int i=0; i < nCount; i++)
1757  break;
1758 
1759  case FCIDM_SHVIEW_REFRESH:
1760  Refresh();
1761  break;
1762 
1763  case FCIDM_SHVIEW_DELETE:
1764  case FCIDM_SHVIEW_CUT:
1765  case FCIDM_SHVIEW_COPY:
1766  case FCIDM_SHVIEW_RENAME:
1768  return OnExplorerCommand(dwCmdID, TRUE);
1769 
1770  case FCIDM_SHVIEW_INSERT:
1771  case FCIDM_SHVIEW_UNDO:
1774  return OnExplorerCommand(dwCmdID, FALSE);
1775  default:
1776  /* WM_COMMAND messages from the file menu are routed to the CDefView so as to let m_pCM handle the command */
1777  if (m_pCM && dwCmd == 0)
1778  {
1779  InvokeContextMenuCommand(dwCmdID);
1780  }
1781  }
1782 
1783  return 0;
1784 }
1785 
1786 static BOOL
1788 {
1789  HKEY hKey;
1790  LONG error;
1791  DWORD dwValue = FALSE, cbValue;
1792 
1794  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer",
1795  0, KEY_READ, &hKey);
1796  if (error)
1797  return dwValue;
1798 
1799  cbValue = sizeof(dwValue);
1800  RegQueryValueExW(hKey, L"SelectExtOnRename", NULL, NULL, (LPBYTE)&dwValue, &cbValue);
1801 
1802  RegCloseKey(hKey);
1803  return !!dwValue;
1804 }
1805 
1806 /**********************************************************
1807 * ShellView_OnNotify()
1808 */
1809 
1811 {
1812  UINT CtlID;
1813  LPNMHDR lpnmh;
1814  LPNMLISTVIEW lpnmlv;
1815  NMLVDISPINFOW *lpdi;
1816  PCUITEMID_CHILD pidl;
1817  BOOL unused;
1818 
1819  CtlID = wParam;
1820  lpnmh = (LPNMHDR)lParam;
1821  lpnmlv = (LPNMLISTVIEW)lpnmh;
1822  lpdi = (NMLVDISPINFOW *)lpnmh;
1823 
1824  TRACE("%p CtlID=%u lpnmh->code=%x\n", this, CtlID, lpnmh->code);
1825 
1826  switch (lpnmh->code)
1827  {
1828  case NM_SETFOCUS:
1829  TRACE("-- NM_SETFOCUS %p\n", this);
1830  OnSetFocus(0, 0, 0, unused);
1831  break;
1832 
1833  case NM_KILLFOCUS:
1834  TRACE("-- NM_KILLFOCUS %p\n", this);
1835  OnDeactivate();
1836  /* Notify the ICommDlgBrowser interface */
1837  OnStateChange(CDBOSC_KILLFOCUS);
1838  break;
1839 
1840  case NM_CUSTOMDRAW:
1841  TRACE("-- NM_CUSTOMDRAW %p\n", this);
1842  return CDRF_DODEFAULT;
1843 
1844  case NM_RELEASEDCAPTURE:
1845  TRACE("-- NM_RELEASEDCAPTURE %p\n", this);
1846  break;
1847 
1848  case NM_CLICK:
1849  TRACE("-- NM_CLICK %p\n", this);
1850  break;
1851 
1852  case NM_RCLICK:
1853  TRACE("-- NM_RCLICK %p\n", this);
1854  break;
1855 
1856  case NM_DBLCLK:
1857  TRACE("-- NM_DBLCLK %p\n", this);
1859  break;
1860 
1861  case NM_RETURN:
1862  TRACE("-- NM_RETURN %p\n", this);
1864  break;
1865 
1866  case HDN_ENDTRACKW:
1867  TRACE("-- HDN_ENDTRACKW %p\n", this);
1868  /*nColumn1 = m_ListView.GetColumnWidth(0);
1869  nColumn2 = m_ListView.GetColumnWidth(1);*/
1870  break;
1871 
1872  case LVN_DELETEITEM:
1873  TRACE("-- LVN_DELETEITEM %p\n", this);
1874 
1875  /*delete the pidl because we made a copy of it*/
1876  SHFree(reinterpret_cast<LPVOID>(lpnmlv->lParam));
1877 
1878  break;
1879 
1880  case LVN_DELETEALLITEMS:
1881  TRACE("-- LVN_DELETEALLITEMS %p\n", this);
1882  return FALSE;
1883 
1884  case LVN_INSERTITEM:
1885  TRACE("-- LVN_INSERTITEM (STUB)%p\n", this);
1886  break;
1887 
1888  case LVN_ITEMACTIVATE:
1889  TRACE("-- LVN_ITEMACTIVATE %p\n", this);
1890  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1891  break;
1892 
1893  case LVN_COLUMNCLICK:
1894  m_sortInfo.nHeaderID = lpnmlv->iSubItem;
1897  else
1899  _Sort();
1900  break;
1901 
1902  case LVN_GETDISPINFOA:
1903  case LVN_GETDISPINFOW:
1904  TRACE("-- LVN_GETDISPINFO %p\n", this);
1905  pidl = _PidlByItem(lpdi->item);
1906 
1907  if (lpdi->item.mask & LVIF_TEXT) /* text requested */
1908  {
1909  if (m_pSF2Parent)
1910  {
1911  SHELLDETAILS sd;
1912  if (FAILED_UNEXPECTEDLY(m_pSF2Parent->GetDetailsOf(pidl, lpdi->item.iSubItem, &sd)))
1913  break;
1914 
1915  if (lpnmh->code == LVN_GETDISPINFOA)
1916  {
1917  /* shouldn't happen */
1918  NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
1919  StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
1920  TRACE("-- text=%s\n", lpdiA->item.pszText);
1921  }
1922  else /* LVN_GETDISPINFOW */
1923  {
1924  StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1925  TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
1926  }
1927  }
1928  else
1929  {
1930  FIXME("no m_pSF2Parent\n");
1931  }
1932  }
1933  if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1934  {
1936  }
1937  if(lpdi->item.mask & LVIF_STATE)
1938  {
1939  ULONG attributes = SFGAO_HIDDEN;
1940  if (SUCCEEDED(m_pSFParent->GetAttributesOf(1, &pidl, &attributes)))
1941  {
1942  if (attributes & SFGAO_HIDDEN)
1943  {
1944  lpdi->item.state |= LVIS_CUT;
1945  }
1946  }
1947  }
1948  lpdi->item.mask |= LVIF_DI_SETITEM;
1949  break;
1950 
1951  case LVN_ITEMCHANGED:
1952  TRACE("-- LVN_ITEMCHANGED %p\n", this);
1953  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1954  UpdateStatusbar();
1955  _DoFolderViewCB(SFVM_SELECTIONCHANGED, NULL/* FIXME */, NULL/* FIXME */);
1956  break;
1957 
1958  case LVN_BEGINDRAG:
1959  case LVN_BEGINRDRAG:
1960  TRACE("-- LVN_BEGINDRAG\n");
1961 
1962  if (GetSelections())
1963  {
1965  DWORD dwAttributes = SFGAO_CANCOPY | SFGAO_CANLINK;
1966  DWORD dwEffect = DROPEFFECT_MOVE;
1967 
1968  if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
1969  {
1971 
1972  if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &dwAttributes)))
1973  {
1974  dwEffect |= dwAttributes & (SFGAO_CANCOPY | SFGAO_CANLINK);
1975  }
1976 
1978  if (SUCCEEDED(pda->QueryInterface(IID_PPV_ARG(IAsyncOperation, &piaso))))
1979  {
1980  piaso->SetAsyncMode(TRUE);
1981  }
1982 
1983  DWORD dwEffect2;
1984 
1985  m_pSourceDataObject = pda;
1986  m_ptFirstMousePos = params->ptAction;
1988 
1989  HIMAGELIST big_icons, small_icons;
1990  Shell_GetImageLists(&big_icons, &small_icons);
1991  PCUITEMID_CHILD pidl = _PidlByItem(params->iItem);
1992  int iIcon = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
1993  POINT ptItem;
1994  m_ListView.GetItemPosition(params->iItem, &ptItem);
1995 
1996  ImageList_BeginDrag(big_icons, iIcon, params->ptAction.x - ptItem.x, params->ptAction.y - ptItem.y);
1997 
1998  DoDragDrop(pda, this, dwEffect, &dwEffect2);
1999 
2001  }
2002  }
2003  break;
2004 
2005  case LVN_BEGINLABELEDITW:
2006  {
2007  DWORD dwAttr = SFGAO_CANRENAME;
2008  pidl = _PidlByItem(lpdi->item);
2009 
2010  TRACE("-- LVN_BEGINLABELEDITW %p\n", this);
2011 
2012  m_pSFParent->GetAttributesOf(1, &pidl, &dwAttr);
2013  if (SFGAO_CANRENAME & dwAttr)
2014  {
2015  HWND hEdit = reinterpret_cast<HWND>(m_ListView.SendMessage(LVM_GETEDITCONTROL));
2017 
2018  if (!(dwAttr & SFGAO_LINK) && (lpdi->item.mask & LVIF_TEXT) && !SelectExtOnRename())
2019  {
2020  LPWSTR pszText = lpdi->item.pszText;
2021  LPWSTR pchDotExt = PathFindExtensionW(pszText);
2022  ::PostMessageW(hEdit, EM_SETSEL, 0, pchDotExt - pszText);
2024  }
2025 
2026  m_isEditing = TRUE;
2027  return FALSE;
2028  }
2029 
2030  return TRUE;
2031  }
2032 
2033  case LVN_ENDLABELEDITW:
2034  {
2035  TRACE("-- LVN_ENDLABELEDITW %p\n", this);
2036 
2037  m_isEditing = FALSE;
2038 
2039  if (lpdi->item.pszText)
2040  {
2041  HRESULT hr;
2042  LVITEMW lvItem;
2043 
2044  pidl = _PidlByItem(lpdi->item);
2045  PITEMID_CHILD pidlNew = NULL;
2046  hr = m_pSFParent->SetNameOf(0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidlNew);
2047 
2048  if (SUCCEEDED(hr) && pidlNew)
2049  {
2050  lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
2051  lvItem.iItem = lpdi->item.iItem;
2052  lvItem.iSubItem = 0;
2053  lvItem.lParam = reinterpret_cast<LPARAM>(pidlNew);
2054  lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
2055  m_ListView.SetItem(&lvItem);
2056  m_ListView.Update(lpdi->item.iItem);
2057  return TRUE;
2058  }
2059  }
2060 
2061  return FALSE;
2062  }
2063 
2064  default:
2065  TRACE("-- %p WM_COMMAND %x unhandled\n", this, lpnmh->code);
2066  break;
2067  }
2068 
2069  return 0;
2070 }
2071 
2072 /*
2073  * This is just a quick hack to make the desktop work correctly.
2074  * ITranslateShellChangeNotify's IsChildID is undocumented, but most likely the way that
2075  * a folder should know if it should update upon a change notification.
2076  * It is exported by merged folders at a minimum.
2077  */
2079 {
2080  if (!pidl1 || !pidl2)
2081  return FALSE;
2082  if (ILIsParent(pidl1, pidl2, TRUE))
2083  return TRUE;
2084 
2085  if (_ILIsDesktop(pidl1))
2086  {
2087  PIDLIST_ABSOLUTE deskpidl;
2089  if (ILIsParent(deskpidl, pidl2, TRUE))
2090  {
2091  ILFree(deskpidl);
2092  return TRUE;
2093  }
2094  ILFree(deskpidl);
2096  if (ILIsParent(deskpidl, pidl2, TRUE))
2097  {
2098  ILFree(deskpidl);
2099  return TRUE;
2100  }
2101  ILFree(deskpidl);
2102  }
2103  return FALSE;
2104 }
2105 
2106 /**********************************************************
2107 * ShellView_OnChange()
2108 */
2110 {
2111  PCIDLIST_ABSOLUTE *Pidls = reinterpret_cast<PCIDLIST_ABSOLUTE*>(wParam);
2112  BOOL bParent0 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[0]);
2113  BOOL bParent1 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[1]);
2114 
2115  TRACE("(%p)(%p,%p,0x%08x)\n", this, Pidls[0], Pidls[1], lParam);
2116 
2117  switch (lParam &~ SHCNE_INTERRUPT)
2118  {
2119  case SHCNE_MKDIR:
2120  case SHCNE_CREATE:
2121  if (bParent0)
2122  {
2123  if (LV_FindItemByPidl(ILFindLastID(Pidls[0])) == -1)
2124  {
2125  LV_AddItem(ILFindLastID(Pidls[0]));
2126  }
2127  else
2128  {
2129  LV_ProdItem(ILFindLastID(Pidls[0]));
2130  }
2131  }
2132  break;
2133 
2134  case SHCNE_RMDIR:
2135  case SHCNE_DELETE:
2136  if (bParent0)
2137  LV_DeleteItem(ILFindLastID(Pidls[0]));
2138  break;
2139 
2140  case SHCNE_RENAMEFOLDER:
2141  case SHCNE_RENAMEITEM:
2142  if (bParent0 && bParent1)
2143  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[1]));
2144  else if (bParent0)
2145  LV_DeleteItem(ILFindLastID(Pidls[0]));
2146  else if (bParent1)
2147  LV_AddItem(ILFindLastID(Pidls[1]));
2148  break;
2149 
2150  case SHCNE_UPDATEITEM:
2151  if (bParent0)
2152  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[0]));
2153  break;
2154 
2155  case SHCNE_UPDATEDIR:
2156  Refresh();
2157  break;
2158  }
2159  return TRUE;
2160 }
2161 
2164 
2165 /**********************************************************
2166 * CDefView::OnCustomItem
2167 */
2169 {
2170  if (!m_pCM.p)
2171  {
2172  /* no menu */
2173  ERR("no menu!!!\n");
2174  return FALSE;
2175  }
2176 
2177  /* The lParam of WM_DRAWITEM WM_MEASUREITEM contain a menu id and this also needs to
2178  be changed to a menu identifier offset */
2179  UINT CmdID;
2180  HRESULT hres = SHGetMenuIdFromMenuMsg(uMsg, lParam, &CmdID);
2181  if (SUCCEEDED(hres))
2183 
2184  /* Forward the message to the IContextMenu2 */
2185  LRESULT result;
2187 
2188  return (SUCCEEDED(hres));
2189 }
2190 
2192 {
2193  /* Wallpaper setting affects drop shadows effect */
2194  if (wParam == SPI_SETDESKWALLPAPER || wParam == 0)
2195  UpdateListColors();
2196 
2197  return S_OK;
2198 }
2199 
2200 /**********************************************************
2201 * CDefView::OnInitMenuPopup
2202 */
2204 {
2205  HMENU hmenu = (HMENU) wParam;
2206  int nPos = LOWORD(lParam);
2207  UINT menuItemId;
2208 
2209  OnCustomItem(uMsg, wParam, lParam, bHandled);
2210 
2212 
2213  /* Lets try to find out what the hell wParam is */
2214  if (hmenu == GetSubMenu(m_hMenu, nPos))
2215  menuItemId = ReallyGetMenuItemID(m_hMenu, nPos);
2216  else if (hViewMenu && hmenu == GetSubMenu(hViewMenu, nPos))
2217  menuItemId = ReallyGetMenuItemID(hViewMenu, nPos);
2218  else if (m_hContextMenu && hmenu == GetSubMenu(m_hContextMenu, nPos))
2219  menuItemId = ReallyGetMenuItemID(m_hContextMenu, nPos);
2220  else
2221  return FALSE;
2222 
2223  switch (menuItemId)
2224  {
2225  case FCIDM_MENU_FILE:
2226  FillFileMenu();
2227  break;
2228  case FCIDM_MENU_VIEW:
2229  case FCIDM_SHVIEW_VIEW:
2231  break;
2232  case FCIDM_SHVIEW_ARRANGE:
2234  break;
2235  }
2236 
2237  return FALSE;
2238 }
2239 
2240 /**********************************************************
2241 *
2242 *
2243 * The INTERFACE of the IShellView object
2244 *
2245 *
2246 **********************************************************
2247 */
2248 
2249 /**********************************************************
2250 * ShellView_GetWindow
2251 */
2253 {
2254  TRACE("(%p)\n", this);
2255 
2256  *phWnd = m_hWnd;
2257 
2258  return S_OK;
2259 }
2260 
2262 {
2263  FIXME("(%p) stub\n", this);
2264 
2265  return E_NOTIMPL;
2266 }
2267 
2268 /**********************************************************
2269 * IShellView_TranslateAccelerator
2270 *
2271 * FIXME:
2272 * use the accel functions
2273 */
2275 {
2276  if (m_isEditing)
2277  return S_FALSE;
2278 
2279  if (lpmsg->message >= WM_KEYFIRST && lpmsg->message <= WM_KEYLAST)
2280  {
2281  if (::TranslateAcceleratorW(m_hWnd, m_hAccel, lpmsg) != 0)
2282  return S_OK;
2283 
2284  TRACE("-- key=0x%04lx\n", lpmsg->wParam) ;
2285  }
2286 
2287  return m_pShellBrowser->TranslateAcceleratorSB(lpmsg, 0);
2288 }
2289 
2291 {
2292  FIXME("(%p) stub\n", this);
2293 
2294  return E_NOTIMPL;
2295 }
2296 
2298 {
2299  // CHAR szName[MAX_PATH];
2300  LRESULT lResult;
2301  int nPartArray[1] = { -1};
2302 
2303  TRACE("(%p)->(state=%x) stub\n", this, uState);
2304 
2305  /* don't do anything if the state isn't really changing */
2306  if (m_uState == uState)
2307  {
2308  return S_OK;
2309  }
2310 
2311  /* OnActivate handles the menu merging and internal state */
2312  DoActivate(uState);
2313 
2314  /* only do This if we are active */
2315  if (uState != SVUIA_DEACTIVATE)
2316  {
2317 
2318  /*
2319  GetFolderPath is not a method of IShellFolder
2320  IShellFolder_GetFolderPath( m_pSFParent, szName, sizeof(szName) );
2321  */
2322  /* set the number of parts */
2323  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult);
2324 
2325  /* set the text for the parts */
2326  /*
2327  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETTEXTA, 0, (LPARAM)szName, &lResult);
2328  */
2329  }
2330 
2331  return S_OK;
2332 }
2333 
2335 {
2336  TRACE("(%p)\n", this);
2337 
2339  FillList();
2340 
2341  return S_OK;
2342 }
2343 
2345 {
2346  return CreateViewWindow3(psb, lpPrevView, SV3CVW3_DEFAULT,
2347  (FOLDERFLAGS)lpfs->fFlags, (FOLDERFLAGS)lpfs->fFlags, (FOLDERVIEWMODE)lpfs->ViewMode, NULL, prcView, phWnd);
2348 }
2349 
2351 {
2352  TRACE("(%p)\n", this);
2353 
2354  /* Make absolutely sure all our UI is cleaned up */
2356 
2357  if (m_hAccel)
2358  {
2359  // "Accelerator tables loaded from resources are freed automatically when the application terminates." -- MSDN
2360  m_hAccel = NULL;
2361  }
2362 
2363  if (m_hMenuArrangeModes)
2364  {
2367  }
2368 
2369  if (m_hMenuViewModes)
2370  {
2373  }
2374 
2375  if (m_hMenu)
2376  {
2378  m_hMenu = NULL;
2379  }
2380 
2381  if (m_ListView)
2382  {
2383  m_ListView.DestroyWindow();
2384  }
2385 
2386  if (m_hWnd)
2387  {
2388  DestroyWindow();
2389  }
2390 
2393 
2394  return S_OK;
2395 }
2396 
2398 {
2399  TRACE("(%p)->(%p) vmode=%x flags=%x\n", this, lpfs,
2401 
2402  if (!lpfs)
2403  return E_INVALIDARG;
2404 
2405  *lpfs = m_FolderSettings;
2406  return S_OK;
2407 }
2408 
2410 {
2411  FIXME("(%p) stub\n", this);
2412 
2413  return E_NOTIMPL;
2414 }
2415 
2417 {
2418  FIXME("(%p) stub\n", this);
2419 
2420  return S_OK;
2421 }
2422 
2424 {
2425  int i;
2426 
2427  TRACE("(%p)->(pidl=%p, 0x%08x) stub\n", this, pidl, uFlags);
2428 
2429  i = LV_FindItemByPidl(pidl);
2430  if (i == -1)
2431  return S_OK;
2432 
2433  LVITEMW lvItem = {0};
2434  lvItem.mask = LVIF_STATE;
2436 
2437  while (m_ListView.GetItem(&lvItem))
2438  {
2439  if (lvItem.iItem == i)
2440  {
2441  if (uFlags & SVSI_SELECT)
2442  lvItem.state |= LVIS_SELECTED;
2443  else
2444  lvItem.state &= ~LVIS_SELECTED;
2445 
2446  if (uFlags & SVSI_FOCUSED)
2447  lvItem.state |= LVIS_FOCUSED;
2448  else
2449  lvItem.state &= ~LVIS_FOCUSED;
2450  }
2451  else
2452  {
2453  if (uFlags & SVSI_DESELECTOTHERS)
2454  {
2455  lvItem.state &= ~LVIS_SELECTED;
2456  }
2457  lvItem.state &= ~LVIS_FOCUSED;
2458  }
2459 
2460  m_ListView.SetItem(&lvItem);
2461  lvItem.iItem++;
2462  }
2463 
2464  if (uFlags & SVSI_ENSUREVISIBLE)
2466 
2467  if((uFlags & SVSI_EDIT) == SVSI_EDIT)
2469 
2470  return S_OK;
2471 }
2472 
2474 {
2476 
2477  TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n", this, uItem, debugstr_guid(&riid), ppvOut);
2478 
2479  if (!ppvOut)
2480  return E_INVALIDARG;
2481 
2482  *ppvOut = NULL;
2483 
2484  switch (uItem)
2485  {
2486  case SVGIO_BACKGROUND:
2487  if (IsEqualIID(riid, IID_IContextMenu))
2488  {
2490  if (FAILED_UNEXPECTEDLY(hr))
2491  return hr;
2492 
2493  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2494  }
2495  else if (IsEqualIID(riid, IID_IDispatch))
2496  {
2498  {
2500  if (FAILED_UNEXPECTEDLY(hr))
2501  return hr;
2502  }
2503  hr = m_pShellFolderViewDual->QueryInterface(riid, ppvOut);
2504  }
2505  break;
2506 
2507  case SVGIO_SELECTION:
2508  GetSelections();
2509  hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0, ppvOut);
2510  if (FAILED_UNEXPECTEDLY(hr))
2511  return hr;
2512 
2513  if (IsEqualIID(riid, IID_IContextMenu))
2514  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2515 
2516  break;
2517  }
2518 
2519  TRACE("-- (%p)->(interface=%p)\n", this, *ppvOut);
2520 
2521  return hr;
2522 }
2523 
2525 {
2526  TRACE("(%p)->(%p), stub\n", this, pViewMode);
2527 
2528  if (!pViewMode)
2529  return E_INVALIDARG;
2530 
2531  *pViewMode = m_FolderSettings.ViewMode;
2532  return S_OK;
2533 }
2534 
2536 {
2537  DWORD dwStyle;
2538  TRACE("(%p)->(%u), stub\n", this, ViewMode);
2539 
2540  /* It's not redundant to check FVM_AUTO because it's a (UINT)-1 */
2541  if (((INT)ViewMode < FVM_FIRST || (INT)ViewMode > FVM_LAST) && ((INT)ViewMode != FVM_AUTO))
2542  return E_INVALIDARG;
2543 
2544  /* Windows before Vista uses LVM_SETVIEW and possibly
2545  LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2546  while later versions seem to accomplish this through other
2547  means. */
2548  switch (ViewMode)
2549  {
2550  case FVM_ICON:
2551  dwStyle = LVS_ICON;
2552  break;
2553  case FVM_DETAILS:
2554  dwStyle = LVS_REPORT;
2555  break;
2556  case FVM_SMALLICON:
2557  dwStyle = LVS_SMALLICON;
2558  break;
2559  case FVM_LIST:
2560  dwStyle = LVS_LIST;
2561  break;
2562  default:
2563  {
2564  FIXME("ViewMode %d not implemented\n", ViewMode);
2565  dwStyle = LVS_LIST;
2566  break;
2567  }
2568  }
2569 
2570  m_ListView.ModifyStyle(LVS_TYPEMASK, dwStyle);
2571 
2572  /* This will not necessarily be the actual mode set above.
2573  This mimics the behavior of Windows XP. */
2574  m_FolderSettings.ViewMode = ViewMode;
2575 
2576  return S_OK;
2577 }
2578 
2580 {
2581  if (m_pSFParent == NULL)
2582  return E_FAIL;
2583 
2584  return m_pSFParent->QueryInterface(riid, ppv);
2585 }
2586 
2588 {
2589  PCUITEMID_CHILD pidl = _PidlByItem(iItemIndex);
2590  if (pidl)
2591  {
2592  *ppidl = ILClone(pidl);
2593  return S_OK;
2594  }
2595 
2596  *ppidl = 0;
2597  return E_INVALIDARG;
2598 }
2599 
2601 {
2602  TRACE("(%p)->(%u %p)\n", this, uFlags, pcItems);
2603 
2604  if (uFlags != SVGIO_ALLVIEW)
2605  FIXME("some flags unsupported, %x\n", uFlags & ~SVGIO_ALLVIEW);
2606 
2608 
2609  return S_OK;
2610 }
2611 
2613 {
2614  return E_NOTIMPL;
2615 }
2616 
2618 {
2619  TRACE("(%p)->(%p)\n", this, piItem);
2620 
2621  *piItem = m_ListView.GetSelectionMark();
2622 
2623  return S_OK;
2624 }
2625 
2627 {
2628  TRACE("(%p)->(%p)\n", this, piItem);
2629 
2630  *piItem = m_ListView.GetNextItem(-1, LVNI_FOCUSED);
2631 
2632  return S_OK;
2633 }
2634 
2636 {
2637  int lvIndex = LV_FindItemByPidl(pidl);
2638  if (lvIndex == -1 || ppt == NULL)
2639  return E_INVALIDARG;
2640 
2641  m_ListView.GetItemPosition(lvIndex, ppt);
2642  return S_OK;
2643 }
2644 
2646 {
2647  TRACE("(%p)->(%p)\n", this, ppt);
2648 
2649  if (!m_ListView)
2650  return S_FALSE;
2651 
2652  if (ppt)
2653  {
2654  SIZE spacing;
2655  m_ListView.GetItemSpacing(spacing);
2656 
2657  ppt->x = spacing.cx;
2658  ppt->y = spacing.cy;
2659  }
2660 
2661  return S_OK;
2662 }
2663 
2665 {
2666  return E_NOTIMPL;
2667 }
2668 
2670 {
2671  return ((m_ListView.GetStyle() & LVS_AUTOARRANGE) ? S_OK : S_FALSE);
2672 }
2673 
2675 {
2676  LVITEMW lvItem;
2677 
2678  TRACE("(%p)->(%d, %x)\n", this, iItem, dwFlags);
2679 
2680  lvItem.state = 0;
2681  lvItem.stateMask = LVIS_SELECTED;
2682 
2683  if (dwFlags & SVSI_ENSUREVISIBLE)
2684  m_ListView.EnsureVisible(iItem, 0);
2685 
2686  /* all items */
2687  if (dwFlags & SVSI_DESELECTOTHERS)
2689 
2690  /* this item */
2691  if (dwFlags & SVSI_SELECT)
2692  lvItem.state |= LVIS_SELECTED;
2693 
2694  if (dwFlags & SVSI_FOCUSED)
2695  lvItem.stateMask |= LVIS_FOCUSED;
2696 
2697  m_ListView.SetItemState(iItem, lvItem.state, lvItem.stateMask);
2698 
2699  if ((dwFlags & SVSI_EDIT) == SVSI_EDIT)
2700  m_ListView.EditLabel(iItem);
2701 
2702  return S_OK;
2703 }
2704 
2706 {
2707  /* Reset the selection */
2709 
2710  int lvIndex;
2711  for (UINT i = 0 ; i < m_cidl; i++)
2712  {
2713  lvIndex = LV_FindItemByPidl(apidl[i]);
2714  if (lvIndex != -1)
2715  {
2716  SelectItem(lvIndex, dwFlags);
2717  m_ListView.SetItemPosition(lvIndex, &apt[i]);
2718  }
2719  }
2720 
2721  return S_OK;
2722 }
2723 
2724 /**********************************************************
2725  * IShellView2 implementation
2726  */
2727 
2729 {
2730  FIXME("(%p)->(%p, %lu) stub\n", this, view_guid, view_type);
2731  return E_NOTIMPL;
2732 }
2733 
2735 {
2736  return CreateViewWindow3(view_params->psbOwner, view_params->psvPrev,
2737  SV3CVW3_DEFAULT, (FOLDERFLAGS)view_params->pfs->fFlags, (FOLDERFLAGS)view_params->pfs->fFlags,
2738  (FOLDERVIEWMODE)view_params->pfs->ViewMode, view_params->pvid, view_params->prcView, &view_params->hwndView);
2739 }
2740 
2742 {
2743  OLEMENUGROUPWIDTHS omw = { { 0, 0, 0, 0, 0, 0 } };
2744 
2745  *hwnd = NULL;
2746 
2747  TRACE("(%p)->(shlview=%p shlbrs=%p rec=%p hwnd=%p vmode=%x flags=%x)\n", this, psvPrevious, psb, prcView, hwnd, mode, flags);
2748  if (prcView != NULL)
2749  TRACE("-- left=%i top=%i right=%i bottom=%i\n", prcView->left, prcView->top, prcView->right, prcView->bottom);
2750 
2751  /* Validate the Shell Browser */
2752  if (psb == NULL || m_hWnd)
2753  return E_UNEXPECTED;
2754 
2755  if (view_flags != SV3CVW3_DEFAULT)
2756  FIXME("unsupported view flags 0x%08x\n", view_flags);
2757 
2758  /* Set up the member variables */
2759  m_pShellBrowser = psb;
2762 
2763  if (view_id)
2764  {
2765  if (IsEqualIID(*view_id, VID_LargeIcons))
2767  else if (IsEqualIID(*view_id, VID_SmallIcons))
2769  else if (IsEqualIID(*view_id, VID_List))
2771  else if (IsEqualIID(*view_id, VID_Details))
2773  else if (IsEqualIID(*view_id, VID_Thumbnails))
2775  else if (IsEqualIID(*view_id, VID_Tile))
2777  else if (IsEqualIID(*view_id, VID_ThumbStrip))
2779  else
2780  FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id));
2781  }
2782 
2783  /* Get our parent window */
2784  m_pShellBrowser->GetWindow(&m_hWndParent);
2785 
2786  /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2789  {
2790  TRACE("-- CommDlgBrowser\n");
2791  }
2792 
2794  if (m_hWnd == NULL)
2795  return E_FAIL;
2796 
2797  *hwnd = m_hWnd;
2798 
2799  CheckToolbar();
2800 
2801  if (!*hwnd)
2802  return E_FAIL;
2803 
2805 
2807  UpdateWindow();
2808 
2809  if (!m_hMenu)
2810  {
2811  m_hMenu = CreateMenu();
2812  m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);
2813  TRACE("-- after fnInsertMenusSB\n");
2814  }
2815 
2816  _MergeToolbar();
2817 
2818  return S_OK;
2819 }
2820 
2822 {
2823  FIXME("(%p)->(%p) stub\n", this, new_pidl);
2824  return E_NOTIMPL;
2825 }
2826 
2828 {
2829  FIXME("(%p)->(%p, %u, %p) stub\n", this, item, flags, point);
2830  return E_NOTIMPL;
2831 }
2832 
2833 /**********************************************************
2834  * IShellFolderView implementation
2835  */
2837 {
2838  FIXME("(%p)->(%ld) stub\n", this, sort);
2839  return E_NOTIMPL;
2840 }
2841 
2843 {
2844  FIXME("(%p)->(%p) stub\n", this, sort);
2845  return E_NOTIMPL;
2846 }
2847 
2849 {
2850  FIXME("(%p) stub\n", this);
2851  return E_NOTIMPL;
2852 }
2853 
2855 {
2856  m_ListView.ModifyStyle(0, LVS_AUTOARRANGE);
2858  return S_OK;
2859 }
2860 
2862 {
2863  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2864  *item = LV_AddItem(pidl);
2865  return (int)*item >= 0 ? S_OK : E_OUTOFMEMORY;
2866 }
2867 
2869 {
2870  TRACE("(%p)->(%p %d)\n", this, pidl, item);
2871  return Item(item, pidl);
2872 }
2873 
2875 {
2876 
2877  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2878 
2879  if (pidl)
2880  {
2883  }
2884  else
2885  {
2886  *item = 0;
2888  }
2889 
2890  return S_OK;
2891 }
2892 
2894 {
2895  TRACE("(%p)->(%p)\n", this, count);
2897  return S_OK;
2898 }
2899 
2901 {
2902  FIXME("(%p)->(%d %x) stub\n", this, count, flags);
2903  return E_NOTIMPL;
2904 }
2905 
2907 {
2908  FIXME("(%p)->(%p %p %p) stub\n", this, pidl_old, pidl_new, item);
2909  return E_NOTIMPL;
2910 }
2911 
2913 {
2914  FIXME("(%p)->(%p %p) stub\n", this, pidl, item);
2915  return E_NOTIMPL;
2916 }
2917 
2919 {
2920  TRACE("(%p)->(%d)\n", this, redraw);
2922  return S_OK;
2923 }
2924 
2926 {
2927  FIXME("(%p)->(%p) stub\n", this, count);
2928  return E_NOTIMPL;
2929 }
2930 
2932 {
2933  TRACE("(%p)->(%p %p)\n", this, pidl, items);
2934 
2935  *items = GetSelections();
2936 
2937  if (*items)
2938  {
2939  *pidl = static_cast<PCUITEMID_CHILD *>(LocalAlloc(0, *items * sizeof(PCUITEMID_CHILD)));
2940  if (!*pidl)
2941  {
2942  return E_OUTOFMEMORY;
2943  }
2944 
2945  /* it's documented that caller shouldn't PIDLs, only array itself */
2946  memcpy(*pidl, m_apidl, *items * sizeof(PCUITEMID_CHILD));
2947  }
2948 
2949  return S_OK;
2950 }
2951 
2953 {
2954  if ((m_iDragOverItem == -1 || m_pCurDropTarget == NULL) &&
2956  {
2957  return S_OK;
2958  }
2959 
2960  return S_FALSE;
2961 }
2962 
2964 {
2965  if (!pt)
2966  return E_INVALIDARG;
2967 
2968  *pt = m_ptFirstMousePos;
2969  return S_OK;
2970 }
2971 
2973 {
2974  FIXME("(%p)->(%p) stub\n", this, pt);
2975  return E_NOTIMPL;
2976 }
2977 
2979 {
2980  TRACE("(%p)->(%p)\n", this, obj);
2981  return E_NOTIMPL;
2982 }
2983 
2985 {
2986  FIXME("(%p)->(%p %p) stub\n", this, pidl, pt);
2987  return E_NOTIMPL;
2988 }
2989 
2991 {
2992  FIXME("(%p)->(%p) stub\n", this, drop_target);
2993  return E_NOTIMPL;
2994 }
2995 
2997 {
2998  FIXME("(%p)->(%d) stub\n", this, move);
2999  return E_NOTIMPL;
3000 }
3001 
3003 {
3004  FIXME("(%p)->(%p) stub\n", this, obj);
3005  return E_NOTIMPL;
3006 }
3007 
3009 {
3010  FIXME("(%p)->(%p) stub\n", this, spacing);
3011  return E_NOTIMPL;
3012 }
3013 
3014 HRESULT STDMETHODCALLTYPE CDefView::SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb)
3015 {
3016  if (old_cb)
3017  *old_cb = m_pShellFolderViewCB.Detach();
3018 
3019  m_pShellFolderViewCB = new_cb;
3020  return S_OK;
3021 }
3022 
3024 {
3025  FIXME("(%p)->(%d) stub\n", this, flags);
3026  return E_NOTIMPL;
3027 }
3028 
3030 {
3031  TRACE("(%p)->(%p)\n", this, support);
3032  return S_OK;
3033 }
3034 
3036 {
3037  FIXME("(%p)->(%p) stub\n", this, disp);
3038  return E_NOTIMPL;
3039 }
3040 
3041 /**********************************************************
3042  * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
3043  */
3044 HRESULT WINAPI CDefView::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
3045 {
3046  FIXME("(%p)->(%p(%s) 0x%08x %p %p\n",
3047  this, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
3048 
3049  if (!prgCmds)
3050  return E_INVALIDARG;
3051 
3052  for (UINT i = 0; i < cCmds; i++)
3053  {
3054  FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
3055  prgCmds[i].cmdf = 0;
3056  }
3057 
3058  return OLECMDERR_E_UNKNOWNGROUP;
3059 }
3060 
3061 /**********************************************************
3062  * ISVOleCmdTarget_Exec (IOleCommandTarget)
3063  *
3064  * nCmdID is the OLECMDID_* enumeration
3065  */
3066 HRESULT WINAPI CDefView::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
3067 {
3068  FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
3069  this, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
3070 
3071  if (!pguidCmdGroup)
3072  return OLECMDERR_E_UNKNOWNGROUP;
3073 
3074  if (IsEqualCLSID(*pguidCmdGroup, m_Category))
3075  {
3076  if (nCmdID == FCIDM_SHVIEW_AUTOARRANGE)
3077  {
3078  if (V_VT(pvaIn) != VT_INT_PTR)
3079  return OLECMDERR_E_NOTSUPPORTED;
3080 
3081  TPMPARAMS params;
3082  params.cbSize = sizeof(params);
3083  params.rcExclude = *(RECT*) V_INTREF(pvaIn);
3084 
3085  if (m_hMenuViewModes)
3086  {
3087  /* Duplicate all but the last two items of the view modes menu */
3088  HMENU hmenuViewPopup = CreatePopupMenu();
3089  Shell_MergeMenus(hmenuViewPopup, m_hMenuViewModes, 0, 0, 0xFFFF, 0);
3090  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3091  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3092  CheckViewMode(hmenuViewPopup);
3093  TrackPopupMenuEx(hmenuViewPopup, TPM_LEFTALIGN | TPM_TOPALIGN, params.rcExclude.left, params.rcExclude.bottom, m_hWndParent, &params);
3094  ::DestroyMenu(hmenuViewPopup);
3095  }
3096 
3097  // pvaOut is VT_I4 with value 0x403 (cmd id of the new mode maybe?)
3098  V_VT(pvaOut) = VT_I4;
3099  V_I4(pvaOut) = 0x403;
3100  }
3101  }
3102 
3103  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer) &&
3104  (nCmdID == 0x29) &&
3105  (nCmdexecopt == 4) && pvaOut)
3106  return S_OK;
3107 
3108  if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView) &&
3109  (nCmdID == 9) &&
3110  (nCmdexecopt == 0))
3111  return 1;
3112 
3113  return OLECMDERR_E_UNKNOWNGROUP;
3114 }
3115 
3116 /**********************************************************
3117  * ISVDropTarget implementation
3118  */
3119 
3120 /******************************************************************************
3121  * drag_notify_subitem [Internal]
3122  *
3123  * Figure out the shellfolder object, which is currently under the mouse cursor
3124  * and notify it via the IDropTarget interface.
3125  */
3126 
3127 #define SCROLLAREAWIDTH 20
3128 
3130 {
3131  LONG lResult;
3132  HRESULT hr;
3133  RECT clientRect;
3134 
3135  /* The key state on drop doesn't have MK_LBUTTON or MK_RBUTTON because it
3136  reflects the key state after the user released the button, so we need
3137  to remember the last key state when the button was pressed */
3138  m_grfKeyState = grfKeyState;
3139 
3140  /* Map from global to client coordinates and query the index of the listview-item, which is
3141  * currently under the mouse cursor. */
3142  LVHITTESTINFO htinfo = {{pt.x, pt.y}, LVHT_ONITEM};
3143  ScreenToClient(&htinfo.pt);
3144  lResult = m_ListView.HitTest(&htinfo);
3145 
3146  /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
3147  ::GetClientRect(m_ListView, &clientRect);
3148  if (htinfo.pt.x == m_ptLastMousePos.x && htinfo.pt.y == m_ptLastMousePos.y &&
3149  (htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
3150  htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
3151  {
3152  m_cScrollDelay = (m_cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
3153  if (m_cScrollDelay == 0)
3154  {
3155  /* Mouse did hover another 250 ms over the scroll-area */
3156  if (htinfo.pt.x < SCROLLAREAWIDTH)
3157  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEUP, 0);
3158 
3159  if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
3160  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEDOWN, 0);
3161 
3162  if (htinfo.pt.y < SCROLLAREAWIDTH)
3163  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEUP, 0);
3164 
3165  if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
3166  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEDOWN, 0);
3167  }
3168  }
3169  else
3170  {
3171  m_cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
3172  }
3173 
3174  m_ptLastMousePos = htinfo.pt;
3175 
3176  /* We need to check if we drag the selection over itself */
3177  if (lResult != -1 && m_pSourceDataObject.p != NULL)
3178  {
3179  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3180 
3181  for (UINT i = 0; i < m_cidl; i++)
3182  {
3183  if (pidl == m_apidl[i])
3184  {
3185  /* The item that is being draged is hovering itself. */
3186  lResult = -1;
3187  break;
3188  }
3189  }
3190  }
3191 
3192  /* If we are still over the previous sub-item, notify it via DragOver and return. */
3193  if (m_pCurDropTarget && lResult == m_iDragOverItem)
3194  return m_pCurDropTarget->DragOver(grfKeyState, pt, pdwEffect);
3195 
3196  /* We've left the previous sub-item, notify it via DragLeave and Release it. */
3197  if (m_pCurDropTarget)
3198  {
3200  if (pidl)
3201  SelectItem(pidl, 0);
3202 
3203  m_pCurDropTarget->DragLeave();
3205  }
3206 
3207  m_iDragOverItem = lResult;
3208 
3209  if (lResult == -1)
3210  {
3211  /* We are not above one of the listview's subitems. Bind to the parent folder's
3212  * DropTarget interface. */
3213  hr = m_pSFParent->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget,&m_pCurDropTarget));
3214  }
3215  else
3216  {
3217  /* Query the relative PIDL of the shellfolder object represented by the currently
3218  * dragged over listview-item ... */
3219  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3220 
3221  /* ... and bind m_pCurDropTarget to the IDropTarget interface of an UIObject of this object */
3222  hr = m_pSFParent->GetUIObjectOf(m_ListView, 1, &pidl, IID_NULL_PPV_ARG(IDropTarget, &m_pCurDropTarget));
3223  }
3224 
3226 
3227  /* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
3228  if (FAILED(hr))
3229  {
3230  *pdwEffect = DROPEFFECT_NONE;
3231  return hr;
3232  }
3233 
3234  if (m_iDragOverItem != -1)
3235  {
3236  SelectItem(m_iDragOverItem, SVSI_SELECT);
3237  }
3238 
3239  /* Notify the item just entered via DragEnter. */
3240  return m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
3241 }
3242 
3243 HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3244 {
3245  if (*pdwEffect == DROPEFFECT_NONE)
3246  return S_OK;
3247 
3248  /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
3249  m_pCurDataObject = pDataObject;
3250 
3251  HRESULT hr = drag_notify_subitem(grfKeyState, pt, pdwEffect);
3252  if (SUCCEEDED(hr))
3253  {
3254  POINT ptClient = {pt.x, pt.y};
3255  ScreenToClient(&ptClient);
3256  ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
3257  }
3258 
3259  return hr;
3260 }
3261 
3263 {
3264  POINT ptClient = {pt.x, pt.y};
3265  ScreenToClient(&ptClient);
3266  ImageList_DragMove(ptClient.x, ptClient.y);
3267  return drag_notify_subitem(grfKeyState, pt, pdwEffect);
3268 }
3269 
3271 {
3273 
3274  if (m_pCurDropTarget)
3275  {
3276  m_pCurDropTarget->DragLeave();
3278  }
3279 
3280  if (m_pCurDataObject != NULL)
3281  {
3283  }
3284 
3285  m_iDragOverItem = 0;
3286 
3287  return S_OK;
3288 }
3289 
3290 HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3291 {
3294 
3295  if ((IsDropOnSource(NULL) == S_OK) &&
3296  (*pdwEffect & DROPEFFECT_MOVE) &&
3298  {
3299  if (m_pCurDropTarget)
3300  {
3301  m_pCurDropTarget->DragLeave();
3303  }
3304 
3305  /* Restore the selection */
3307  for (UINT i = 0 ; i < m_cidl; i++)
3308  SelectItem(m_apidl[i], SVSI_SELECT);
3309 
3310  /* Reposition the items */
3311  int lvIndex = -1;
3312  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
3313  {
3314  POINT ptItem;
3315  if (m_ListView.GetItemPosition(lvIndex, &ptItem))
3316  {
3317  ptItem.x += pt.x - m_ptFirstMousePos.x;
3318  ptItem.y += pt.y - m_ptFirstMousePos.y;
3319  m_ListView.SetItemPosition(lvIndex, &ptItem);
3320  }
3321  }
3322  }
3323  else if (m_pCurDropTarget)
3324  {
3325  m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
3327  }
3328 
3330  m_iDragOverItem = 0;
3331  return S_OK;
3332 }
3333 
3334 /**********************************************************
3335  * ISVDropSource implementation
3336  */
3337 
3339 {
3340  TRACE("(%p)\n", this);
3341 
3342  if (fEscapePressed)
3343  return DRAGDROP_S_CANCEL;
3344  else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
3345  return DRAGDROP_S_DROP;
3346  else
3347  return S_OK;
3348 }
3349 
3351 {
3352  TRACE("(%p)\n", this);
3353 
3355 }
3356 
3357 /**********************************************************
3358  * ISVViewObject implementation
3359  */
3360 
3361 HRESULT WINAPI CDefView::Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
3362 {
3363  FIXME("Stub: this=%p\n", this);
3364 
3365  return E_NOTIMPL;
3366 }
3367 
3368 HRESULT WINAPI CDefView::GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDevice, LOGPALETTE **ppColorSet)
3369 {
3370  FIXME("Stub: this=%p\n", this);
3371 
3372  return E_NOTIMPL;
3373 }
3374 
3375 HRESULT WINAPI CDefView::Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
3376 {
3377  FIXME("Stub: this=%p\n", this);
3378 
3379  return E_NOTIMPL;
3380 }
3381 
3383 {
3384  FIXME("Stub: this=%p\n", this);
3385 
3386  return E_NOTIMPL;
3387 }
3388 
3390 {
3391  FIXME("partial stub: %p 0x%08x 0x%08x %p\n", this, aspects, advf, pAdvSink);
3392 
3393  /* FIXME: we set the AdviseSink, but never use it to send any advice */
3394  m_pAdvSink = pAdvSink;
3395  m_dwAspects = aspects;
3396  m_dwAdvf = advf;
3397 
3398  return S_OK;
3399 }
3400 
3401 HRESULT WINAPI CDefView::GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
3402 {
3403  TRACE("this=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n", this, pAspects, pAdvf, ppAdvSink);
3404 
3405  if (ppAdvSink)
3406  {
3407  *ppAdvSink = m_pAdvSink;
3408  m_pAdvSink.p->AddRef();
3409  }
3410 
3411  if (pAspects)
3412  *pAspects = m_dwAspects;
3413 
3414  if (pAdvf)
3415  *pAdvf = m_dwAdvf;
3416 
3417  return S_OK;
3418 }
3419 
3421 {
3422  if (IsEqualIID(guidService, SID_IShellBrowser))
3423  return m_pShellBrowser->QueryInterface(riid, ppvObject);
3424  else if(IsEqualIID(guidService, SID_IFolderView))
3425  return QueryInterface(riid, ppvObject);
3426 
3427  return E_NOINTERFACE;
3428 }
3429 
3431 {
3433  HRESULT hr = S_OK;
3434 
3435  hr = IUnknown_QueryService(m_pShellBrowser, IID_IExplorerToolbar, IID_PPV_ARG(IExplorerToolbar, &ptb));
3436  if (FAILED(hr))
3437  return hr;
3438 
3439  m_Category = CGID_DefViewFrame;
3440 
3441  hr = ptb->SetCommandTarget(static_cast<IOleCommandTarget*>(this), &m_Category, 0);
3442  if (FAILED(hr))
3443  return hr;
3444 
3445  if (hr == S_FALSE)
3446  return S_OK;
3447 
3448 #if 0
3449  hr = ptb->AddButtons(&m_Category, buttonsCount, buttons);
3450  if (FAILED(hr))
3451  return hr;
3452 #endif
3453 
3454  return S_OK;
3455 }
3456 
3457 // The default processing of IShellFolderView callbacks
3459 {
3460  // TODO: SFVM_GET_CUSTOMVIEWINFO, SFVM_WINDOWCREATED
3461  TRACE("CDefView::DefMessageSFVCB uMsg=%u\n", uMsg);
3462  return E_NOTIMPL;
3463 }
3464 
3466 {
3467  HRESULT hr = E_NOTIMPL;
3468 
3470  {
3471  hr = m_pShellFolderViewCB->MessageSFVCB(uMsg, wParam, lParam);
3472  }
3473 
3474  if (hr == E_NOTIMPL)
3475  {
3476  hr = DefMessageSFVCB(uMsg, wParam, lParam);
3477  }
3478 
3479  return hr;
3480 }
3481 
3483 {
3484  return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
3485 }
3486 
3488  LPCSFV psvcbi, /* [in] shelltemplate struct */
3489  IShellView **ppsv) /* [out] IShellView pointer */
3490 {
3491  CComPtr<IShellView> psv;
3492  HRESULT hRes;
3493 
3494  TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
3495  psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
3496  psvcbi->fvm, psvcbi->psvOuter);
3497 
3498  *ppsv = NULL;
3499  hRes = CDefView_CreateInstance(psvcbi->pshf, IID_PPV_ARG(IShellView, &psv));
3500  if (FAILED_UNEXPECTEDLY(hRes))
3501  return hRes;
3502 
3503  *ppsv = psv.Detach();
3504  return hRes;
3505 }
3506 
3508  IShellView **ppsv)
3509 {
3510  CComPtr<IShellView> psv;
3511  HRESULT hRes;
3512 
3513  if (!ppsv)
3514  return E_INVALIDARG;
3515 
3516  *ppsv = NULL;
3517 
3518  if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv))
3519  return E_INVALIDARG;
3520 
3521  TRACE("sf=%p outer=%p callback=%p\n",
3522  pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
3523 
3524  hRes = CDefView_CreateInstance(pcsfv->pshf, IID_PPV_ARG(IShellView, &psv));
3525  if (FAILED(hRes))
3526  return hRes;
3527 
3528  if (pcsfv->psfvcb)
3529  {
3531  if (SUCCEEDED(psv->QueryInterface(IID_PPV_ARG(IShellFolderView, &sfv))))
3532  {
3533  sfv->SetCallback(pcsfv->psfvcb, NULL);
3534  }
3535  }
3536 
3537  *ppsv = psv.Detach();
3538  return hRes;
3539 }
#define SHCNE_MKDIR
Definition: shlobj.h:1731
HRESULT FillViewMenu()
Definition: CDefView.cpp:1250
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HMENU m_hMenuArrangeModes
Definition: CDefView.cpp:83
HRESULT CDefView_CreateInstance(IShellFolder *pFolder, REFIID riid, LPVOID *ppvOut)
Definition: CDefView.cpp:3482
ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, int fSources, LONG wEventMask, UINT uMsg, int cItems, SHChangeNotifyEntry *lpItems)
Definition: changenotify.c:215
HRESULT FillEditMenu()
Definition: CDefView.cpp:1233
POINT m_ptFirstMousePos
Definition: CDefView.cpp:104
#define FCIDM_SHVIEW_UNDO
Definition: shresdef.h:754
virtual HRESULT STDMETHODCALLTYPE SetItemPos(PCUITEMID_CHILD pidl, POINT *pt)
Definition: CDefView.cpp:2984
int LV_FindItemByPidl(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:774
HRESULT FillArrangeAsMenu(HMENU hmenuArrange)
Definition: CDefView.cpp:1266
DWORD_PTR GetItemData(int i)
Definition: rosctrls.h:204
disp
Definition: i386-dis.c:3181
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define NM_KILLFOCUS
Definition: commctrl.h:136
HMENU WINAPI CreateMenu(void)
Definition: menu.c:837
virtual HRESULT STDMETHODCALLTYPE SetAdvise(DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
Definition: CDefView.cpp:3389
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
virtual HRESULT STDMETHODCALLTYPE DestroyViewWindow()
Definition: CDefView.cpp:2350
void WINAPI DPA_DestroyCallback(HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dpa.c:1003
BOOL GetScrollPos(int nBar)
Definition: atlwin.h:666
#define LVN_BEGINRDRAG
Definition: commctrl.h:3137
int iImage
Definition: commctrl.h:2363
#define FCIDM_SHVIEW_INVERTSELECTION
Definition: shresdef.h:759
int LV_AddItem(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:794
#define FCIDM_SHVIEW_LISTVIEW
Definition: shresdef.h:763
BOOL m_Destroyed
Definition: CDefView.cpp:112
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
WINE_DEFAULT_DEBUG_CHANNEL(shell)
HACCEL m_hAccel
Definition: CDefView.cpp:93
#define SHCNE_RMDIR
Definition: shlobj.h:1732
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:782
UINT m_cScrollDelay
Definition: CDefView.cpp:102
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3262
const GUID IID_IViewObject
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:958
virtual HRESULT STDMETHODCALLTYPE GetAutoArrange()
Definition: CDefView.cpp:2669
virtual HRESULT STDMETHODCALLTYPE Refresh()
Definition: CDefView.cpp:2334
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
Definition: compat.h:1947
#define LVN_BEGINDRAG
Definition: commctrl.h:3136
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define MF_BYCOMMAND
Definition: winuser.h:202
HRESULT WINAPI CDefViewDual_Constructor(REFIID riid, LPVOID *ppvOut)
HRESULT WINAPI SHLimitInputEdit(HWND hWnd, IShellFolder *psf)
Definition: shellord.c:2680
#define LVSIL_SMALL
Definition: commctrl.h:2295
virtual HRESULT STDMETHODCALLTYPE Select(UINT flags)
Definition: CDefView.cpp:3023
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CDefView.cpp:3420
long y
Definition: polytest.cpp:48
#define FCIDM_SHVIEW_SNAPTOGRID
Definition: shresdef.h:767
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2538
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
#define WM_CONTEXTMENU
Definition: richedit.h:64
HRESULT OpenSelectedItems()
Definition: CDefView.cpp:1371
LRESULT OnPrintClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1071
#define FCIDM_SHVIEW_AUTOARRANGE
Definition: shresdef.h:766
#define IDS_OBJECTS_SELECTED
Definition: shresdef.h:259
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
GLint x0
Definition: linetemp.h:95
static HMENU hmenu
Definition: win.c:66
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1284
Definition: scsiwmi.h:51
#define NOERROR
Definition: winerror.h:2354
HRESULT WINAPI Initialize(IShellFolder *shellFolder)
Definition: CDefView.cpp:413
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
static const WCHAR SV_CLASS_NAME[]
Definition: CDefView.cpp:45
#define MK_LBUTTON
Definition: winuser.h:2342
long x
Definition: polytest.cpp:48
BOOL m_isEditing
Definition: CDefView.cpp:109
#define LVIR_ICON
Definition: commctrl.h:2469
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2035
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2263
virtual HRESULT STDMETHODCALLTYPE CreateViewWindow2(LPSV2CVW2_PARAMS view_params)
Definition: CDefView.cpp:2734
int GetSelectionMark()
Definition: rosctrls.h:156
#define SB_VERT
Definition: winuser.h:553
FOLDERSETTINGS m_FolderSettings
Definition: CDefView.cpp:81
LPFNVIEWCALLBACK pfnCallback
Definition: shlobj.h:1207
#define FCIDM_MENU_VIEW_SEP_OPTIONS
Definition: shlobj.h:559
#define KEY_READ
Definition: nt_native.h:1023
virtual HRESULT STDMETHODCALLTYPE MoveIcons(IDataObject *obj)
Definition: CDefView.cpp:2978
struct LISTVIEW_SORT_INFO * LPLISTVIEW_SORT_INFO
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1641
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2352
#define GET_WM_COMMAND_ID(wp, lp)
Definition: CDefView.cpp:359
virtual HRESULT STDMETHODCALLTYPE GetSelectedCount(UINT *count)
Definition: CDefView.cpp:2925
#define WM_INITMENUPOPUP
Definition: winuser.h:1728
REFIID riid
Definition: precomp.h:44
#define SPI_SETDESKWALLPAPER
Definition: winuser.h:1351
static BOOL ILIsParentOrSpecialParent(PCIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
Definition: CDefView.cpp:2078
#define LVS_REPORT
Definition: commctrl.h:2258
virtual WNDPROC GetWindowProc()
Definition: CDefView.cpp:292
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1637
#define LVN_GETDISPINFOA
Definition: commctrl.h:3149
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define TPM_RETURNCMD
Definition: winuser.h:2362
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition: _algo.c:993
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLint dy
Definition: linetemp.h:97
virtual HRESULT STDMETHODCALLTYPE GetView(SHELLVIEWID *view_guid, ULONG view_type)
Definition: CDefView.cpp:2728
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
PCUITEMID_CHILD _PidlByItem(int i)
Definition: CDefView.cpp:761
#define SB_HORZ
Definition: winuser.h:552
#define U(x)
Definition: wordpad.c:45
Definition: shlobj.h:1200
LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1007
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
BOOL WINAPI ImageList_DragMove(INT x, INT y)
Definition: imagelist.c:1070
void SetRedraw(BOOL redraw)
Definition: rosctrls.h:27
#define FCIDM_SHVIEW_OPEN
Definition: shresdef.h:777
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1745
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
IShellBrowser * psbOwner
Definition: shobjidl.idl:789
static HDC
Definition: imagelist.c:92
CComPtr< ICommDlgBrowser > m_pCommDlgBrowser
Definition: CDefView.cpp:77
#define CALLBACK
Definition: compat.h:27
#define SHCNE_INTERRUPT
Definition: shlobj.h:1753
#define MF_STRING
Definition: winuser.h:138
#define CLR_INVALID
Definition: wingdi.h:882
#define GetRValue(rgb)
Definition: wingdi.h:2934
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT FillList()
Definition: CDefView.cpp:904
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1220
LONG top
Definition: windef.h:307
static INT CALLBACK ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
Definition: CDefView.cpp:711
#define LVN_GETDISPINFOW
Definition: commctrl.h:3150
HANDLE HWND
Definition: compat.h:13
IShellView * psvOuter
Definition: shlobj.h:1283
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt)
Definition: CDefView.cpp:2664
int GetNextItem(int i, WORD flags)
Definition: rosctrls.h:161
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define WM_SHOWWINDOW
Definition: winuser.h:1610
virtual HRESULT STDMETHODCALLTYPE SetCurrentViewMode(UINT ViewMode)
Definition: CDefView.cpp:2535
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define LVIS_CUT
Definition: commctrl.h:2316
#define HWND_TOP
Definition: winuser.h:1193
CComPtr< IShellFolderViewDual > m_pShellFolderViewDual
Definition: CDefView.cpp:78
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define HDF_SORTUP
Definition: commctrl.h:720
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:507
WPARAM wParam
Definition: winuser.h:3091
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1674
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define COLOR_DESKTOP
Definition: winuser.h:904
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
#define LVHT_ONITEM
Definition: commctrl.h:2493
virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, PITEMID_CHILD *ppidl)
Definition: CDefView.cpp:2587
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
BOOL EnsureVisible(int i, BOOL fPartialOK)
Definition: rosctrls.h:146
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
view_type
HRESULT FillFileMenu()
Definition: CDefView.cpp:1196
#define WS_CHILD
Definition: pedump.c:617
HMENU m_hMenu
Definition: CDefView.cpp:82
virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort)
Definition: CDefView.cpp:2836
LONG left
Definition: windef.h:306
virtual HRESULT STDMETHODCALLTYPE GetSpacing(POINT *ppt)
Definition: CDefView.cpp:2645
virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv)
Definition: CDefView.cpp:2473
UINT uFlags
Definition: api.c:59
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2415
int GetItemCount()
Definition: rosctrls.h:121
#define WS_CLIPCHILDREN
Definition: pedump.c:619
virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem)
Definition: CDefView.cpp:2626
virtual HRESULT STDMETHODCALLTYPE RemoveObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2874
#define SID_IFolderView
virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable)
Definition: CDefView.cpp:2290
LONG right
Definition: windef.h:308
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1728
#define HDITEM
Definition: commctrl.h:693
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3507
VOID WINAPI ImageList_EndDrag(void)
Definition: imagelist.c:1847
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define WM_NCCREATE
Definition: winuser.h:1665
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: rosctrls.h:8
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:405
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:57
#define FCIDM_SHVIEW_PROPERTIES
Definition: shresdef.h:750
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(MSG *pmsg)
Definition: CDefView.cpp:2274
DWORD WINAPI GetSysColor(_In_ int)
POINTL point
Definition: edittest.c:50
WPARAM wParam
Definition: combotst.c:138
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2266
#define SFVM_GET_CUSTOMVIEWINFO
#define FCIDM_MENU_EDIT
Definition: shlobj.h:557
UINT stateMask
Definition: commctrl.h:2360
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
DWORD dwAttributes
Definition: vdmdbg.h:34
virtual HRESULT STDMETHODCALLTYPE GetObject(PITEMID_CHILD *pidl, UINT item)
Definition: CDefView.cpp:2868
struct tagNMHDR * LPNMHDR
#define SFVM_SIZE
Definition: shlobj.h:1263
#define WM_SETTINGCHANGE
Definition: winuser.h:1611
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define V_I4(A)
Definition: oleauto.h:247
virtual HRESULT STDMETHODCALLTYPE DragLeave()
Definition: CDefView.cpp:3270
CComPtr< IShellFolder2 > m_pSF2Parent
Definition: CDefView.cpp:74
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3290
BOOL SetTextColor(COLORREF cr)
Definition: rosctrls.h:42
DWORD SetExtendedListViewStyle(DWORD dw, DWORD dwMask=0)
Definition: rosctrls.h:47
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
#define FCIDM_SHVIEW_INSERTLINK
Definition: shresdef.h:755
SHELLVIEWID const * pvid
Definition: shobjidl.idl:791
UINT code
Definition: winuser.h:3134
virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState)
Definition: CDefView.cpp:2297
#define GetGValue(rgb)
Definition: wingdi.h:2935
#define FCIDM_SHVIEW_REFRESH
Definition: shresdef.h:775
#define FCIDM_BROWSERLAST
Definition: shlobj.h:549
IShellView * psvOuter
Definition: shlobj.h:1204
WORD unused[29]
Definition: crypt.c:1155
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
HRESULT WINAPI SHForwardContextMenuMsg(IUnknown *pUnk, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult, BOOL useIContextMenu2)
Definition: rosordinal.c:11
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MIIM_SUBMENU
Definition: winuser.h:718
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1810
#define FCIDM_SHVIEW_ARRANGE
Definition: shresdef.h:747
BOOL WINAPI ImageList_DragEnter(HWND hwndLock, INT x, INT y)
Definition: imagelist.c:958
#define WM_KEYFIRST
Definition: winuser.h:1696
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
GLenum GLint GLuint mask
Definition: glext.h:6028
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
CComPtr< IShellFolderViewCB > m_pShellFolderViewCB
Definition: CDefView.cpp:75
BOOL DeleteAllItems()
Definition: rosctrls.h:126
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BOOL CreateList()
Definition: CDefView.cpp:521
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define SHV_CHANGE_NOTIFY
Definition: CDefView.cpp:54
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
GLenum const GLfloat * params
Definition: glext.h:5645
SFVM_CUSTOMVIEWINFO_DATA m_viewinfo_data
Definition: CDefView.cpp:113
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
virtual HRESULT STDMETHODCALLTYPE HandleRename(LPCITEMIDLIST new_pidl)
Definition: CDefView.cpp:2821
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1752
long LONG
Definition: pedump.c:60
CComPtr< IDataObject > m_pCurDataObject
Definition: CDefView.cpp:100
#define LVN_ITEMACTIVATE
Definition: commctrl.h:3143
BOOL GetItemPosition(int nItem, POINT *pPoint)
Definition: rosctrls.h:231
virtual HRESULT STDMETHODCALLTYPE SelectItem(PCUITEMID_CHILD pidlItem, SVSIF uFlags)
HRESULT OnStateChange(UINT uFlags)
Definition: CDefView.cpp:453
short SHORT
Definition: pedump.c:59
#define FCIDM_SHVIEW_INSERT
Definition: shresdef.h:753
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:2191
#define MF_BYPOSITION
Definition: winuser.h:203
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
int iSubItem
Definition: commctrl.h:2358
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:4379
HRESULT CDefViewBckgrndMenu_CreateInstance(IShellFolder *psf, REFIID riid, void **ppv)
#define debugstr_w
Definition: kernel32.h:32
#define TPM_TOPALIGN
Definition: winuser.h:2358
#define HDI_FORMAT
Definition: commctrl.h:701
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1404
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
LPARAM lParam
Definition: commctrl.h:2364
#define FIXME(fmt,...)
Definition: debug.h:110
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:747
static PVOID ptr
Definition: dispmode.c:27
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
HMENU m_hContextMenu
Definition: CDefView.cpp:85
PIDLIST_ABSOLUTE m_pidlParent
Definition: CDefView.cpp:90
#define SFVM_LISTREFRESHED
BOOL Arrange(UINT nCode)
Definition: rosctrls.h:241
#define LVS_ALIGNLEFT
Definition: commctrl.h:2276
ULONG Release()
#define TB_ENABLEBUTTON
Definition: commctrl.h:1038
#define S_FALSE
Definition: winerror.h:2357
#define VK_SHIFT
Definition: winuser.h:2177
#define E_INVALIDARG
Definition: ddrawi.h:101
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1651
HRESULT CheckViewMode(HMENU hmenuView)
Definition: CDefView.cpp:1297
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
CComPtr< IAdviseSink > m_pAdvSink
Definition: CDefView.cpp:96
unsigned char BOOLEAN
static INT CALLBACK fill_list(LPVOID ptr, LPVOID arg)
Definition: CDefView.cpp:891
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1773
smooth NULL
Definition: ftsmooth.c:416
HRESULT InvokeContextMenuCommand(UINT uCommand)
Definition: CDefView.cpp:1346
#define LVIS_SELECTED
Definition: commctrl.h:2315
BOOL GetItem(LV_ITEM *pitem)
Definition: rosctrls.h:106
ULONG m_hNotify
Definition: CDefView.cpp:92
HRESULT WINAPI SHCreateShellFolderViewEx(LPCSFV psvcbi, IShellView **ppsv)
Definition: CDefView.cpp:3487
HRESULT DefMessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CDefView.cpp:3458
LONG cx
Definition: windef.h:334
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define LVS_AUTOARRANGE
Definition: commctrl.h:2268
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
CListView m_ListView
Definition: CDefView.cpp:79
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
Definition: CDefView.cpp:3338
#define IDS_OBJECTS
Definition: shresdef.h:258
virtual HRESULT STDMETHODCALLTYPE AddObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2861
#define LVNI_FOCUSED
Definition: commctrl.h:2419
#define SCROLLAREAWIDTH
Definition: CDefView.cpp:3127
#define CLR_NONE
Definition: commctrl.h:315
HRESULT _MergeToolbar()
Definition: CDefView.cpp:3430
FOLDERVIEWMODE
Definition: shobjidl.idl:663
#define LVS_LIST
Definition: commctrl.h:2260
#define WS_CHILDWINDOW
Definition: pedump.c:639
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1691
BOOLEAN LV_RenameItem(PCUITEMID_CHILD pidlOld, PCUITEMID_CHILD pidlNew)
Definition: CDefView.cpp:828
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define debugstr_guid
Definition: kernel32.h:35
#define MK_RBUTTON
Definition: winuser.h:2343
#define V_INTREF(A)
Definition: oleauto.h:252
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontsub.cpp:1519
CComPtr< IDataObject > m_pSourceDataObject
Definition: CDefView.cpp:98
virtual HRESULT STDMETHODCALLTYPE QuerySupport(UINT *support)
Definition: CDefView.cpp:3029
virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
Definition: CDefView.cpp:3375
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:540
#define WM_DESTROY
Definition: winuser.h:1591
UINT GetSelections()
Definition: CDefView.cpp:1318
HWND EditLabel(int i)
Definition: rosctrls.h:151
#define FCIDM_SHVIEW_NEWFOLDER
Definition: shresdef.h:773
#define MIIM_ID
Definition: winuser.h:717
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1205
virtual HRESULT STDMETHODCALLTYPE Draw(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL(STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
Definition: CDefView.cpp:3361
SHORT WINAPI GetKeyState(_In_ int)
#define FCIDM_MENU_FILE
Definition: shlobj.h:556
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3132
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3130
#define FCIDM_MENU_VIEW
Definition: shlobj.h:558
virtual HRESULT STDMETHODCALLTYPE SetObjectCount(UINT count, UINT flags)
Definition: CDefView.cpp:2900
#define MF_CHECKED
Definition: winuser.h:132
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
void DoActivate(UINT uState)
Definition: CDefView.cpp:1604
HWND m_hWndParent
Definition: CDefView.cpp:80
BOOL ClientToScreen(LPPOINT lpPoint) const
Definition: atlwin.h:359
#define IID_NULL_PPV_ARG(Itype, ppType)
void UpdateListColors()
Definition: CDefView.cpp:597
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
virtual HRESULT STDMETHODCALLTYPE SelectAndPositionItems(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD dwFlags)
Definition: CDefView.cpp:2705
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1566
#define _T(x)
Definition: vfdio.h:22
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1596
HRESULT hres
Definition: protocol.c:465
UINT m_uState
Definition: CDefView.cpp:87
LPSTR pszText
Definition: commctrl.h:2344
BOOL m_bmenuBarInitialized
Definition: CDefView.cpp:86
virtual HRESULT STDMETHODCALLTYPE GetArrangeParam(LPARAM *sort)
Definition: CDefView.cpp:2842
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
BOOL Update(int i)
Definition: rosctrls.h:131
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define GET_WM_COMMAND_HWND(wp, lp)
Definition: CDefView.cpp:360
#define MM_ADDSEPARATOR
Definition: shlobj.h:2344
#define FCIDM_SHVIEW_COPY
Definition: shresdef.h:752
SVSI_NOSTATECHANGE typedef UINT SVSIF
Definition: shobjidl.idl:724
#define WM_SIZE
Definition: winuser.h:1593
LISTVIEW_SORT_INFO m_sortInfo
Definition: CDefView.cpp:91
#define SFVM_WINDOWCREATED
Definition: shlobj.h:1234
LONG HRESULT
Definition: typedefs.h:78
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define NM_SETFOCUS
Definition: commctrl.h:135
#define END_MSG_MAP()
Definition: atlwin.h:1799
BOOL SetTextBkColor(COLORREF cr)
Definition: rosctrls.h:32
DWORD COLORREF
Definition: windef.h:300
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:764
#define _countof(array)
Definition: sndvol32.h:68
LPWSTR pszText
Definition: commctrl.h:2361
#define LV_HITTESTINFO
Definition: commctrl.h:2500
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define WM_NCDESTROY
Definition: winuser.h:1666
#define FCIDM_SHVIEW_VIEW
Definition: shresdef.h:748
#define RGB(r, g, b)
Definition: wingdi.h:2939
#define MAX_PATH
Definition: compat.h:26
BOOL UpdateWindow()
Definition: atlwin.h:1277
#define WINAPI
Definition: msvc.h:6
#define SHCNRF_ShellLevel
Definition: shlobj.h:1774
#define EM_SETSEL
Definition: winuser.h:2000
#define LVIF_IMAGE
Definition: commctrl.h:2306
virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode)
Definition: CDefView.cpp:2524