ReactOS  0.4.14-dev-114-gc8cbd56
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 ***
175  virtual HRESULT STDMETHODCALLTYPE GetView(SHELLVIEWID *view_guid, ULONG view_type);
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  HKEY hKey;
912  DWORD dFlags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS;
913 
914  TRACE("%p\n", this);
915 
916  /* determine if there is a setting to show all the hidden files/folders */
917  if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
918  {
919  DWORD dataLength, flagVal;
920 
921  dataLength = sizeof(flagVal);
922  if (RegQueryValueExW(hKey, L"Hidden", NULL, NULL, (LPBYTE)&flagVal, &dataLength) == ERROR_SUCCESS)
923  {
924  /* if the value is 1, then show all hidden files/folders */
925  if (flagVal == 1)
926  {
927  dFlags |= SHCONTF_INCLUDEHIDDEN;
928  m_ListView.SendMessageW(LVM_SETCALLBACKMASK, LVIS_CUT, 0);
929  }
930  }
931 
932  /* close the key */
933  RegCloseKey(hKey);
934  }
935 
936  /* get the itemlist from the shfolder */
937  hRes = m_pSFParent->EnumObjects(m_hWnd, dFlags, &pEnumIDList);
938  if (hRes != S_OK)
939  {
940  if (hRes == S_FALSE)
941  return(NOERROR);
942  return(hRes);
943  }
944 
945  /* create a pointer array */
946  hdpa = DPA_Create(16);
947  if (!hdpa)
948  {
949  return(E_OUTOFMEMORY);
950  }
951 
952  /* copy the items into the array*/
953  while((S_OK == pEnumIDList->Next(1, &pidl, &dwFetched)) && dwFetched)
954  {
955  if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
956  {
957  SHFree(pidl);
958  }
959  }
960 
961  /*turn the listview's redrawing off*/
963 
964  DPA_DestroyCallback( hdpa, fill_list, this);
965 
966  /* sort the array */
967  if (m_pSF2Parent)
968  {
969  m_pSF2Parent->GetDefaultColumn(NULL, (ULONG*)&m_sortInfo.nHeaderID, NULL);
970  }
971  else
972  {
973  FIXME("no m_pSF2Parent\n");
974  }
976  _Sort();
977 
979  {
982  }
983 
984  // load custom background image and custom text color
987 
988  /*turn the listview's redrawing back on and force it to draw*/
990 
992 
994  {
995  // redraw now
996  m_ListView.InvalidateRect(NULL, TRUE);
997  }
998 
1000 
1001  return S_OK;
1002 }
1003 
1005 {
1006  m_ListView.UpdateWindow();
1007  bHandled = FALSE;
1008  return 0;
1009 }
1010 
1012 {
1013  return m_ListView.SendMessageW(uMsg, 0, 0);
1014 }
1015 
1017 {
1018  if (!m_Destroyed)
1019  {
1020  m_Destroyed = TRUE;
1021  if (m_hMenu)
1022  {
1024  m_hMenu = NULL;
1025  }
1028  m_hNotify = NULL;
1030  m_pidlParent = NULL;
1031  }
1032  bHandled = FALSE;
1033  return 0;
1034 }
1035 
1037 {
1038  /* redirect to parent */
1041 
1042  bHandled = FALSE;
1043  return 0;
1044 }
1045 
1046 static VOID
1048 {
1049  INT x0 = prc->left, y0 = prc->top, x1 = prc->right, y1 = prc->bottom;
1050  x0 += dx;
1051  y0 += dy;
1052 
1053  HDC hMemDC = CreateCompatibleDC(hDC);
1054  HGDIOBJ hbmOld = SelectObject(hMemDC, hbm);
1055 
1056  for (INT y = y0; y < y1; y += nHeight)
1057  {
1058  for (INT x = x0; x < x1; x += nWidth)
1059  {
1060  BitBlt(hDC, x, y, nWidth, nHeight, hMemDC, 0, 0, SRCCOPY);
1061  }
1062  }
1063 
1064  SelectObject(hMemDC, hbmOld);
1065  DeleteDC(hMemDC);
1066 }
1067 
1069 {
1070  HDC hDC = (HDC)wParam;
1071 
1072  RECT rc;
1074 
1076  {
1077  BITMAP bm;
1078  if (::GetObject(m_viewinfo_data.hbmBack, sizeof(BITMAP), &bm))
1079  {
1080  INT dx = -(::GetScrollPos(m_ListView, SB_HORZ) % bm.bmWidth);
1081  INT dy = -(::GetScrollPos(m_ListView, SB_VERT) % bm.bmHeight);
1082  DrawTileBitmap(hDC, &rc, m_viewinfo_data.hbmBack, bm.bmWidth, bm.bmHeight, dx, dy);
1083  }
1084  }
1085  else
1086  {
1088  }
1089 
1090  bHandled = TRUE;
1091 
1092  return TRUE;
1093 }
1094 
1096 {
1097  /* Update desktop labels color */
1098  UpdateListColors();
1099 
1100  /* Forward WM_SYSCOLORCHANGE to common controls */
1101  return m_ListView.SendMessageW(uMsg, 0, 0);
1102 }
1103 
1105 {
1106  return reinterpret_cast<LRESULT>(m_pShellBrowser.p);
1107 }
1108 
1110 {
1111  this->AddRef();
1112  bHandled = FALSE;
1113  return 0;
1114 }
1115 
1117 {
1118  this->Release();
1119  bHandled = FALSE;
1120  return 0;
1121 }
1122 
1123 /**********************************************************
1124 * ShellView_OnCreate()
1125 */
1127 {
1129  SHChangeNotifyEntry ntreg;
1131 
1132  TRACE("%p\n", this);
1133 
1135  {
1136  if (FAILED(RegisterDragDrop(m_hWnd, pdt)))
1137  ERR("Registering Drag Drop Failed");
1138  }
1139 
1140  /* register for receiving notifications */
1141  m_pSFParent->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
1142  if (ppf2)
1143  {
1144  ppf2->GetCurFolder(&m_pidlParent);
1145  ntreg.fRecursive = TRUE;
1146  ntreg.pidl = m_pidlParent;
1148  }
1149 
1150  if (CreateList())
1151  {
1152  if (InitList())
1153  {
1154  FillList();
1155  }
1156  }
1157 
1158  /* _DoFolderViewCB(SFVM_GETNOTIFY, ?? ??) */
1159 
1161 
1162  UpdateStatusbar();
1163 
1164  return S_OK;
1165 }
1166 
1167 /**********************************************************
1168  * #### Handling of the menus ####
1169  */
1170 
1171 extern "C" DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID);
1172 
1174 {
1175  MENUITEMINFOW mii = {sizeof(mii), MIIM_SUBMENU};
1176  if (::GetMenuItemInfoW(hmenu, id, FALSE, &mii))
1177  return mii.hSubMenu;
1178 
1179  return NULL;
1180 }
1181 
1182 /* ReallyGetMenuItemID returns the id of an item even if it opens a submenu,
1183  GetMenuItemID returns -1 if the specified item opens a submenu */
1185 {
1186  MENUITEMINFOW mii = {sizeof(mii), MIIM_ID};
1187  if (::GetMenuItemInfoW(hmenu, i, TRUE, &mii))
1188  return mii.wID;
1189 
1190  return UINT_MAX;
1191 }
1192 
1194 {
1196  if (!hFileMenu)
1197  return E_FAIL;
1198 
1199  /* Cleanup the items added previously */
1200  for (int i = GetMenuItemCount(hFileMenu) - 1; i >= 0; i--)
1201  {
1202  UINT id = GetMenuItemID(hFileMenu, i);
1204  DeleteMenu(hFileMenu, i, MF_BYPOSITION);
1205  }
1206 
1207  /* Store the context menu in m_pCM and keep it in order to invoke the selected command later on */
1209  if (FAILED_UNEXPECTEDLY(hr))
1210  return hr;
1211 
1213 
1214  hr = m_pCM->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
1215  if (FAILED_UNEXPECTEDLY(hr))
1216  return hr;
1217 
1218  // TODO: filter or something
1219 
1220  Shell_MergeMenus(hFileMenu, hmenu, 0, 0, 0xFFFF, MM_ADDSEPARATOR | MM_SUBMENUSHAVEIDS);
1221 
1223 
1224  return S_OK;
1225 }
1226 
1228 {
1230  if (!hEditMenu)
1231  return E_FAIL;
1232 
1233  HMENU hmenuContents = ::LoadMenuW(shell32_hInstance, L"MENU_003");
1234  if (!hmenuContents)
1235  return E_FAIL;
1236 
1237  Shell_MergeMenus(hEditMenu, hmenuContents, 0, 0, 0xFFFF, 0);
1238 
1239  ::DestroyMenu(hmenuContents);
1240 
1241  return S_OK;
1242 }
1243 
1245 {
1247  if (!hViewMenu)
1248  return E_FAIL;
1249 
1251  if (!m_hMenuViewModes)
1252  return E_FAIL;
1253 
1256 
1257  return S_OK;
1258 }
1259 
1261 {
1262  /* We only need to fill this once */
1263  if (GetMenuItemID(hmenuArrange, 0) == FCIDM_SHVIEW_AUTOARRANGE)
1264  {
1265  Shell_MergeMenus(hmenuArrange, m_hMenuArrangeModes, 0, 0, 0xFFFF,0);
1266  }
1267 
1268  /* Also check the menu item according to which we sort */
1269  CheckMenuRadioItem(hmenuArrange,
1270  0x30,
1271  0x100,
1272  m_sortInfo.nHeaderID + 0x30,
1273  MF_BYCOMMAND);
1274 
1276  {
1278  }
1279  else
1280  {
1282 
1283  if (GetAutoArrange() == S_OK)
1285  }
1286 
1287 
1288  return S_OK;
1289 }
1290 
1292 {
1294  {
1295  UINT iItemFirst = FCIDM_SHVIEW_BIGICON;
1296  UINT iItemLast = iItemFirst + FVM_LAST - FVM_FIRST;
1297  UINT iItem = iItemFirst + m_FolderSettings.ViewMode - FVM_FIRST;
1298  CheckMenuRadioItem(hmenuView, iItemFirst, iItemLast, iItem, MF_BYCOMMAND);
1299  }
1300 
1301  return S_OK;
1302 }
1303 
1304 /**********************************************************
1305 * ShellView_GetSelections()
1306 *
1307 * - fills the m_apidl list with the selected objects
1308 *
1309 * RETURNS
1310 * number of selected items
1311 */
1313 {
1314  SHFree(m_apidl);
1315 
1317  m_apidl = static_cast<PCUITEMID_CHILD*>(SHAlloc(m_cidl * sizeof(PCUITEMID_CHILD)));
1318  if (!m_apidl)
1319  {
1320  m_cidl = 0;
1321  return 0;
1322  }
1323 
1324  TRACE("-- Items selected =%u\n", m_cidl);
1325 
1326  UINT i = 0;
1327  int lvIndex = -1;
1328  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
1329  {
1330  m_apidl[i] = _PidlByItem(lvIndex);
1331  i++;
1332  if (i == m_cidl)
1333  break;
1334  TRACE("-- selected Item found\n");
1335  }
1336 
1337  return m_cidl;
1338 }
1339 
1341 {
1342  CMINVOKECOMMANDINFO cmi;
1343 
1344  ZeroMemory(&cmi, sizeof(cmi));
1345  cmi.cbSize = sizeof(cmi);
1346  cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1347  cmi.hwnd = m_hWnd;
1348 
1349  if (GetKeyState(VK_SHIFT) & 0x8000)
1350  cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
1351 
1352  if (GetKeyState(VK_CONTROL) & 0x8000)
1353  cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
1354 
1355  HRESULT hr = m_pCM->InvokeCommand(&cmi);
1356  if (FAILED_UNEXPECTEDLY(hr))
1357  return hr;
1358 
1359  return S_OK;
1360 }
1361 
1362 /**********************************************************
1363  * ShellView_OpenSelectedItems()
1364  */
1366 {
1367  HMENU hMenu;
1368  UINT uCommand;
1369  HRESULT hResult;
1370 
1372  if (m_cidl == 0)
1373  return S_OK;
1374 
1375  hResult = OnDefaultCommand();
1376  if (hResult == S_OK)
1377  return hResult;
1378 
1379  hMenu = CreatePopupMenu();
1380  if (!hMenu)
1381  return E_FAIL;
1382 
1384  if (FAILED_UNEXPECTEDLY(hResult))
1385  goto cleanup;
1386 
1387  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_DEFAULTONLY);
1388  if (FAILED_UNEXPECTEDLY(hResult))
1389  goto cleanup;
1390 
1391  uCommand = GetMenuDefaultItem(hMenu, FALSE, 0);
1392  if (uCommand == (UINT)-1)
1393  {
1394  hResult = E_FAIL;
1395  goto cleanup;
1396  }
1397 
1398  InvokeContextMenuCommand(uCommand);
1399 
1400 cleanup:
1401 
1402  if (hMenu)
1403  DestroyMenu(hMenu);
1404 
1405  if (m_pCM)
1406  {
1408  m_pCM.Release();
1409  }
1410 
1411  return hResult;
1412 }
1413 
1414 /**********************************************************
1415  * ShellView_DoContextMenu()
1416  */
1418 {
1419  int x, y;
1420  UINT uCommand;
1421  HRESULT hResult;
1422 
1423  TRACE("(%p)\n", this);
1424 
1426  if (!m_hContextMenu)
1427  return E_FAIL;
1428 
1430 
1432  if (FAILED_UNEXPECTEDLY(hResult))
1433  goto cleanup;
1434 
1435  /* Use 1 as the first id as we want 0 the mean that the user canceled the menu */
1436  hResult = m_pCM->QueryContextMenu(m_hContextMenu, 0, CONTEXT_MENU_BASE_ID, FCIDM_SHVIEWLAST, CMF_NORMAL);
1437  if (FAILED_UNEXPECTEDLY(hResult))
1438  goto cleanup;
1439 
1440  /* There is no position requested, so try to find one */
1441  if (lParam == ~0)
1442  {
1443  HWND hFocus = ::GetFocus();
1444  int lvIndex = -1;
1445  POINT pt;
1446 
1447  if (hFocus == m_ListView.m_hWnd || m_ListView.IsChild(hFocus))
1448  {
1449  /* Is there an item focused and selected? */
1451  /* If not, find the first selected item */
1452  if (lvIndex < 0)
1453  lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED);
1454  }
1455 
1456  /* We got something */
1457  if (lvIndex > -1)
1458  {
1459  /* Let's find the center of the icon */
1460  RECT rc = { LVIR_ICON };
1461  m_ListView.SendMessage(LVM_GETITEMRECT, lvIndex, (LPARAM)&rc);
1462  pt.x = (rc.right + rc.left) / 2;
1463  pt.y = (rc.bottom + rc.top) / 2;
1464  }
1465  else
1466  {
1467  /* We have to drop it somewhere.. */
1468  pt.x = pt.y = 0;
1469  }
1470 
1471  m_ListView.ClientToScreen(&pt);
1472  x = pt.x;
1473  y = pt.y;
1474  }
1475  else
1476  {
1477  x = GET_X_LPARAM(lParam);
1478  y = GET_Y_LPARAM(lParam);
1479  }
1480 
1481  uCommand = TrackPopupMenu(m_hContextMenu,
1483  x, y, 0, m_hWnd, NULL);
1484  if (uCommand == 0)
1485  goto cleanup;
1486 
1487  if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
1488  goto cleanup;
1489 
1491 
1492 cleanup:
1493  if (m_pCM)
1494  {
1496  m_pCM.Release();
1497  }
1498 
1499  if (m_hContextMenu)
1500  {
1502  m_hContextMenu = NULL;
1503  }
1504 
1505  return 0;
1506 }
1507 
1509 {
1510  HRESULT hResult;
1511  HMENU hMenu;
1512 
1513  hMenu = CreatePopupMenu();
1514  if (!hMenu)
1515  return 0;
1516 
1517  hResult = GetItemObject( bUseSelection ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
1518  if (FAILED_UNEXPECTEDLY( hResult))
1519  goto cleanup;
1520 
1521  hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
1522  if (FAILED_UNEXPECTEDLY( hResult))
1523  goto cleanup;
1524 
1525  InvokeContextMenuCommand(uCommand);
1526 
1527 cleanup:
1528  if (m_pCM)
1529  {
1531  m_pCM.Release();
1532  }
1533 
1534  if (hMenu)
1535  DestroyMenu(hMenu);
1536 
1537  return 0;
1538 }
1539 
1540 /**********************************************************
1541  * ##### message handling #####
1542  */
1543 
1544 /**********************************************************
1545 * ShellView_OnSize()
1546 */
1548 {
1549  WORD wWidth, wHeight;
1550 
1551  wWidth = LOWORD(lParam);
1552  wHeight = HIWORD(lParam);
1553 
1554  TRACE("%p width=%u height=%u\n", this, wWidth, wHeight);
1555 
1556  /* Resize the ListView to fit our window */
1557  if (m_ListView)
1558  {
1559  ::MoveWindow(m_ListView, 0, 0, wWidth, wHeight, TRUE);
1560  }
1561 
1562  _DoFolderViewCB(SFVM_SIZE, 0, 0);
1563 
1564  return 0;
1565 }
1566 
1567 /**********************************************************
1568 * ShellView_OnDeactivate()
1569 *
1570 * NOTES
1571 * internal
1572 */
1574 {
1575  TRACE("%p\n", this);
1576 
1577  if (m_uState != SVUIA_DEACTIVATE)
1578  {
1579  // TODO: cleanup menu after deactivation
1580 
1582  }
1583 }
1584 
1586 {
1587  TRACE("%p uState=%x\n", this, uState);
1588 
1589  /*don't do anything if the state isn't really changing */
1590  if (m_uState == uState)
1591  {
1592  return;
1593  }
1594 
1595  if (uState == SVUIA_DEACTIVATE)
1596  {
1597  OnDeactivate();
1598  }
1599  else
1600  {
1602  {
1603  FillEditMenu();
1604  FillViewMenu();
1605  m_pShellBrowser->SetMenuSB(m_hMenu, 0, m_hWnd);
1607  }
1608 
1609  if (SVUIA_ACTIVATE_FOCUS == uState)
1610  {
1611  m_ListView.SetFocus();
1612  }
1613  }
1614 
1615  m_uState = uState;
1616  TRACE("--\n");
1617 }
1618 
1619 /**********************************************************
1620 * ShellView_OnActivate()
1621 */
1623 {
1625  return 0;
1626 }
1627 
1628 /**********************************************************
1629 * ShellView_OnSetFocus()
1630 *
1631 */
1633 {
1634  TRACE("%p\n", this);
1635 
1636  /* Tell the browser one of our windows has received the focus. This
1637  should always be done before merging menus (OnActivate merges the
1638  menus) if one of our windows has the focus.*/
1639 
1640  m_pShellBrowser->OnViewWindowActive(this);
1642 
1643  /* Set the focus to the listview */
1644  m_ListView.SetFocus();
1645 
1646  /* Notify the ICommDlgBrowser interface */
1647  OnStateChange(CDBOSC_SETFOCUS);
1648 
1649  return 0;
1650 }
1651 
1652 /**********************************************************
1653 * ShellView_OnKillFocus()
1654 */
1656 {
1657  TRACE("(%p) stub\n", this);
1658 
1660  /* Notify the ICommDlgBrowser */
1661  OnStateChange(CDBOSC_KILLFOCUS);
1662 
1663  return 0;
1664 }
1665 
1666 /**********************************************************
1667 * ShellView_OnCommand()
1668 *
1669 * NOTES
1670 * the CmdID's are the ones from the context menu
1671 */
1673 {
1674  DWORD dwCmdID;
1675  DWORD dwCmd;
1676  HWND hwndCmd;
1677  int nCount;
1678 
1679  dwCmdID = GET_WM_COMMAND_ID(wParam, lParam);
1680  dwCmd = GET_WM_COMMAND_CMD(wParam, lParam);
1681  hwndCmd = GET_WM_COMMAND_HWND(wParam, lParam);
1682 
1683  TRACE("(%p)->(0x%08x 0x%08x %p) stub\n", this, dwCmdID, dwCmd, hwndCmd);
1684 
1685  switch (dwCmdID)
1686  {
1689  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_SMALLICON);
1690  CheckToolbar();
1691  break;
1692 
1693  case FCIDM_SHVIEW_BIGICON:
1695  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_ICON);
1696  CheckToolbar();
1697  break;
1698 
1699  case FCIDM_SHVIEW_LISTVIEW:
1701  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_LIST);
1702  CheckToolbar();
1703  break;
1704 
1707  m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
1708  CheckToolbar();
1709  break;
1710 
1711  /* the menu-ID's for sorting are 0x30... see shrec.rc */
1712  case 0x30:
1713  case 0x31:
1714  case 0x32:
1715  case 0x33:
1716  m_sortInfo.nHeaderID = dwCmdID - 0x30;
1718  _Sort();
1719  break;
1720 
1722  //FIXME
1723  break;
1725  if (GetAutoArrange() == S_OK)
1726  m_ListView.ModifyStyle(LVS_AUTOARRANGE, 0);
1727  else
1728  AutoArrange();
1729  break;
1732  break;
1733 
1735  nCount = m_ListView.GetItemCount();
1736  for (int i=0; i < nCount; i++)
1738  break;
1739 
1740  case FCIDM_SHVIEW_REFRESH:
1741  Refresh();
1742  break;
1743 
1744  case FCIDM_SHVIEW_DELETE:
1745  case FCIDM_SHVIEW_CUT:
1746  case FCIDM_SHVIEW_COPY:
1747  case FCIDM_SHVIEW_RENAME:
1749  return OnExplorerCommand(dwCmdID, TRUE);
1750 
1751  case FCIDM_SHVIEW_INSERT:
1752  case FCIDM_SHVIEW_UNDO:
1755  return OnExplorerCommand(dwCmdID, FALSE);
1756  default:
1757  /* WM_COMMAND messages from the file menu are routed to the CDefView so as to let m_pCM handle the command */
1758  if (m_pCM && dwCmd == 0)
1759  {
1760  InvokeContextMenuCommand(dwCmdID);
1761  }
1762  }
1763 
1764  return 0;
1765 }
1766 
1767 /**********************************************************
1768 * ShellView_OnNotify()
1769 */
1770 
1772 {
1773  UINT CtlID;
1774  LPNMHDR lpnmh;
1775  LPNMLISTVIEW lpnmlv;
1776  NMLVDISPINFOW *lpdi;
1777  PCUITEMID_CHILD pidl;
1778  BOOL unused;
1779 
1780  CtlID = wParam;
1781  lpnmh = (LPNMHDR)lParam;
1782  lpnmlv = (LPNMLISTVIEW)lpnmh;
1783  lpdi = (NMLVDISPINFOW *)lpnmh;
1784 
1785  TRACE("%p CtlID=%u lpnmh->code=%x\n", this, CtlID, lpnmh->code);
1786 
1787  switch (lpnmh->code)
1788  {
1789  case NM_SETFOCUS:
1790  TRACE("-- NM_SETFOCUS %p\n", this);
1791  OnSetFocus(0, 0, 0, unused);
1792  break;
1793 
1794  case NM_KILLFOCUS:
1795  TRACE("-- NM_KILLFOCUS %p\n", this);
1796  OnDeactivate();
1797  /* Notify the ICommDlgBrowser interface */
1798  OnStateChange(CDBOSC_KILLFOCUS);
1799  break;
1800 
1801  case NM_CUSTOMDRAW:
1802  TRACE("-- NM_CUSTOMDRAW %p\n", this);
1803  return CDRF_DODEFAULT;
1804 
1805  case NM_RELEASEDCAPTURE:
1806  TRACE("-- NM_RELEASEDCAPTURE %p\n", this);
1807  break;
1808 
1809  case NM_CLICK:
1810  TRACE("-- NM_CLICK %p\n", this);
1811  break;
1812 
1813  case NM_RCLICK:
1814  TRACE("-- NM_RCLICK %p\n", this);
1815  break;
1816 
1817  case NM_DBLCLK:
1818  TRACE("-- NM_DBLCLK %p\n", this);
1820  break;
1821 
1822  case NM_RETURN:
1823  TRACE("-- NM_RETURN %p\n", this);
1825  break;
1826 
1827  case HDN_ENDTRACKW:
1828  TRACE("-- HDN_ENDTRACKW %p\n", this);
1829  /*nColumn1 = m_ListView.GetColumnWidth(0);
1830  nColumn2 = m_ListView.GetColumnWidth(1);*/
1831  break;
1832 
1833  case LVN_DELETEITEM:
1834  TRACE("-- LVN_DELETEITEM %p\n", this);
1835 
1836  /*delete the pidl because we made a copy of it*/
1837  SHFree(reinterpret_cast<LPVOID>(lpnmlv->lParam));
1838 
1839  break;
1840 
1841  case LVN_DELETEALLITEMS:
1842  TRACE("-- LVN_DELETEALLITEMS %p\n", this);
1843  return FALSE;
1844 
1845  case LVN_INSERTITEM:
1846  TRACE("-- LVN_INSERTITEM (STUB)%p\n", this);
1847  break;
1848 
1849  case LVN_ITEMACTIVATE:
1850  TRACE("-- LVN_ITEMACTIVATE %p\n", this);
1851  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1852  break;
1853 
1854  case LVN_COLUMNCLICK:
1855  m_sortInfo.nHeaderID = lpnmlv->iSubItem;
1858  else
1860  _Sort();
1861  break;
1862 
1863  case LVN_GETDISPINFOA:
1864  case LVN_GETDISPINFOW:
1865  TRACE("-- LVN_GETDISPINFO %p\n", this);
1866  pidl = _PidlByItem(lpdi->item);
1867 
1868  if (lpdi->item.mask & LVIF_TEXT) /* text requested */
1869  {
1870  if (m_pSF2Parent)
1871  {
1872  SHELLDETAILS sd;
1873  if (FAILED_UNEXPECTEDLY(m_pSF2Parent->GetDetailsOf(pidl, lpdi->item.iSubItem, &sd)))
1874  break;
1875 
1876  if (lpnmh->code == LVN_GETDISPINFOA)
1877  {
1878  /* shouldn't happen */
1879  NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
1880  StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
1881  TRACE("-- text=%s\n", lpdiA->item.pszText);
1882  }
1883  else /* LVN_GETDISPINFOW */
1884  {
1885  StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1886  TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
1887  }
1888  }
1889  else
1890  {
1891  FIXME("no m_pSF2Parent\n");
1892  }
1893  }
1894  if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1895  {
1897  }
1898  if(lpdi->item.mask & LVIF_STATE)
1899  {
1900  ULONG attributes = SFGAO_HIDDEN;
1901  if (SUCCEEDED(m_pSFParent->GetAttributesOf(1, &pidl, &attributes)))
1902  {
1903  if (attributes & SFGAO_HIDDEN)
1904  {
1905  lpdi->item.state |= LVIS_CUT;
1906  }
1907  }
1908  }
1909  lpdi->item.mask |= LVIF_DI_SETITEM;
1910  break;
1911 
1912  case LVN_ITEMCHANGED:
1913  TRACE("-- LVN_ITEMCHANGED %p\n", this);
1914  OnStateChange(CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1915  UpdateStatusbar();
1916  _DoFolderViewCB(SFVM_SELECTIONCHANGED, NULL/* FIXME */, NULL/* FIXME */);
1917  break;
1918 
1919  case LVN_BEGINDRAG:
1920  case LVN_BEGINRDRAG:
1921  TRACE("-- LVN_BEGINDRAG\n");
1922 
1923  if (GetSelections())
1924  {
1926  DWORD dwAttributes = SFGAO_CANCOPY | SFGAO_CANLINK;
1927  DWORD dwEffect = DROPEFFECT_MOVE;
1928 
1929  if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
1930  {
1932 
1933  if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &dwAttributes)))
1934  {
1935  dwEffect |= dwAttributes & (SFGAO_CANCOPY | SFGAO_CANLINK);
1936  }
1937 
1939  if (SUCCEEDED(pda->QueryInterface(IID_PPV_ARG(IAsyncOperation, &piaso))))
1940  {
1941  piaso->SetAsyncMode(TRUE);
1942  }
1943 
1944  DWORD dwEffect2;
1945 
1946  m_pSourceDataObject = pda;
1947  m_ptFirstMousePos = params->ptAction;
1949 
1950  HIMAGELIST big_icons, small_icons;
1951  Shell_GetImageLists(&big_icons, &small_icons);
1952  PCUITEMID_CHILD pidl = _PidlByItem(params->iItem);
1953  int iIcon = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
1954  POINT ptItem;
1955  m_ListView.GetItemPosition(params->iItem, &ptItem);
1956 
1957  ImageList_BeginDrag(big_icons, iIcon, params->ptAction.x - ptItem.x, params->ptAction.y - ptItem.y);
1958 
1959  DoDragDrop(pda, this, dwEffect, &dwEffect2);
1960 
1962  }
1963  }
1964  break;
1965 
1966  case LVN_BEGINLABELEDITW:
1967  {
1968  DWORD dwAttr = SFGAO_CANRENAME;
1969  pidl = _PidlByItem(lpdi->item);
1970 
1971  TRACE("-- LVN_BEGINLABELEDITW %p\n", this);
1972 
1973  m_pSFParent->GetAttributesOf(1, &pidl, &dwAttr);
1974  if (SFGAO_CANRENAME & dwAttr)
1975  {
1976  m_isEditing = TRUE;
1977  return FALSE;
1978  }
1979  return TRUE;
1980  }
1981 
1982  case LVN_ENDLABELEDITW:
1983  {
1984  TRACE("-- LVN_ENDLABELEDITW %p\n", this);
1985 
1986  m_isEditing = FALSE;
1987 
1988  if (lpdi->item.pszText)
1989  {
1990  HRESULT hr;
1991  LVITEMW lvItem;
1992 
1993  pidl = _PidlByItem(lpdi->item);
1994  PITEMID_CHILD pidlNew = NULL;
1995  hr = m_pSFParent->SetNameOf(0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidlNew);
1996 
1997  if (SUCCEEDED(hr) && pidlNew)
1998  {
1999  lvItem.mask = LVIF_PARAM|LVIF_IMAGE;
2000  lvItem.iItem = lpdi->item.iItem;
2001  lvItem.iSubItem = 0;
2002  lvItem.lParam = reinterpret_cast<LPARAM>(pidlNew);
2003  lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidlNew, 0);
2004  m_ListView.SetItem(&lvItem);
2005  m_ListView.Update(lpdi->item.iItem);
2006  return TRUE;
2007  }
2008  }
2009 
2010  return FALSE;
2011  }
2012 
2013  default:
2014  TRACE("-- %p WM_COMMAND %x unhandled\n", this, lpnmh->code);
2015  break;
2016  }
2017 
2018  return 0;
2019 }
2020 
2021 /*
2022  * This is just a quick hack to make the desktop work correctly.
2023  * ITranslateShellChangeNotify's IsChildID is undocumented, but most likely the way that
2024  * a folder should know if it should update upon a change notification.
2025  * It is exported by merged folders at a minimum.
2026  */
2028 {
2029  if (!pidl1 || !pidl2)
2030  return FALSE;
2031  if (ILIsParent(pidl1, pidl2, TRUE))
2032  return TRUE;
2033 
2034  if (_ILIsDesktop(pidl1))
2035  {
2036  PIDLIST_ABSOLUTE deskpidl;
2038  if (ILIsParent(deskpidl, pidl2, TRUE))
2039  {
2040  ILFree(deskpidl);
2041  return TRUE;
2042  }
2043  ILFree(deskpidl);
2045  if (ILIsParent(deskpidl, pidl2, TRUE))
2046  {
2047  ILFree(deskpidl);
2048  return TRUE;
2049  }
2050  ILFree(deskpidl);
2051  }
2052  return FALSE;
2053 }
2054 
2055 /**********************************************************
2056 * ShellView_OnChange()
2057 */
2059 {
2060  PCIDLIST_ABSOLUTE *Pidls = reinterpret_cast<PCIDLIST_ABSOLUTE*>(wParam);
2061  BOOL bParent0 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[0]);
2062  BOOL bParent1 = ILIsParentOrSpecialParent(m_pidlParent, Pidls[1]);
2063 
2064  TRACE("(%p)(%p,%p,0x%08x)\n", this, Pidls[0], Pidls[1], lParam);
2065 
2066  switch (lParam &~ SHCNE_INTERRUPT)
2067  {
2068  case SHCNE_MKDIR:
2069  case SHCNE_CREATE:
2070  if (bParent0)
2071  {
2072  if (LV_FindItemByPidl(ILFindLastID(Pidls[0])) == -1)
2073  {
2074  LV_AddItem(ILFindLastID(Pidls[0]));
2075  }
2076  else
2077  {
2078  LV_ProdItem(ILFindLastID(Pidls[0]));
2079  }
2080  }
2081  break;
2082 
2083  case SHCNE_RMDIR:
2084  case SHCNE_DELETE:
2085  if (bParent0)
2086  LV_DeleteItem(ILFindLastID(Pidls[0]));
2087  break;
2088 
2089  case SHCNE_RENAMEFOLDER:
2090  case SHCNE_RENAMEITEM:
2091  if (bParent0 && bParent1)
2092  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[1]));
2093  else if (bParent0)
2094  LV_DeleteItem(ILFindLastID(Pidls[0]));
2095  else if (bParent1)
2096  LV_AddItem(ILFindLastID(Pidls[1]));
2097  break;
2098 
2099  case SHCNE_UPDATEITEM:
2100  if (bParent0)
2101  LV_RenameItem(ILFindLastID(Pidls[0]), ILFindLastID(Pidls[0]));
2102  break;
2103 
2104  case SHCNE_UPDATEDIR:
2105  Refresh();
2106  break;
2107  }
2108  return TRUE;
2109 }
2110 
2113 
2114 /**********************************************************
2115 * CDefView::OnCustomItem
2116 */
2118 {
2119  if (!m_pCM.p)
2120  {
2121  /* no menu */
2122  ERR("no menu!!!\n");
2123  return FALSE;
2124  }
2125 
2126  /* The lParam of WM_DRAWITEM WM_MEASUREITEM contain a menu id and this also needs to
2127  be changed to a menu identifier offset */
2128  UINT CmdID;
2129  HRESULT hres = SHGetMenuIdFromMenuMsg(uMsg, lParam, &CmdID);
2130  if (SUCCEEDED(hres))
2132 
2133  /* Forward the message to the IContextMenu2 */
2134  LRESULT result;
2136 
2137  return (SUCCEEDED(hres));
2138 }
2139 
2141 {
2142  /* Wallpaper setting affects drop shadows effect */
2143  if (wParam == SPI_SETDESKWALLPAPER || wParam == 0)
2144  UpdateListColors();
2145 
2146  return S_OK;
2147 }
2148 
2149 /**********************************************************
2150 * CDefView::OnInitMenuPopup
2151 */
2153 {
2154  HMENU hmenu = (HMENU) wParam;
2155  int nPos = LOWORD(lParam);
2156  UINT menuItemId;
2157 
2158  OnCustomItem(uMsg, wParam, lParam, bHandled);
2159 
2161 
2162  /* Lets try to find out what the hell wParam is */
2163  if (hmenu == GetSubMenu(m_hMenu, nPos))
2164  menuItemId = ReallyGetMenuItemID(m_hMenu, nPos);
2165  else if (hViewMenu && hmenu == GetSubMenu(hViewMenu, nPos))
2166  menuItemId = ReallyGetMenuItemID(hViewMenu, nPos);
2167  else if (m_hContextMenu && hmenu == GetSubMenu(m_hContextMenu, nPos))
2168  menuItemId = ReallyGetMenuItemID(m_hContextMenu, nPos);
2169  else
2170  return FALSE;
2171 
2172  switch (menuItemId)
2173  {
2174  case FCIDM_MENU_FILE:
2175  FillFileMenu();
2176  break;
2177  case FCIDM_MENU_VIEW:
2178  case FCIDM_SHVIEW_VIEW:
2180  break;
2181  case FCIDM_SHVIEW_ARRANGE:
2183  break;
2184  }
2185 
2186  return FALSE;
2187 }
2188 
2189 /**********************************************************
2190 *
2191 *
2192 * The INTERFACE of the IShellView object
2193 *
2194 *
2195 **********************************************************
2196 */
2197 
2198 /**********************************************************
2199 * ShellView_GetWindow
2200 */
2202 {
2203  TRACE("(%p)\n", this);
2204 
2205  *phWnd = m_hWnd;
2206 
2207  return S_OK;
2208 }
2209 
2211 {
2212  FIXME("(%p) stub\n", this);
2213 
2214  return E_NOTIMPL;
2215 }
2216 
2217 /**********************************************************
2218 * IShellView_TranslateAccelerator
2219 *
2220 * FIXME:
2221 * use the accel functions
2222 */
2224 {
2225  if (m_isEditing)
2226  return S_FALSE;
2227 
2228  if (lpmsg->message >= WM_KEYFIRST && lpmsg->message <= WM_KEYLAST)
2229  {
2230  if (::TranslateAcceleratorW(m_hWnd, m_hAccel, lpmsg) != 0)
2231  return S_OK;
2232 
2233  TRACE("-- key=0x%04lx\n", lpmsg->wParam) ;
2234  }
2235 
2236  return m_pShellBrowser->TranslateAcceleratorSB(lpmsg, 0);
2237 }
2238 
2240 {
2241  FIXME("(%p) stub\n", this);
2242 
2243  return E_NOTIMPL;
2244 }
2245 
2247 {
2248  // CHAR szName[MAX_PATH];
2249  LRESULT lResult;
2250  int nPartArray[1] = { -1};
2251 
2252  TRACE("(%p)->(state=%x) stub\n", this, uState);
2253 
2254  /* don't do anything if the state isn't really changing */
2255  if (m_uState == uState)
2256  {
2257  return S_OK;
2258  }
2259 
2260  /* OnActivate handles the menu merging and internal state */
2261  DoActivate(uState);
2262 
2263  /* only do This if we are active */
2264  if (uState != SVUIA_DEACTIVATE)
2265  {
2266 
2267  /*
2268  GetFolderPath is not a method of IShellFolder
2269  IShellFolder_GetFolderPath( m_pSFParent, szName, sizeof(szName) );
2270  */
2271  /* set the number of parts */
2272  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult);
2273 
2274  /* set the text for the parts */
2275  /*
2276  m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETTEXTA, 0, (LPARAM)szName, &lResult);
2277  */
2278  }
2279 
2280  return S_OK;
2281 }
2282 
2284 {
2285  TRACE("(%p)\n", this);
2286 
2288  FillList();
2289 
2290  return S_OK;
2291 }
2292 
2294 {
2295  return CreateViewWindow3(psb, lpPrevView, SV3CVW3_DEFAULT,
2296  (FOLDERFLAGS)lpfs->fFlags, (FOLDERFLAGS)lpfs->fFlags, (FOLDERVIEWMODE)lpfs->ViewMode, NULL, prcView, phWnd);
2297 }
2298 
2300 {
2301  TRACE("(%p)\n", this);
2302 
2303  /* Make absolutely sure all our UI is cleaned up */
2305 
2306  if (m_hAccel)
2307  {
2308  // "Accelerator tables loaded from resources are freed automatically when the application terminates." -- MSDN
2309  m_hAccel = NULL;
2310  }
2311 
2312  if (m_hMenuArrangeModes)
2313  {
2316  }
2317 
2318  if (m_hMenuViewModes)
2319  {
2322  }
2323 
2324  if (m_hMenu)
2325  {
2327  m_hMenu = NULL;
2328  }
2329 
2330  if (m_ListView)
2331  {
2332  m_ListView.DestroyWindow();
2333  }
2334 
2335  if (m_hWnd)
2336  {
2337  DestroyWindow();
2338  }
2339 
2342 
2343  return S_OK;
2344 }
2345 
2347 {
2348  TRACE("(%p)->(%p) vmode=%x flags=%x\n", this, lpfs,
2350 
2351  if (!lpfs)
2352  return E_INVALIDARG;
2353 
2354  *lpfs = m_FolderSettings;
2355  return S_OK;
2356 }
2357 
2359 {
2360  FIXME("(%p) stub\n", this);
2361 
2362  return E_NOTIMPL;
2363 }
2364 
2366 {
2367  FIXME("(%p) stub\n", this);
2368 
2369  return S_OK;
2370 }
2371 
2373 {
2374  int i;
2375 
2376  TRACE("(%p)->(pidl=%p, 0x%08x) stub\n", this, pidl, uFlags);
2377 
2378  i = LV_FindItemByPidl(pidl);
2379  if (i == -1)
2380  return S_OK;
2381 
2382  if(uFlags & SVSI_ENSUREVISIBLE)
2384 
2385  LVITEMW lvItem = {0};
2386  lvItem.mask = LVIF_STATE;
2388 
2389  while (m_ListView.GetItem(&lvItem))
2390  {
2391  if (lvItem.iItem == i)
2392  {
2393  if (uFlags & SVSI_SELECT)
2394  lvItem.state |= LVIS_SELECTED;
2395  else
2396  lvItem.state &= ~LVIS_SELECTED;
2397 
2398  if (uFlags & SVSI_FOCUSED)
2399  lvItem.state &= ~LVIS_FOCUSED;
2400  }
2401  else
2402  {
2403  if (uFlags & SVSI_DESELECTOTHERS)
2404  lvItem.state &= ~LVIS_SELECTED;
2405  }
2406 
2407  m_ListView.SetItem(&lvItem);
2408  lvItem.iItem++;
2409  }
2410 
2411  if((uFlags & SVSI_EDIT) == SVSI_EDIT)
2413 
2414  return S_OK;
2415 }
2416 
2418 {
2420 
2421  TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n", this, uItem, debugstr_guid(&riid), ppvOut);
2422 
2423  if (!ppvOut)
2424  return E_INVALIDARG;
2425 
2426  *ppvOut = NULL;
2427 
2428  switch (uItem)
2429  {
2430  case SVGIO_BACKGROUND:
2431  if (IsEqualIID(riid, IID_IContextMenu))
2432  {
2434  if (FAILED_UNEXPECTEDLY(hr))
2435  return hr;
2436 
2437  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2438  }
2439  else if (IsEqualIID(riid, IID_IDispatch))
2440  {
2442  {
2444  if (FAILED_UNEXPECTEDLY(hr))
2445  return hr;
2446  }
2447  hr = m_pShellFolderViewDual->QueryInterface(riid, ppvOut);
2448  }
2449  break;
2450 
2451  case SVGIO_SELECTION:
2452  GetSelections();
2453  hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0, ppvOut);
2454  if (FAILED_UNEXPECTEDLY(hr))
2455  return hr;
2456 
2457  if (IsEqualIID(riid, IID_IContextMenu))
2458  IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
2459 
2460  break;
2461  }
2462 
2463  TRACE("-- (%p)->(interface=%p)\n", this, *ppvOut);
2464 
2465  return hr;
2466 }
2467 
2469 {
2470  TRACE("(%p)->(%p), stub\n", this, pViewMode);
2471 
2472  if (!pViewMode)
2473  return E_INVALIDARG;
2474 
2475  *pViewMode = m_FolderSettings.ViewMode;
2476  return S_OK;
2477 }
2478 
2480 {
2481  DWORD dwStyle;
2482  TRACE("(%p)->(%u), stub\n", this, ViewMode);
2483 
2484  /* It's not redundant to check FVM_AUTO because it's a (UINT)-1 */
2485  if (((INT)ViewMode < FVM_FIRST || (INT)ViewMode > FVM_LAST) && ((INT)ViewMode != FVM_AUTO))
2486  return E_INVALIDARG;
2487 
2488  /* Windows before Vista uses LVM_SETVIEW and possibly
2489  LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2490  while later versions seem to accomplish this through other
2491  means. */
2492  switch (ViewMode)
2493  {
2494  case FVM_ICON:
2495  dwStyle = LVS_ICON;
2496  break;
2497  case FVM_DETAILS:
2498  dwStyle = LVS_REPORT;
2499  break;
2500  case FVM_SMALLICON:
2501  dwStyle = LVS_SMALLICON;
2502  break;
2503  case FVM_LIST:
2504  dwStyle = LVS_LIST;
2505  break;
2506  default:
2507  {
2508  FIXME("ViewMode %d not implemented\n", ViewMode);
2509  dwStyle = LVS_LIST;
2510  break;
2511  }
2512  }
2513 
2514  m_ListView.ModifyStyle(LVS_TYPEMASK, dwStyle);
2515 
2516  /* This will not necessarily be the actual mode set above.
2517  This mimics the behavior of Windows XP. */
2518  m_FolderSettings.ViewMode = ViewMode;
2519 
2520  return S_OK;
2521 }
2522 
2524 {
2525  if (m_pSFParent == NULL)
2526  return E_FAIL;
2527 
2528  return m_pSFParent->QueryInterface(riid, ppv);
2529 }
2530 
2532 {
2533  PCUITEMID_CHILD pidl = _PidlByItem(iItemIndex);
2534  if (pidl)
2535  {
2536  *ppidl = ILClone(pidl);
2537  return S_OK;
2538  }
2539 
2540  *ppidl = 0;
2541  return E_INVALIDARG;
2542 }
2543 
2545 {
2546  TRACE("(%p)->(%u %p)\n", this, uFlags, pcItems);
2547 
2548  if (uFlags != SVGIO_ALLVIEW)
2549  FIXME("some flags unsupported, %x\n", uFlags & ~SVGIO_ALLVIEW);
2550 
2552 
2553  return S_OK;
2554 }
2555 
2557 {
2558  return E_NOTIMPL;
2559 }
2560 
2562 {
2563  TRACE("(%p)->(%p)\n", this, piItem);
2564 
2565  *piItem = m_ListView.GetSelectionMark();
2566 
2567  return S_OK;
2568 }
2569 
2571 {
2572  TRACE("(%p)->(%p)\n", this, piItem);
2573 
2574  *piItem = m_ListView.GetNextItem(-1, LVNI_FOCUSED);
2575 
2576  return S_OK;
2577 }
2578 
2580 {
2581  int lvIndex = LV_FindItemByPidl(pidl);
2582  if (lvIndex == -1 || ppt == NULL)
2583  return E_INVALIDARG;
2584 
2585  m_ListView.GetItemPosition(lvIndex, ppt);
2586  return S_OK;
2587 }
2588 
2590 {
2591  TRACE("(%p)->(%p)\n", this, ppt);
2592 
2593  if (!m_ListView)
2594  return S_FALSE;
2595 
2596  if (ppt)
2597  {
2598  SIZE spacing;
2599  m_ListView.GetItemSpacing(spacing);
2600 
2601  ppt->x = spacing.cx;
2602  ppt->y = spacing.cy;
2603  }
2604 
2605  return S_OK;
2606 }
2607 
2609 {
2610  return E_NOTIMPL;
2611 }
2612 
2614 {
2615  return ((m_ListView.GetStyle() & LVS_AUTOARRANGE) ? S_OK : S_FALSE);
2616 }
2617 
2619 {
2620  LVITEMW lvItem;
2621 
2622  TRACE("(%p)->(%d, %x)\n", this, iItem, dwFlags);
2623 
2624  lvItem.state = 0;
2625  lvItem.stateMask = LVIS_SELECTED;
2626 
2627  if (dwFlags & SVSI_ENSUREVISIBLE)
2628  m_ListView.EnsureVisible(iItem, 0);
2629 
2630  /* all items */
2631  if (dwFlags & SVSI_DESELECTOTHERS)
2633 
2634  /* this item */
2635  if (dwFlags & SVSI_SELECT)
2636  lvItem.state |= LVIS_SELECTED;
2637 
2638  if (dwFlags & SVSI_FOCUSED)
2639  lvItem.stateMask |= LVIS_FOCUSED;
2640 
2641  m_ListView.SetItemState(iItem, lvItem.state, lvItem.stateMask);
2642 
2643  if ((dwFlags & SVSI_EDIT) == SVSI_EDIT)
2644  m_ListView.EditLabel(iItem);
2645 
2646  return S_OK;
2647 }
2648 
2650 {
2651  /* Reset the selection */
2653 
2654  int lvIndex;
2655  for (UINT i = 0 ; i < m_cidl; i++)
2656  {
2657  lvIndex = LV_FindItemByPidl(apidl[i]);
2658  if (lvIndex != -1)
2659  {
2660  SelectItem(lvIndex, dwFlags);
2661  m_ListView.SetItemPosition(lvIndex, &apt[i]);
2662  }
2663  }
2664 
2665  return S_OK;
2666 }
2667 
2668 /**********************************************************
2669  * IShellView2 implementation
2670  */
2671 
2673 {
2674  FIXME("(%p)->(%p, %lu) stub\n", this, view_guid, view_type);
2675  return E_NOTIMPL;
2676 }
2677 
2679 {
2680  return CreateViewWindow3(view_params->psbOwner, view_params->psvPrev,
2681  SV3CVW3_DEFAULT, (FOLDERFLAGS)view_params->pfs->fFlags, (FOLDERFLAGS)view_params->pfs->fFlags,
2682  (FOLDERVIEWMODE)view_params->pfs->ViewMode, view_params->pvid, view_params->prcView, &view_params->hwndView);
2683 }
2684 
2686 {
2687  OLEMENUGROUPWIDTHS omw = { { 0, 0, 0, 0, 0, 0 } };
2688 
2689  *hwnd = NULL;
2690 
2691  TRACE("(%p)->(shlview=%p shlbrs=%p rec=%p hwnd=%p vmode=%x flags=%x)\n", this, psvPrevious, psb, prcView, hwnd, mode, flags);
2692  if (prcView != NULL)
2693  TRACE("-- left=%i top=%i right=%i bottom=%i\n", prcView->left, prcView->top, prcView->right, prcView->bottom);
2694 
2695  /* Validate the Shell Browser */
2696  if (psb == NULL || m_hWnd)
2697  return E_UNEXPECTED;
2698 
2699  if (view_flags != SV3CVW3_DEFAULT)
2700  FIXME("unsupported view flags 0x%08x\n", view_flags);
2701 
2702  /* Set up the member variables */
2703  m_pShellBrowser = psb;
2706 
2707  if (view_id)
2708  {
2709  if (IsEqualIID(*view_id, VID_LargeIcons))
2711  else if (IsEqualIID(*view_id, VID_SmallIcons))
2713  else if (IsEqualIID(*view_id, VID_List))
2715  else if (IsEqualIID(*view_id, VID_Details))
2717  else if (IsEqualIID(*view_id, VID_Thumbnails))
2719  else if (IsEqualIID(*view_id, VID_Tile))
2721  else if (IsEqualIID(*view_id, VID_ThumbStrip))
2723  else
2724  FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id));
2725  }
2726 
2727  /* Get our parent window */
2728  m_pShellBrowser->GetWindow(&m_hWndParent);
2729 
2730  /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2733  {
2734  TRACE("-- CommDlgBrowser\n");
2735  }
2736 
2738  if (m_hWnd == NULL)
2739  return E_FAIL;
2740 
2741  *hwnd = m_hWnd;
2742 
2743  CheckToolbar();
2744 
2745  if (!*hwnd)
2746  return E_FAIL;
2747 
2749 
2751  UpdateWindow();
2752 
2753  if (!m_hMenu)
2754  {
2755  m_hMenu = CreateMenu();
2756  m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);
2757  TRACE("-- after fnInsertMenusSB\n");
2758  }
2759 
2760  _MergeToolbar();
2761 
2762  return S_OK;
2763 }
2764 
2766 {
2767  FIXME("(%p)->(%p) stub\n", this, new_pidl);
2768  return E_NOTIMPL;
2769 }
2770 
2772 {
2773  FIXME("(%p)->(%p, %u, %p) stub\n", this, item, flags, point);
2774  return E_NOTIMPL;
2775 }
2776 
2777 /**********************************************************
2778  * IShellFolderView implementation
2779  */
2781 {
2782  FIXME("(%p)->(%ld) stub\n", this, sort);
2783  return E_NOTIMPL;
2784 }
2785 
2787 {
2788  FIXME("(%p)->(%p) stub\n", this, sort);
2789  return E_NOTIMPL;
2790 }
2791 
2793 {
2794  FIXME("(%p) stub\n", this);
2795  return E_NOTIMPL;
2796 }
2797 
2799 {
2800  m_ListView.ModifyStyle(0, LVS_AUTOARRANGE);
2802  return S_OK;
2803 }
2804 
2806 {
2807  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2808  *item = LV_AddItem(pidl);
2809  return (int)*item >= 0 ? S_OK : E_OUTOFMEMORY;
2810 }
2811 
2813 {
2814  TRACE("(%p)->(%p %d)\n", this, pidl, item);
2815  return Item(item, pidl);
2816 }
2817 
2819 {
2820 
2821  TRACE("(%p)->(%p %p)\n", this, pidl, item);
2822 
2823  if (pidl)
2824  {
2827  }
2828  else
2829  {
2830  *item = 0;
2832  }
2833 
2834  return S_OK;
2835 }
2836 
2838 {
2839  TRACE("(%p)->(%p)\n", this, count);
2841  return S_OK;
2842 }
2843 
2845 {
2846  FIXME("(%p)->(%d %x) stub\n", this, count, flags);
2847  return E_NOTIMPL;
2848 }
2849 
2851 {
2852  FIXME("(%p)->(%p %p %p) stub\n", this, pidl_old, pidl_new, item);
2853  return E_NOTIMPL;
2854 }
2855 
2857 {
2858  FIXME("(%p)->(%p %p) stub\n", this, pidl, item);
2859  return E_NOTIMPL;
2860 }
2861 
2863 {
2864  TRACE("(%p)->(%d)\n", this, redraw);
2866  return S_OK;
2867 }
2868 
2870 {
2871  FIXME("(%p)->(%p) stub\n", this, count);
2872  return E_NOTIMPL;
2873 }
2874 
2876 {
2877  TRACE("(%p)->(%p %p)\n", this, pidl, items);
2878 
2879  *items = GetSelections();
2880 
2881  if (*items)
2882  {
2883  *pidl = static_cast<PCUITEMID_CHILD *>(LocalAlloc(0, *items * sizeof(PCUITEMID_CHILD)));
2884  if (!*pidl)
2885  {
2886  return E_OUTOFMEMORY;
2887  }
2888 
2889  /* it's documented that caller shouldn't PIDLs, only array itself */
2890  memcpy(*pidl, m_apidl, *items * sizeof(PCUITEMID_CHILD));
2891  }
2892 
2893  return S_OK;
2894 }
2895 
2897 {
2898  if ((m_iDragOverItem == -1 || m_pCurDropTarget == NULL) &&
2900  {
2901  return S_OK;
2902  }
2903 
2904  return S_FALSE;
2905 }
2906 
2908 {
2909  if (!pt)
2910  return E_INVALIDARG;
2911 
2912  *pt = m_ptFirstMousePos;
2913  return S_OK;
2914 }
2915 
2917 {
2918  FIXME("(%p)->(%p) stub\n", this, pt);
2919  return E_NOTIMPL;
2920 }
2921 
2923 {
2924  TRACE("(%p)->(%p)\n", this, obj);
2925  return E_NOTIMPL;
2926 }
2927 
2929 {
2930  FIXME("(%p)->(%p %p) stub\n", this, pidl, pt);
2931  return E_NOTIMPL;
2932 }
2933 
2935 {
2936  FIXME("(%p)->(%p) stub\n", this, drop_target);
2937  return E_NOTIMPL;
2938 }
2939 
2941 {
2942  FIXME("(%p)->(%d) stub\n", this, move);
2943  return E_NOTIMPL;
2944 }
2945 
2947 {
2948  FIXME("(%p)->(%p) stub\n", this, obj);
2949  return E_NOTIMPL;
2950 }
2951 
2953 {
2954  FIXME("(%p)->(%p) stub\n", this, spacing);
2955  return E_NOTIMPL;
2956 }
2957 
2958 HRESULT STDMETHODCALLTYPE CDefView::SetCallback(IShellFolderViewCB *new_cb, IShellFolderViewCB **old_cb)
2959 {
2960  if (old_cb)
2961  *old_cb = m_pShellFolderViewCB.Detach();
2962 
2963  m_pShellFolderViewCB = new_cb;
2964  return S_OK;
2965 }
2966 
2968 {
2969  FIXME("(%p)->(%d) stub\n", this, flags);
2970  return E_NOTIMPL;
2971 }
2972 
2974 {
2975  TRACE("(%p)->(%p)\n", this, support);
2976  return S_OK;
2977 }
2978 
2980 {
2981  FIXME("(%p)->(%p) stub\n", this, disp);
2982  return E_NOTIMPL;
2983 }
2984 
2985 /**********************************************************
2986  * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2987  */
2988 HRESULT WINAPI CDefView::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
2989 {
2990  FIXME("(%p)->(%p(%s) 0x%08x %p %p\n",
2991  this, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
2992 
2993  if (!prgCmds)
2994  return E_INVALIDARG;
2995 
2996  for (UINT i = 0; i < cCmds; i++)
2997  {
2998  FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
2999  prgCmds[i].cmdf = 0;
3000  }
3001 
3002  return OLECMDERR_E_UNKNOWNGROUP;
3003 }
3004 
3005 /**********************************************************
3006  * ISVOleCmdTarget_Exec (IOleCommandTarget)
3007  *
3008  * nCmdID is the OLECMDID_* enumeration
3009  */
3010 HRESULT WINAPI CDefView::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
3011 {
3012  FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
3013  this, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
3014 
3015  if (!pguidCmdGroup)
3016  return OLECMDERR_E_UNKNOWNGROUP;
3017 
3018  if (IsEqualCLSID(*pguidCmdGroup, m_Category))
3019  {
3020  if (nCmdID == FCIDM_SHVIEW_AUTOARRANGE)
3021  {
3022  if (V_VT(pvaIn) != VT_INT_PTR)
3023  return OLECMDERR_E_NOTSUPPORTED;
3024 
3025  TPMPARAMS params;
3026  params.cbSize = sizeof(params);
3027  params.rcExclude = *(RECT*) V_INTREF(pvaIn);
3028 
3029  if (m_hMenuViewModes)
3030  {
3031  /* Duplicate all but the last two items of the view modes menu */
3032  HMENU hmenuViewPopup = CreatePopupMenu();
3033  Shell_MergeMenus(hmenuViewPopup, m_hMenuViewModes, 0, 0, 0xFFFF, 0);
3034  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3035  DeleteMenu(hmenuViewPopup, GetMenuItemCount(hmenuViewPopup) - 1, MF_BYPOSITION);
3036  CheckViewMode(hmenuViewPopup);
3037  TrackPopupMenuEx(hmenuViewPopup, TPM_LEFTALIGN | TPM_TOPALIGN, params.rcExclude.left, params.rcExclude.bottom, m_hWndParent, &params);
3038  ::DestroyMenu(hmenuViewPopup);
3039  }
3040 
3041  // pvaOut is VT_I4 with value 0x403 (cmd id of the new mode maybe?)
3042  V_VT(pvaOut) = VT_I4;
3043  V_I4(pvaOut) = 0x403;
3044  }
3045  }
3046 
3047  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer) &&
3048  (nCmdID == 0x29) &&
3049  (nCmdexecopt == 4) && pvaOut)
3050  return S_OK;
3051 
3052  if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView) &&
3053  (nCmdID == 9) &&
3054  (nCmdexecopt == 0))
3055  return 1;
3056 
3057  return OLECMDERR_E_UNKNOWNGROUP;
3058 }
3059 
3060 /**********************************************************
3061  * ISVDropTarget implementation
3062  */
3063 
3064 /******************************************************************************
3065  * drag_notify_subitem [Internal]
3066  *
3067  * Figure out the shellfolder object, which is currently under the mouse cursor
3068  * and notify it via the IDropTarget interface.
3069  */
3070 
3071 #define SCROLLAREAWIDTH 20
3072 
3074 {
3075  LONG lResult;
3076  HRESULT hr;
3077  RECT clientRect;
3078 
3079  /* The key state on drop doesn't have MK_LBUTTON or MK_RBUTTON because it
3080  reflects the key state after the user released the button, so we need
3081  to remember the last key state when the button was pressed */
3082  m_grfKeyState = grfKeyState;
3083 
3084  /* Map from global to client coordinates and query the index of the listview-item, which is
3085  * currently under the mouse cursor. */
3086  LVHITTESTINFO htinfo = {{pt.x, pt.y}, LVHT_ONITEM};
3087  ScreenToClient(&htinfo.pt);
3088  lResult = m_ListView.HitTest(&htinfo);
3089 
3090  /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
3091  ::GetClientRect(m_ListView, &clientRect);
3092  if (htinfo.pt.x == m_ptLastMousePos.x && htinfo.pt.y == m_ptLastMousePos.y &&
3093  (htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
3094  htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
3095  {
3096  m_cScrollDelay = (m_cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
3097  if (m_cScrollDelay == 0)
3098  {
3099  /* Mouse did hover another 250 ms over the scroll-area */
3100  if (htinfo.pt.x < SCROLLAREAWIDTH)
3101  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEUP, 0);
3102 
3103  if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
3104  m_ListView.SendMessageW(WM_HSCROLL, SB_LINEDOWN, 0);
3105 
3106  if (htinfo.pt.y < SCROLLAREAWIDTH)
3107  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEUP, 0);
3108 
3109  if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
3110  m_ListView.SendMessageW(WM_VSCROLL, SB_LINEDOWN, 0);
3111  }
3112  }
3113  else
3114  {
3115  m_cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
3116  }
3117 
3118  m_ptLastMousePos = htinfo.pt;
3119 
3120  /* We need to check if we drag the selection over itself */
3121  if (lResult != -1 && m_pSourceDataObject.p != NULL)
3122  {
3123  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3124 
3125  for (UINT i = 0; i < m_cidl; i++)
3126  {
3127  if (pidl == m_apidl[i])
3128  {
3129  /* The item that is being draged is hovering itself. */
3130  lResult = -1;
3131  break;
3132  }
3133  }
3134  }
3135 
3136  /* If we are still over the previous sub-item, notify it via DragOver and return. */
3137  if (m_pCurDropTarget && lResult == m_iDragOverItem)
3138  return m_pCurDropTarget->DragOver(grfKeyState, pt, pdwEffect);
3139 
3140  /* We've left the previous sub-item, notify it via DragLeave and Release it. */
3141  if (m_pCurDropTarget)
3142  {
3144  if (pidl)
3145  SelectItem(pidl, 0);
3146 
3147  m_pCurDropTarget->DragLeave();
3149  }
3150 
3151  m_iDragOverItem = lResult;
3152 
3153  if (lResult == -1)
3154  {
3155  /* We are not above one of the listview's subitems. Bind to the parent folder's
3156  * DropTarget interface. */
3157  hr = m_pSFParent->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget,&m_pCurDropTarget));
3158  }
3159  else
3160  {
3161  /* Query the relative PIDL of the shellfolder object represented by the currently
3162  * dragged over listview-item ... */
3163  PCUITEMID_CHILD pidl = _PidlByItem(lResult);
3164 
3165  /* ... and bind m_pCurDropTarget to the IDropTarget interface of an UIObject of this object */
3166  hr = m_pSFParent->GetUIObjectOf(m_ListView, 1, &pidl, IID_NULL_PPV_ARG(IDropTarget, &m_pCurDropTarget));
3167  }
3168 
3170 
3171  /* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
3172  if (FAILED(hr))
3173  {
3174  *pdwEffect = DROPEFFECT_NONE;
3175  return hr;
3176  }
3177 
3178  if (m_iDragOverItem != -1)
3179  {
3180  SelectItem(m_iDragOverItem, SVSI_SELECT);
3181  }
3182 
3183  /* Notify the item just entered via DragEnter. */
3184  return m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
3185 }
3186 
3187 HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3188 {
3189  /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
3190  m_pCurDataObject = pDataObject;
3191 
3192  HRESULT hr = drag_notify_subitem(grfKeyState, pt, pdwEffect);
3193  if (SUCCEEDED(hr))
3194  {
3195  POINT ptClient = {pt.x, pt.y};
3196  ScreenToClient(&ptClient);
3197  ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
3198  }
3199 
3200  return hr;
3201 }
3202 
3204 {
3205  POINT ptClient = {pt.x, pt.y};
3206  ScreenToClient(&ptClient);
3207  ImageList_DragMove(ptClient.x, ptClient.y);
3208  return drag_notify_subitem(grfKeyState, pt, pdwEffect);
3209 }
3210 
3212 {
3214 
3215  if (m_pCurDropTarget)
3216  {
3217  m_pCurDropTarget->DragLeave();
3219  }
3220 
3221  if (m_pCurDataObject != NULL)
3222  {
3224  }
3225 
3226  m_iDragOverItem = 0;
3227 
3228  return S_OK;
3229 }
3230 
3231 HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
3232 {
3235 
3236  if ((IsDropOnSource(NULL) == S_OK) &&
3237  (*pdwEffect & DROPEFFECT_MOVE) &&
3239  {
3240  if (m_pCurDropTarget)
3241  {
3242  m_pCurDropTarget->DragLeave();
3244  }
3245 
3246  /* Restore the selection */
3248  for (UINT i = 0 ; i < m_cidl; i++)
3249  SelectItem(m_apidl[i], SVSI_SELECT);
3250 
3251  /* Reposition the items */
3252  int lvIndex = -1;
3253  while ((lvIndex = m_ListView.GetNextItem(lvIndex, LVNI_SELECTED)) > -1)
3254  {
3255  POINT ptItem;
3256  if (m_ListView.GetItemPosition(lvIndex, &ptItem))
3257  {
3258  ptItem.x += pt.x - m_ptFirstMousePos.x;
3259  ptItem.y += pt.y - m_ptFirstMousePos.y;
3260  m_ListView.SetItemPosition(lvIndex, &ptItem);
3261  }
3262  }
3263  }
3264  else if (m_pCurDropTarget)
3265  {
3266  m_pCurDropTarget->Drop(pDataObject, grfKeyState, pt, pdwEffect);
3268  }
3269 
3271  m_iDragOverItem = 0;
3272  return S_OK;
3273 }
3274 
3275 /**********************************************************
3276  * ISVDropSource implementation
3277  */
3278 
3280 {
3281  TRACE("(%p)\n", this);
3282 
3283  if (fEscapePressed)
3284  return DRAGDROP_S_CANCEL;
3285  else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
3286  return DRAGDROP_S_DROP;
3287  else
3288  return S_OK;
3289 }
3290 
3292 {
3293  TRACE("(%p)\n", this);
3294 
3296 }
3297 
3298 /**********************************************************
3299  * ISVViewObject implementation
3300  */
3301 
3302 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)
3303 {
3304  FIXME("Stub: this=%p\n", this);
3305 
3306  return E_NOTIMPL;
3307 }
3308 
3309 HRESULT WINAPI CDefView::GetColorSet(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDevice, LOGPALETTE **ppColorSet)
3310 {
3311  FIXME("Stub: this=%p\n", this);
3312 
3313  return E_NOTIMPL;
3314 }
3315 
3316 HRESULT WINAPI CDefView::Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
3317 {
3318  FIXME("Stub: this=%p\n", this);
3319 
3320  return E_NOTIMPL;
3321 }
3322 
3324 {
3325  FIXME("Stub: this=%p\n", this);
3326 
3327  return E_NOTIMPL;
3328 }
3329 
3331 {
3332  FIXME("partial stub: %p 0x%08x 0x%08x %p\n", this, aspects, advf, pAdvSink);
3333 
3334  /* FIXME: we set the AdviseSink, but never use it to send any advice */
3335  m_pAdvSink = pAdvSink;
3336  m_dwAspects = aspects;
3337  m_dwAdvf = advf;
3338 
3339  return S_OK;
3340 }
3341 
3342 HRESULT WINAPI CDefView::GetAdvise(DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
3343 {
3344  TRACE("this=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n", this, pAspects, pAdvf, ppAdvSink);
3345 
3346  if (ppAdvSink)
3347  {
3348  *ppAdvSink = m_pAdvSink;
3349  m_pAdvSink.p->AddRef();
3350  }
3351 
3352  if (pAspects)
3353  *pAspects = m_dwAspects;
3354 
3355  if (pAdvf)
3356  *pAdvf = m_dwAdvf;
3357 
3358  return S_OK;
3359 }
3360 
3362 {
3363  if (IsEqualIID(guidService, SID_IShellBrowser))
3364  return m_pShellBrowser->QueryInterface(riid, ppvObject);
3365  else if(IsEqualIID(guidService, SID_IFolderView))
3366  return QueryInterface(riid, ppvObject);
3367 
3368  return E_NOINTERFACE;
3369 }
3370 
3372 {
3374  HRESULT hr = S_OK;
3375 
3376  hr = IUnknown_QueryService(m_pShellBrowser, IID_IExplorerToolbar, IID_PPV_ARG(IExplorerToolbar, &ptb));
3377  if (FAILED(hr))
3378  return hr;
3379 
3380  m_Category = CGID_DefViewFrame;
3381 
3382  hr = ptb->SetCommandTarget(static_cast<IOleCommandTarget*>(this), &m_Category, 0);
3383  if (FAILED(hr))
3384  return hr;
3385 
3386  if (hr == S_FALSE)
3387  return S_OK;
3388 
3389 #if 0
3390  hr = ptb->AddButtons(&m_Category, buttonsCount, buttons);
3391  if (FAILED(hr))
3392  return hr;
3393 #endif
3394 
3395  return S_OK;
3396 }
3397 
3398 // The default processing of IShellFolderView callbacks
3400 {
3401  // TODO: SFVM_GET_CUSTOMVIEWINFO, SFVM_WINDOWCREATED
3402  TRACE("CDefView::DefMessageSFVCB uMsg=%u\n", uMsg);
3403  return E_NOTIMPL;
3404 }
3405 
3407 {
3408  HRESULT hr = E_NOTIMPL;
3409 
3411  {
3412  hr = m_pShellFolderViewCB->MessageSFVCB(uMsg, wParam, lParam);
3413  }
3414 
3415  if (hr == E_NOTIMPL)
3416  {
3417  hr = DefMessageSFVCB(uMsg, wParam, lParam);
3418  }
3419 
3420  return hr;
3421 }
3422 
3424 {
3425  return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
3426 }
3427 
3429  LPCSFV psvcbi, /* [in] shelltemplate struct */
3430  IShellView **ppsv) /* [out] IShellView pointer */
3431 {
3432  CComPtr<IShellView> psv;
3433  HRESULT hRes;
3434 
3435  TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
3436  psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
3437  psvcbi->fvm, psvcbi->psvOuter);
3438 
3439  *ppsv = NULL;
3440  hRes = CDefView_CreateInstance(psvcbi->pshf, IID_PPV_ARG(IShellView, &psv));
3441  if (FAILED_UNEXPECTEDLY(hRes))
3442  return hRes;
3443 
3444  *ppsv = psv.Detach();
3445  return hRes;
3446 }
3447 
3449  IShellView **ppsv)
3450 {
3451  CComPtr<IShellView> psv;
3452  HRESULT hRes;
3453 
3454  if (!ppsv)
3455  return E_INVALIDARG;
3456 
3457  *ppsv = NULL;
3458 
3459  if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv))
3460  return E_INVALIDARG;
3461 
3462  TRACE("sf=%p outer=%p callback=%p\n",
3463  pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
3464 
3465  hRes = CDefView_CreateInstance(pcsfv->pshf, IID_PPV_ARG(IShellView, &psv));
3466  if (FAILED(hRes))
3467  return hRes;
3468 
3469  if (pcsfv->psfvcb)
3470  {
3472  if (SUCCEEDED(psv->QueryInterface(IID_PPV_ARG(IShellFolderView, &sfv))))
3473  {
3474  sfv->SetCallback(pcsfv->psfvcb, NULL);
3475  }
3476  }
3477 
3478  *ppsv = psv.Detach();
3479  return hRes;
3480 }
#define SHCNE_MKDIR
Definition: shlobj.h:1723
HRESULT FillViewMenu()
Definition: CDefView.cpp:1244
#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:3423
ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, int fSources, LONG wEventMask, UINT uMsg, int cItems, SHChangeNotifyEntry *lpItems)
Definition: changenotify.c:215
HRESULT FillEditMenu()
Definition: CDefView.cpp:1227
POINT m_ptFirstMousePos
Definition: CDefView.cpp:104
#define FCIDM_SHVIEW_UNDO
Definition: shresdef.h:738
virtual HRESULT STDMETHODCALLTYPE SetItemPos(PCUITEMID_CHILD pidl, POINT *pt)
Definition: CDefView.cpp:2928
int LV_FindItemByPidl(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:774
HRESULT FillArrangeAsMenu(HMENU hmenuArrange)
Definition: CDefView.cpp:1260
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:3330
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
virtual HRESULT STDMETHODCALLTYPE DestroyViewWindow()
Definition: CDefView.cpp:2299
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:3113
int iImage
Definition: commctrl.h:2339
#define FCIDM_SHVIEW_INVERTSELECTION
Definition: shresdef.h:743
int LV_AddItem(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:794
#define FCIDM_SHVIEW_LISTVIEW
Definition: shresdef.h:747
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:1724
#define FCIDM_TB_REPORTVIEW
Definition: shresdef.h:766
UINT m_cScrollDelay
Definition: CDefView.cpp:102
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3203
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:2613
virtual HRESULT STDMETHODCALLTYPE Refresh()
Definition: CDefView.cpp:2283
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:1939
#define LVN_BEGINDRAG
Definition: commctrl.h:3112
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)
#define LVSIL_SMALL
Definition: commctrl.h:2271
virtual HRESULT STDMETHODCALLTYPE Select(UINT flags)
Definition: CDefView.cpp:2967
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CDefView.cpp:3361
long y
Definition: polytest.cpp:48
#define FCIDM_SHVIEW_SNAPTOGRID
Definition: shresdef.h:751
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define ERROR_SUCCESS
Definition: deptool.c:10
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:1365
LRESULT OnPrintClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1068
#define FCIDM_SHVIEW_AUTOARRANGE
Definition: shresdef.h:750
#define IDS_OBJECTS_SELECTED
Definition: shresdef.h:245
HRESULT hr
Definition: shlfolder.c:183
GLint x0
Definition: linetemp.h:95
static HMENU hmenu
Definition: win.c:66
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1276
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:2445
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2027
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2239
virtual HRESULT STDMETHODCALLTYPE CreateViewWindow2(LPSV2CVW2_PARAMS view_params)
Definition: CDefView.cpp:2678
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:1199
#define FCIDM_MENU_VIEW_SEP_OPTIONS
Definition: shlobj.h:551
virtual HRESULT STDMETHODCALLTYPE MoveIcons(IDataObject *obj)
Definition: CDefView.cpp:2922
struct LISTVIEW_SORT_INFO * LPLISTVIEW_SORT_INFO
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1622
#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:2869
#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:2027
#define LVS_REPORT
Definition: commctrl.h:2234
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:1631
#define LVN_GETDISPINFOA
Definition: commctrl.h:3125
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define TPM_RETURNCMD
Definition: winuser.h:2362
#define _countof(array)
Definition: fontsub.cpp:30
_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:2672
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:44
Definition: shlobj.h:1192
LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1004
#define LVN_ITEMCHANGED
Definition: commctrl.h:3103
#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:761
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1737
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
IShellBrowser * psbOwner
Definition: shobjidl.idl:784
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:1745
#define MF_STRING
Definition: winuser.h:138
#define CLR_INVALID
Definition: wingdi.h:882
#define GetRValue(rgb)
Definition: wingdi.h:2930
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:292
static INT CALLBACK ListViewCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
Definition: CDefView.cpp:711
#define LVN_GETDISPINFOW
Definition: commctrl.h:3126
HANDLE HWND
Definition: compat.h:13
IShellView * psvOuter
Definition: shlobj.h:1275
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
virtual HRESULT STDMETHODCALLTYPE GetDefaultSpacing(POINT *ppt)
Definition: CDefView.cpp:2608
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:2479
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define LVIS_CUT
Definition: commctrl.h:2292
#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:709
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:499
WPARAM wParam
Definition: winuser.h:3090
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1655
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:309
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define COLOR_DESKTOP
Definition: winuser.h:904
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:560
#define LVHT_ONITEM
Definition: commctrl.h:2469
virtual HRESULT STDMETHODCALLTYPE Item(int iItemIndex, PITEMID_CHILD *ppidl)
Definition: CDefView.cpp:2531
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:2396
UINT_PTR WPARAM
Definition: windef.h:207
HRESULT FillFileMenu()
Definition: CDefView.cpp:1193
#define WS_CHILD
Definition: pedump.c:617
HMENU m_hMenu
Definition: CDefView.cpp:82
virtual HRESULT STDMETHODCALLTYPE Rearrange(LPARAM sort)
Definition: CDefView.cpp:2780
LONG left
Definition: windef.h:291
virtual HRESULT STDMETHODCALLTYPE GetSpacing(POINT *ppt)
Definition: CDefView.cpp:2589
virtual HRESULT STDMETHODCALLTYPE GetItemObject(UINT uItem, REFIID riid, void **ppv)
Definition: CDefView.cpp:2417
UINT uFlags
Definition: api.c:60
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2391
int GetItemCount()
Definition: rosctrls.h:121
#define WS_CLIPCHILDREN
Definition: pedump.c:619
virtual HRESULT STDMETHODCALLTYPE GetFocusedItem(int *piItem)
Definition: CDefView.cpp:2570
virtual HRESULT STDMETHODCALLTYPE RemoveObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2818
#define SID_IFolderView
virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable)
Definition: CDefView.cpp:2239
LONG right
Definition: windef.h:293
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1720
#define HDITEM
Definition: commctrl.h:682
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3448
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:410
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:56
#define FCIDM_SHVIEW_PROPERTIES
Definition: shresdef.h:734
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:642
virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(MSG *pmsg)
Definition: CDefView.cpp:2223
DWORD WINAPI GetSysColor(_In_ int)
POINTL point
Definition: edittest.c:50
WPARAM wParam
Definition: combotst.c:138
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2242
#define SFVM_GET_CUSTOMVIEWINFO
#define FCIDM_MENU_EDIT
Definition: shlobj.h:549
UINT stateMask
Definition: commctrl.h:2336
#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:2812
struct tagNMHDR * LPNMHDR
#define SFVM_SIZE
Definition: shlobj.h:1255
#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:3211
CComPtr< IShellFolder2 > m_pSF2Parent
Definition: CDefView.cpp:74
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CDefView.cpp:3231
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:63
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
#define FCIDM_SHVIEW_INSERTLINK
Definition: shresdef.h:739
SHELLVIEWID const * pvid
Definition: shobjidl.idl:786
UINT code
Definition: winuser.h:3133
virtual HRESULT STDMETHODCALLTYPE UIActivate(UINT uState)
Definition: CDefView.cpp:2246
#define GetGValue(rgb)
Definition: wingdi.h:2931
#define FCIDM_SHVIEW_REFRESH
Definition: shresdef.h:759
#define FCIDM_BROWSERLAST
Definition: shlobj.h:541
IShellView * psvOuter
Definition: shlobj.h:1196
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:1771
#define FCIDM_SHVIEW_ARRANGE
Definition: shresdef.h:731
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:52
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:2765
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1744
long LONG
Definition: pedump.c:60
CComPtr< IDataObject > m_pCurDataObject
Definition: CDefView.cpp:100
#define LVN_ITEMACTIVATE
Definition: commctrl.h:3119
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:737
LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:2140
#define MF_BYPOSITION
Definition: winuser.h:203
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
int iSubItem
Definition: commctrl.h:2334
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:4333
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:690
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1358
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
LPARAM lParam
Definition: commctrl.h:2340
#define FIXME(fmt,...)
Definition: debug.h:110
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:736
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:2252
ULONG Release()
#define TB_ENABLEBUTTON
Definition: commctrl.h:1014
#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:1632
HRESULT CheckViewMode(HMENU hmenuView)
Definition: CDefView.cpp:1291
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:1765
smooth NULL
Definition: ftsmooth.c:416
HRESULT InvokeContextMenuCommand(UINT uCommand)
Definition: CDefView.cpp:1340
#define LVIS_SELECTED
Definition: commctrl.h:2291
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:3428
HRESULT DefMessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CDefView.cpp:3399
LONG cx
Definition: windef.h:319
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define LVS_AUTOARRANGE
Definition: commctrl.h:2244
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:3279
#define IDS_OBJECTS
Definition: shresdef.h:244
virtual HRESULT STDMETHODCALLTYPE AddObject(PITEMID_CHILD pidl, UINT *item)
Definition: CDefView.cpp:2805
#define LVNI_FOCUSED
Definition: commctrl.h:2395
#define SCROLLAREAWIDTH
Definition: CDefView.cpp:3071
#define CLR_NONE
Definition: commctrl.h:304
HRESULT _MergeToolbar()
Definition: CDefView.cpp:3371
FOLDERVIEWMODE
Definition: shobjidl.idl:658
#define LVS_LIST
Definition: commctrl.h:2236
#define WS_CHILDWINDOW
Definition: pedump.c:639
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1672
BOOLEAN LV_RenameItem(PCUITEMID_CHILD pidlOld, PCUITEMID_CHILD pidlNew)
Definition: CDefView.cpp:828
#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:2973
virtual HRESULT STDMETHODCALLTYPE Freeze(DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze)
Definition: CDefView.cpp:3316
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:532
#define WM_DESTROY
Definition: winuser.h:1591
UINT GetSelections()
Definition: CDefView.cpp:1312
HWND EditLabel(int i)
Definition: rosctrls.h:151
#define FCIDM_SHVIEW_NEWFOLDER
Definition: shresdef.h:757
#define MIIM_ID
Definition: winuser.h:717
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:3302
SHORT WINAPI GetKeyState(_In_ int)
#define FCIDM_MENU_FILE
Definition: shlobj.h:548
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3108
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3106
#define FCIDM_MENU_VIEW
Definition: shlobj.h:550
virtual HRESULT STDMETHODCALLTYPE SetObjectCount(UINT count, UINT flags)
Definition: CDefView.cpp:2844
#define MF_CHECKED
Definition: winuser.h:132
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
void DoActivate(UINT uState)
Definition: CDefView.cpp:1585
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:2649
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1547
#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:2320
BOOL m_bmenuBarInitialized
Definition: CDefView.cpp:86
virtual HRESULT STDMETHODCALLTYPE GetArrangeParam(LPARAM *sort)
Definition: CDefView.cpp:2786
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:2319
#define FCIDM_SHVIEW_COPY
Definition: shresdef.h:736
SVSI_NOSTATECHANGE typedef UINT SVSIF
Definition: shobjidl.idl:719
#define WM_SIZE
Definition: winuser.h:1593
LISTVIEW_SORT_INFO m_sortInfo
Definition: CDefView.cpp:91
#define SFVM_WINDOWCREATED
Definition: shlobj.h:1226
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define NM_SETFOCUS
Definition: commctrl.h:135
#define END_MSG_MAP()
Definition: atlwin.h:1789
BOOL SetTextBkColor(COLORREF cr)
Definition: rosctrls.h:32
DWORD COLORREF
Definition: windef.h:285
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:748
LPWSTR pszText
Definition: commctrl.h:2337
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define WM_NCDESTROY
Definition: winuser.h:1666
#define FCIDM_SHVIEW_VIEW
Definition: shresdef.h:732
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define MAX_PATH
Definition: compat.h:26
BOOL UpdateWindow()
Definition: atlwin.h:1277
#define WINAPI
Definition: msvc.h:8
#define SHCNRF_ShellLevel
Definition: shlobj.h:1766
#define LVIF_IMAGE
Definition: commctrl.h:2282
virtual HRESULT STDMETHODCALLTYPE GetCurrentViewMode(UINT *pViewMode)
Definition: CDefView.cpp:2468
LPCITEMIDLIST pidl
Definition: shlobj.h:1197
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2352
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
UINT GetSelectedCount()
Definition: rosctrls.h:136
#define LVS_SINGLESEL
Definition: commctrl.h:2238
unsigned short WORD
Definition: ntddk_ex.h:93
#define HDF_SORTDOWN
Definition: commctrl.h:710
#define LVN_DELETEITEM
Definition: commctrl.h:3105
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM LPFNSVADDPROPSHEETPAGE
Definition: shobjidl.idl:117
LONG m_iDragOverItem
Definition: CDefView.cpp:101
#define WM_KEYLAST
Definition: winuser.h:1710
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
virtual HRESULT STDMETHODCALLTYPE AutoArrange()
Definition: CDefView.cpp:2798
virtual HRESULT STDMETHODCALLTYPE SetClipboard(BOOL move)
Definition: CDefView.cpp:2940
UINT GetItemState(int i, UINT mask)
Definition: rosctrls.h:173
#define HDN_ENDTRACKW
Definition: commctrl.h:835
#define CDRF_DODEFAULT
Definition: commctrl.h:253
HRESULT IncludeObject(PCUITEMID_CHILD pidl)
Definition: CDefView.cpp:425
#define CONTEXT_MENU_BASE_ID
Definition: CDefView.cpp:58
void CheckToolbar()
Definition: CDefView.cpp:472
#define IDA_SHELLVIEW
Definition: shresdef.h:25
ULONG AddRef()
GLbitfield flags
Definition: glext.h:7161
POINT m_ptLastMousePos
Definition: CDefView.cpp:103
#define LVS_ICON
Definition: commctrl.h:2233
UINT mask
Definition: commctrl.h:2332
#define FCIDM_SHVIEW_DELETE
Definition: shresdef.h:733
virtual HRESULT STDMETHODCALLTYPE GetSelectionMarkedItem(int *piItem)
Definition: CDefView.cpp:2561
const GUID IID_IDispatch
static const WCHAR sd[]
Definition: suminfo.c:287
LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: CDefView.cpp:1116
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
int ret
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
BOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:638
BOOL ScreenToClient(LPPOINT lpPoint) const
Definition: atlwin.h:1024
virtual HRESULT STDMETHODCALLTYPE IsDropOnSource(IDropTar