msacm32/tests: Make acm_driver_func() static.
[wine.git] / dlls / shell32 / shlview.c
blob45601621349cc7b3ef41320e9b80dcc962bc91cb
1 /*
2 * ShellView
4 * Copyright 1998,1999 <juergen.schmied@debitel.net>
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.
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.
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.
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
23 * FIXME: The order by part of the background context menu should be
24 * built according to the columns shown.
26 * FIXME: Load/Save the view state from/into the stream provided by
27 * the ShellBrowser
29 * FIXME: CheckToolbar: handle the "new folder" and "folder up" button
31 * FIXME: ShellView_FillList: consider sort orders
33 * FIXME: implement the drag and drop in the old (msg-based) way
35 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
36 * Release() ???
39 #include "config.h"
40 #include "wine/port.h"
42 #include <stdarg.h>
43 #include <stdlib.h>
44 #include <string.h>
46 #define COBJMACROS
47 #define NONAMELESSUNION
49 #include "windef.h"
50 #include "winerror.h"
51 #include "winbase.h"
52 #include "winnls.h"
53 #include "objbase.h"
54 #include "servprov.h"
55 #include "shlguid.h"
56 #include "wingdi.h"
57 #include "winuser.h"
58 #include "shlobj.h"
59 #include "shobjidl.h"
60 #include "undocshell.h"
61 #include "shresdef.h"
62 #include "wine/debug.h"
64 #include "docobj.h"
65 #include "pidl.h"
66 #include "shell32_main.h"
67 #include "shellfolder.h"
69 WINE_DEFAULT_DEBUG_CHANNEL(shell);
71 static const WCHAR SV_CLASS_NAME[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0};
73 typedef struct
74 { BOOL bIsAscending;
75 INT nHeaderID;
76 INT nLastHeaderID;
77 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
79 typedef struct
81 IShellView3 IShellView3_iface;
82 IOleCommandTarget IOleCommandTarget_iface;
83 IDropTarget IDropTarget_iface;
84 IDropSource IDropSource_iface;
85 IViewObject IViewObject_iface;
86 IFolderView2 IFolderView2_iface;
87 IShellFolderView IShellFolderView_iface;
88 IShellFolderViewDual3 IShellFolderViewDual3_iface;
89 LONG ref;
90 IShellFolder* pSFParent;
91 IShellFolder2* pSF2Parent;
92 IShellBrowser* pShellBrowser;
93 ICommDlgBrowser* pCommDlgBrowser;
94 HWND hWnd; /* SHELLDLL_DefView */
95 HWND hWndList; /* ListView control */
96 HWND hWndParent;
97 FOLDERSETTINGS FolderSettings;
98 HMENU hMenu;
99 UINT uState;
100 UINT cidl;
101 LPITEMIDLIST *apidl;
102 LISTVIEW_SORT_INFO ListViewSortInfo;
103 ULONG hNotify; /* change notification handle */
104 HANDLE hAccel;
105 DWORD dwAspects;
106 DWORD dwAdvf;
107 IAdviseSink *pAdvSink;
108 IDropTarget* pCurDropTarget; /* The sub-item, which is currently dragged over */
109 IDataObject* pCurDataObject; /* The dragged data-object */
110 LONG iDragOverItem; /* Dragged over item's index, iff pCurDropTarget != NULL */
111 UINT cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
112 POINT ptLastMousePos; /* Mouse position at last DragOver call */
113 } IShellViewImpl;
115 static inline IShellViewImpl *impl_from_IShellView3(IShellView3 *iface)
117 return CONTAINING_RECORD(iface, IShellViewImpl, IShellView3_iface);
120 static inline IShellViewImpl *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
122 return CONTAINING_RECORD(iface, IShellViewImpl, IOleCommandTarget_iface);
125 static inline IShellViewImpl *impl_from_IDropTarget(IDropTarget *iface)
127 return CONTAINING_RECORD(iface, IShellViewImpl, IDropTarget_iface);
130 static inline IShellViewImpl *impl_from_IDropSource(IDropSource *iface)
132 return CONTAINING_RECORD(iface, IShellViewImpl, IDropSource_iface);
135 static inline IShellViewImpl *impl_from_IViewObject(IViewObject *iface)
137 return CONTAINING_RECORD(iface, IShellViewImpl, IViewObject_iface);
140 static inline IShellViewImpl *impl_from_IFolderView2(IFolderView2 *iface)
142 return CONTAINING_RECORD(iface, IShellViewImpl, IFolderView2_iface);
145 static inline IShellViewImpl *impl_from_IShellFolderView(IShellFolderView *iface)
147 return CONTAINING_RECORD(iface, IShellViewImpl, IShellFolderView_iface);
150 static inline IShellViewImpl *impl_from_IShellFolderViewDual3(IShellFolderViewDual3 *iface)
152 return CONTAINING_RECORD(iface, IShellViewImpl, IShellFolderViewDual3_iface);
155 /* ListView Header IDs */
156 #define LISTVIEW_COLUMN_NAME 0
157 #define LISTVIEW_COLUMN_SIZE 1
158 #define LISTVIEW_COLUMN_TYPE 2
159 #define LISTVIEW_COLUMN_TIME 3
160 #define LISTVIEW_COLUMN_ATTRIB 4
162 /*menu items */
163 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
164 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
165 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
167 #define ID_LISTVIEW 1
169 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
171 /*windowsx.h */
172 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
173 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
174 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
177 Items merged into the toolbar and the filemenu
179 typedef struct
180 { int idCommand;
181 int iImage;
182 int idButtonString;
183 int idMenuString;
184 BYTE bState;
185 BYTE bStyle;
186 } MYTOOLINFO, *LPMYTOOLINFO;
188 static const MYTOOLINFO Tools[] =
190 { FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, BTNS_BUTTON },
191 { FCIDM_SHVIEW_SMALLICON, 0, 0, IDS_VIEW_SMALL, TBSTATE_ENABLED, BTNS_BUTTON },
192 { FCIDM_SHVIEW_LISTVIEW, 0, 0, IDS_VIEW_LIST, TBSTATE_ENABLED, BTNS_BUTTON },
193 { FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, BTNS_BUTTON },
194 { -1, 0, 0, 0, 0, 0}
197 typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
199 /**********************************************************
201 * ##### helperfunctions for communication with ICommDlgBrowser #####
203 static BOOL IsInCommDlg(IShellViewImpl * This)
205 return This->pCommDlgBrowser != NULL;
208 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
210 HRESULT ret = S_OK;
212 if (IsInCommDlg(This))
214 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
215 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView *)&This->IShellView3_iface, pidl);
216 TRACE("-- returns 0x%08x\n", ret);
219 return ret;
222 static HRESULT OnDefaultCommand(IShellViewImpl * This)
224 HRESULT ret = S_FALSE;
226 if (IsInCommDlg(This))
228 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
229 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView *)&This->IShellView3_iface);
230 TRACE("-- returns 0x%08x\n", ret);
233 return ret;
236 static HRESULT OnStateChange(IShellViewImpl * This, UINT change)
238 HRESULT ret = S_FALSE;
240 if (IsInCommDlg(This))
242 TRACE("ICommDlgBrowser::OnStateChange change=%d\n", change);
243 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView *)&This->IShellView3_iface, change);
244 TRACE("-- returns 0x%08x\n", ret);
247 return ret;
250 /**********************************************************
251 * set the toolbar of the filedialog buttons
253 * - activates the buttons from the shellbrowser according to
254 * the view state
256 static void CheckToolbar(IShellViewImpl * This)
258 LRESULT result;
260 TRACE("\n");
262 if (IsInCommDlg(This))
264 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
265 FCIDM_TB_SMALLICON, This->FolderSettings.ViewMode == FVM_LIST, &result);
266 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
267 FCIDM_TB_REPORTVIEW, This->FolderSettings.ViewMode == FVM_DETAILS, &result);
268 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
269 FCIDM_TB_SMALLICON, TRUE, &result);
270 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
271 FCIDM_TB_REPORTVIEW, TRUE, &result);
275 /**********************************************************
277 * ##### helperfunctions for initializing the view #####
279 /**********************************************************
280 * change the style of the listview control
282 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
284 DWORD tmpstyle;
286 TRACE("(%p)\n", This);
288 tmpstyle = GetWindowLongW(This->hWndList, GWL_STYLE);
289 SetWindowLongW(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
292 static DWORD ViewModeToListStyle(UINT ViewMode)
294 DWORD dwStyle;
296 TRACE("%d\n", ViewMode);
298 switch (ViewMode)
300 case FVM_ICON: dwStyle = LVS_ICON; break;
301 case FVM_DETAILS: dwStyle = LVS_REPORT; break;
302 case FVM_SMALLICON: dwStyle = LVS_SMALLICON; break;
303 case FVM_LIST: dwStyle = LVS_LIST; break;
304 default:
306 FIXME("ViewMode %d not implemented\n", ViewMode);
307 dwStyle = LVS_LIST;
308 break;
312 return dwStyle;
315 /**********************************************************
316 * ShellView_CreateList()
318 * - creates the list view window
320 static BOOL ShellView_CreateList (IShellViewImpl * This)
321 { DWORD dwStyle, dwExStyle;
323 TRACE("%p\n",This);
325 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
326 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
327 dwExStyle = WS_EX_CLIENTEDGE;
329 dwStyle |= ViewModeToListStyle(This->FolderSettings.ViewMode);
331 if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
332 if (This->FolderSettings.fFlags & FWF_DESKTOP)
333 This->FolderSettings.fFlags |= FWF_NOCLIENTEDGE | FWF_NOSCROLL;
334 if (This->FolderSettings.fFlags & FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
335 if (This->FolderSettings.fFlags & FWF_NOCLIENTEDGE)
336 dwExStyle &= ~WS_EX_CLIENTEDGE;
338 This->hWndList=CreateWindowExW( dwExStyle,
339 WC_LISTVIEWW,
340 NULL,
341 dwStyle,
342 0,0,0,0,
343 This->hWnd,
344 (HMENU)ID_LISTVIEW,
345 shell32_hInstance,
346 NULL);
348 if(!This->hWndList)
349 return FALSE;
351 This->ListViewSortInfo.bIsAscending = TRUE;
352 This->ListViewSortInfo.nHeaderID = -1;
353 This->ListViewSortInfo.nLastHeaderID = -1;
355 if (This->FolderSettings.fFlags & FWF_DESKTOP) {
357 * FIXME: look at the registry value
358 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
359 * and activate drop shadows if necessary
361 if (0)
362 SendMessageW(This->hWndList, LVM_SETTEXTBKCOLOR, 0, CLR_NONE);
363 else
364 SendMessageW(This->hWndList, LVM_SETTEXTBKCOLOR, 0, GetSysColor(COLOR_DESKTOP));
366 SendMessageW(This->hWndList, LVM_SETTEXTCOLOR, 0, RGB(255,255,255));
369 /* UpdateShellSettings(); */
370 return TRUE;
373 /**********************************************************
374 * ShellView_InitList()
376 * - adds all needed columns to the shellview
378 static void ShellView_InitList(IShellViewImpl *This)
380 IShellDetails *details = NULL;
381 HIMAGELIST big_icons, small_icons;
382 LVCOLUMNW lvColumn;
383 SHELLDETAILS sd;
384 WCHAR nameW[50];
385 HRESULT hr;
386 INT i;
388 TRACE("(%p)\n", This);
390 Shell_GetImageLists( &big_icons, &small_icons );
391 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
392 SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)small_icons);
393 SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)big_icons);
395 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
396 lvColumn.pszText = nameW;
398 if (!This->pSF2Parent)
400 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
401 if (hr != S_OK)
403 WARN("IShellFolder2/IShellDetails not supported\n");
404 return;
408 for (i = 0; 1; i++)
410 if (This->pSF2Parent)
411 hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
412 else
413 hr = IShellDetails_GetDetailsOf(details, NULL, i, &sd);
414 if (FAILED(hr)) break;
416 lvColumn.fmt = sd.fmt;
417 lvColumn.cx = sd.cxChar*8; /* chars->pixel */
418 StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
419 SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
422 if (details) IShellDetails_Release(details);
425 /**********************************************************
426 * ShellView_CompareItems()
428 * NOTES
429 * internal, CALLBACK for DSA_Sort
431 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
433 int ret;
434 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
436 if(!lpData) return 0;
438 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
439 TRACE("ret=%i\n",ret);
440 return ret;
443 /*************************************************************************
444 * ShellView_ListViewCompareItems
446 * Compare Function for the Listview (FileOpen Dialog)
448 * PARAMS
449 * lParam1 [I] the first ItemIdList to compare with
450 * lParam2 [I] the second ItemIdList to compare with
451 * lpData [I] The column ID for the header Ctrl to process
453 * RETURNS
454 * A negative value if the first item should precede the second,
455 * a positive value if the first item should follow the second,
456 * or zero if the two items are equivalent
458 * NOTES
459 * FIXME: function does what ShellView_CompareItems is supposed to do.
460 * unify it and figure out how to use the undocumented first parameter
461 * of IShellFolder_CompareIDs to do the job this function does and
462 * move this code to IShellFolder.
463 * make LISTVIEW_SORT_INFO obsolete
464 * the way this function works is only usable if we had only
465 * filesystemfolders (25/10/99 jsch)
467 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
469 INT nDiff=0;
470 FILETIME fd1, fd2;
471 char strName1[MAX_PATH], strName2[MAX_PATH];
472 BOOL bIsFolder1, bIsFolder2,bIsBothFolder;
473 LPITEMIDLIST pItemIdList1 = lParam1;
474 LPITEMIDLIST pItemIdList2 = lParam2;
475 LISTVIEW_SORT_INFO *pSortInfo = (LPLISTVIEW_SORT_INFO) lpData;
478 bIsFolder1 = _ILIsFolder(pItemIdList1);
479 bIsFolder2 = _ILIsFolder(pItemIdList2);
480 bIsBothFolder = bIsFolder1 && bIsFolder2;
482 /* When sorting between a File and a Folder, the Folder gets sorted first */
483 if( (bIsFolder1 || bIsFolder2) && !bIsBothFolder)
485 nDiff = bIsFolder1 ? -1 : 1;
487 else
489 /* Sort by Time: Folders or Files can be sorted */
491 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME)
493 _ILGetFileDateTime(pItemIdList1, &fd1);
494 _ILGetFileDateTime(pItemIdList2, &fd2);
495 nDiff = CompareFileTime(&fd2, &fd1);
497 /* Sort by Attribute: Folder or Files can be sorted */
498 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB)
500 _ILGetFileAttributes(pItemIdList1, strName1, MAX_PATH);
501 _ILGetFileAttributes(pItemIdList2, strName2, MAX_PATH);
502 nDiff = lstrcmpiA(strName1, strName2);
504 /* Sort by FileName: Folder or Files can be sorted */
505 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder)
507 /* Sort by Text */
508 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
509 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
510 nDiff = lstrcmpiA(strName1, strName2);
512 /* Sort by File Size, Only valid for Files */
513 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE)
515 nDiff = (INT)(_ILGetFileSize(pItemIdList1, NULL, 0) - _ILGetFileSize(pItemIdList2, NULL, 0));
517 /* Sort by File Type, Only valid for Files */
518 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TYPE)
520 /* Sort by Type */
521 _ILGetFileType(pItemIdList1, strName1, MAX_PATH);
522 _ILGetFileType(pItemIdList2, strName2, MAX_PATH);
523 nDiff = lstrcmpiA(strName1, strName2);
526 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
528 if(nDiff == 0)
530 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
531 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
532 nDiff = lstrcmpiA(strName1, strName2);
535 if(!pSortInfo->bIsAscending)
537 nDiff = -nDiff;
540 return nDiff;
544 /**********************************************************
545 * LV_FindItemByPidl()
547 static int LV_FindItemByPidl(
548 IShellViewImpl * This,
549 LPCITEMIDLIST pidl)
551 LVITEMW lvItem;
552 lvItem.iSubItem = 0;
553 lvItem.mask = LVIF_PARAM;
554 for(lvItem.iItem = 0;
555 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
556 lvItem.iItem++)
558 LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam;
559 HRESULT hr = IShellFolder_CompareIDs(This->pSFParent, 0, pidl, currentpidl);
560 if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
562 return lvItem.iItem;
565 return -1;
568 /**********************************************************
569 * LV_AddItem()
571 static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl)
573 LVITEMW lvItem;
575 TRACE("(%p)(pidl=%p)\n", This, pidl);
577 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
578 lvItem.iItem = SendMessageW(This->hWndList, LVM_GETITEMCOUNT, 0, 0); /*add the item to the end of the list*/
579 lvItem.iSubItem = 0;
580 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/
581 lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/
582 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
583 return ListView_InsertItemW(This->hWndList, &lvItem) != -1;
586 /**********************************************************
587 * LV_RenameItem()
589 static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew )
591 int nItem;
592 LVITEMW lvItem;
594 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew);
596 nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld));
597 if ( -1 != nItem )
599 lvItem.mask = LVIF_PARAM; /* only the pidl */
600 lvItem.iItem = nItem;
601 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
603 SHFree((LPITEMIDLIST)lvItem.lParam);
604 lvItem.mask = LVIF_PARAM;
605 lvItem.iItem = nItem;
606 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */
607 SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
608 SendMessageW(This->hWndList, LVM_UPDATE, nItem, 0);
609 return TRUE; /* FIXME: better handling */
611 return FALSE;
613 /**********************************************************
614 * ShellView_FillList()
616 * - gets the objectlist from the shellfolder
617 * - sorts the list
618 * - fills the list into the view
621 static INT CALLBACK fill_list( LPVOID ptr, LPVOID arg )
623 LPITEMIDLIST pidl = ptr;
624 IShellViewImpl *This = arg;
625 /* in a commdlg This works as a filemask*/
626 if ( IncludeObject(This, pidl)==S_OK ) LV_AddItem(This, pidl);
627 SHFree(pidl);
628 return TRUE;
631 static HRESULT ShellView_FillList(IShellViewImpl *This)
633 IFolderView2 *folderview = &This->IFolderView2_iface;
634 LPENUMIDLIST pEnumIDList;
635 LPITEMIDLIST pidl;
636 DWORD fetched;
637 HRESULT hr;
638 HDPA hdpa;
640 TRACE("(%p)\n", This);
642 /* get the itemlist from the shfolder*/
643 hr = IShellFolder_EnumObjects(This->pSFParent, This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
644 if (hr != S_OK) return hr;
646 /* create a pointer array */
647 hdpa = DPA_Create(16);
648 if (!hdpa)
650 IEnumIDList_Release(pEnumIDList);
651 return E_OUTOFMEMORY;
654 /* copy the items into the array*/
655 while((S_OK == IEnumIDList_Next(pEnumIDList, 1, &pidl, &fetched)) && fetched)
657 if (DPA_InsertPtr(hdpa, DPA_GetPtrCount(hdpa), pidl) == -1)
659 SHFree(pidl);
663 /* sort the array */
664 DPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
666 IFolderView2_SetRedraw(folderview, FALSE);
667 DPA_DestroyCallback(hdpa, fill_list, This);
668 IFolderView2_SetRedraw(folderview, TRUE);
670 IEnumIDList_Release(pEnumIDList);
672 return S_OK;
675 /**********************************************************
676 * ShellView_OnCreate()
678 static LRESULT ShellView_OnCreate(IShellViewImpl *This)
680 IShellView3 *iface = &This->IShellView3_iface;
681 static const WCHAR accel_nameW[] = {'s','h','v','_','a','c','c','e','l',0};
682 IPersistFolder2 *ppf2;
683 IDropTarget* pdt;
684 HRESULT hr;
686 TRACE("(%p)\n", This);
688 if (ShellView_CreateList(This))
690 ShellView_InitList(This);
691 ShellView_FillList(This);
694 hr = IShellView3_QueryInterface(iface, &IID_IDropTarget, (void**)&pdt);
695 if (hr == S_OK)
697 RegisterDragDrop(This->hWnd, pdt);
698 IDropTarget_Release(pdt);
701 /* register for receiving notifications */
702 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);
703 if (hr == S_OK)
705 LPITEMIDLIST raw_pidl;
706 SHChangeNotifyEntry ntreg;
708 hr = IPersistFolder2_GetCurFolder(ppf2, &raw_pidl);
709 if(SUCCEEDED(hr))
711 LPITEMIDLIST computer_pidl;
712 SHGetFolderLocation(NULL,CSIDL_DRIVES,NULL,0,&computer_pidl);
713 if(ILIsParent(computer_pidl,raw_pidl,FALSE))
715 /* Normalize the pidl to unixfs to workaround an issue with
716 * sending notifications on dos paths
718 WCHAR path[MAX_PATH];
719 SHGetPathFromIDListW(raw_pidl,path);
720 SHParseDisplayName(path,NULL,(LPITEMIDLIST*)&ntreg.pidl,0,NULL);
721 SHFree(raw_pidl);
723 else
724 ntreg.pidl = raw_pidl;
725 ntreg.fRecursive = TRUE;
726 This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNRF_InterruptLevel, SHCNE_ALLEVENTS,
727 SHV_CHANGE_NOTIFY, 1, &ntreg);
728 SHFree((LPITEMIDLIST)ntreg.pidl);
729 SHFree(computer_pidl);
731 IPersistFolder2_Release(ppf2);
734 This->hAccel = LoadAcceleratorsW(shell32_hInstance, accel_nameW);
736 return S_OK;
739 /**********************************************************
740 * #### Handling of the menus ####
743 /**********************************************************
744 * ShellView_BuildFileMenu()
746 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
747 { WCHAR szText[MAX_PATH];
748 MENUITEMINFOW mii;
749 int nTools,i;
750 HMENU hSubMenu;
752 TRACE("(%p)\n",This);
754 hSubMenu = CreatePopupMenu();
755 if(hSubMenu)
756 { /*get the number of items in our global array*/
757 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){}
759 /*add the menu items*/
760 for(i = 0; i < nTools; i++)
762 LoadStringW(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
764 ZeroMemory(&mii, sizeof(mii));
765 mii.cbSize = sizeof(mii);
766 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
768 if(BTNS_SEP != Tools[i].bStyle) /* no separator*/
770 mii.fType = MFT_STRING;
771 mii.fState = MFS_ENABLED;
772 mii.dwTypeData = szText;
773 mii.wID = Tools[i].idCommand;
775 else
777 mii.fType = MFT_SEPARATOR;
779 /* tack This item onto the end of the menu */
780 InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &mii);
783 TRACE("-- return (menu=%p)\n",hSubMenu);
784 return hSubMenu;
786 /**********************************************************
787 * ShellView_MergeFileMenu()
789 static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu)
791 TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
793 if (hSubMenu)
795 static const WCHAR dummyW[] = {'d','u','m','m','y','4','5',0};
796 MENUITEMINFOW mii;
798 /* insert This item at the beginning of the menu */
800 mii.cbSize = sizeof(mii);
801 mii.fMask = MIIM_ID | MIIM_TYPE;
802 mii.wID = 0;
803 mii.fType = MFT_SEPARATOR;
804 InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
806 mii.cbSize = sizeof(mii);
807 mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
808 mii.dwTypeData = (LPWSTR)dummyW;
809 mii.fState = MFS_ENABLED;
810 mii.wID = IDM_MYFILEITEM;
811 mii.fType = MFT_STRING;
812 InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
815 TRACE("--\n");
818 /**********************************************************
819 * ShellView_MergeViewMenu()
822 static void ShellView_MergeViewMenu(IShellViewImpl *This, HMENU hSubMenu)
824 TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
826 /* add a separator at the correct position in the menu */
827 if (hSubMenu)
829 static const WCHAR menuW[] = {'M','E','N','U','_','0','0','1',0};
830 static const WCHAR viewW[] = {'V','i','e','w',0};
831 MENUITEMINFOW mii;
833 memset(&mii, 0, sizeof(mii));
834 mii.cbSize = sizeof(mii);
835 mii.fMask = MIIM_ID | MIIM_TYPE;
836 mii.wID = 0;
837 mii.fType = MFT_SEPARATOR;
838 InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
840 mii.cbSize = sizeof(mii);
841 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
842 mii.fType = MFT_STRING;
843 mii.dwTypeData = (LPWSTR)viewW;
844 mii.hSubMenu = LoadMenuW(shell32_hInstance, menuW);
845 InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
849 /**********************************************************
850 * ShellView_GetSelections()
852 * - fills the this->apidl list with the selected objects
854 * RETURNS
855 * number of selected items
857 static UINT ShellView_GetSelections(IShellViewImpl * This)
859 LVITEMW lvItem;
860 UINT i = 0;
862 SHFree(This->apidl);
864 This->cidl = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
865 This->apidl = SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
867 TRACE("selected=%i\n", This->cidl);
869 if(This->apidl)
871 TRACE("-- Items selected =%u\n", This->cidl);
873 lvItem.mask = LVIF_STATE | LVIF_PARAM;
874 lvItem.stateMask = LVIS_SELECTED;
875 lvItem.iItem = 0;
876 lvItem.iSubItem = 0;
878 while(ListView_GetItemW(This->hWndList, &lvItem) && (i < This->cidl))
880 if(lvItem.state & LVIS_SELECTED)
882 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;
883 i++;
884 TRACE("-- selected Item found\n");
886 lvItem.iItem++;
889 return This->cidl;
893 /**********************************************************
894 * ShellView_OpenSelectedItems()
896 static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
898 static UINT CF_IDLIST = 0;
899 HRESULT hr;
900 IDataObject* selection;
901 FORMATETC fetc;
902 STGMEDIUM stgm;
903 LPIDA pIDList;
904 LPCITEMIDLIST parent_pidl;
905 WCHAR parent_path[MAX_PATH];
906 LPCWSTR parent_dir = NULL;
907 SFGAOF attribs;
908 int i;
910 if (0 == ShellView_GetSelections(This))
912 return S_OK;
914 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
915 (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
916 0, (LPVOID *)&selection);
917 if (FAILED(hr))
918 return hr;
920 if (0 == CF_IDLIST)
922 CF_IDLIST = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
924 fetc.cfFormat = CF_IDLIST;
925 fetc.ptd = NULL;
926 fetc.dwAspect = DVASPECT_CONTENT;
927 fetc.lindex = -1;
928 fetc.tymed = TYMED_HGLOBAL;
930 hr = IDataObject_QueryGetData(selection, &fetc);
931 if (FAILED(hr))
932 return hr;
934 hr = IDataObject_GetData(selection, &fetc, &stgm);
935 if (FAILED(hr))
936 return hr;
938 pIDList = GlobalLock(stgm.u.hGlobal);
940 parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
941 hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &parent_pidl, &attribs);
942 if (SUCCEEDED(hr) && (attribs & SFGAO_FILESYSTEM) &&
943 SHGetPathFromIDListW(parent_pidl, parent_path))
945 parent_dir = parent_path;
948 for (i = pIDList->cidl; i > 0; --i)
950 LPCITEMIDLIST pidl;
952 pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
954 attribs = SFGAO_FOLDER;
955 hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &attribs);
957 if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
959 SHELLEXECUTEINFOW shexinfo;
961 shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
962 shexinfo.fMask = SEE_MASK_INVOKEIDLIST; /* SEE_MASK_IDLIST is also possible. */
963 shexinfo.hwnd = NULL;
964 shexinfo.lpVerb = NULL;
965 shexinfo.lpFile = NULL;
966 shexinfo.lpParameters = NULL;
967 shexinfo.lpDirectory = parent_dir;
968 shexinfo.nShow = SW_NORMAL;
969 shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
971 ShellExecuteExW(&shexinfo); /* Discard error/success info */
973 ILFree(shexinfo.lpIDList);
977 GlobalUnlock(stgm.u.hGlobal);
978 ReleaseStgMedium(&stgm);
980 IDataObject_Release(selection);
982 return S_OK;
985 /**********************************************************
986 * ShellView_DoContextMenu()
988 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault)
989 { UINT uCommand;
990 DWORD wFlags;
991 HMENU hMenu;
992 BOOL fExplore = FALSE;
993 HWND hwndTree = 0;
994 LPCONTEXTMENU pContextMenu = NULL;
995 CMINVOKECOMMANDINFO cmi;
997 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
999 /* look, what's selected and create a context menu object of it*/
1000 if( ShellView_GetSelections(This) )
1002 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, (LPCITEMIDLIST*)This->apidl,
1003 &IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);
1005 if(pContextMenu)
1007 TRACE("-- pContextMenu\n");
1008 hMenu = CreatePopupMenu();
1010 if( hMenu )
1012 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
1013 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
1015 TRACE("-- explore mode\n");
1016 fExplore = TRUE;
1019 /* build the flags depending on what we can do with the selected item */
1020 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
1022 /* let the ContextMenu merge its items in */
1023 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))
1025 if (This->FolderSettings.fFlags & FWF_DESKTOP)
1026 SetMenuDefaultItem(hMenu, FCIDM_SHVIEW_OPEN, MF_BYCOMMAND);
1028 if( bDefault )
1030 TRACE("-- get menu default command\n");
1031 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS);
1033 else
1035 TRACE("-- track popup\n");
1036 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
1039 if(uCommand > 0)
1041 TRACE("-- uCommand=%u\n", uCommand);
1042 if (uCommand==FCIDM_SHVIEW_OPEN && IsInCommDlg(This))
1044 TRACE("-- dlg: OnDefaultCommand\n");
1045 if (OnDefaultCommand(This) != S_OK)
1047 ShellView_OpenSelectedItems(This);
1050 else
1052 TRACE("-- explore -- invoke command\n");
1053 ZeroMemory(&cmi, sizeof(cmi));
1054 cmi.cbSize = sizeof(cmi);
1055 cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */
1056 cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1057 IContextMenu_InvokeCommand(pContextMenu, &cmi);
1060 DestroyMenu(hMenu);
1063 if (pContextMenu)
1064 IContextMenu_Release(pContextMenu);
1067 else /* background context menu */
1069 IContextMenu2 *pCM;
1071 hMenu = CreatePopupMenu();
1073 BackgroundMenu_Constructor(This->pSFParent, FALSE, &IID_IContextMenu2, (void**)&pCM);
1074 IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
1076 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
1077 DestroyMenu(hMenu);
1079 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand);
1081 ZeroMemory(&cmi, sizeof(cmi));
1082 cmi.cbSize = sizeof(cmi);
1083 cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1084 cmi.hwnd = This->hWndParent;
1085 IContextMenu2_InvokeCommand(pCM, &cmi);
1087 IContextMenu2_Release(pCM);
1091 /**********************************************************
1092 * ##### message handling #####
1095 /**********************************************************
1096 * ShellView_OnSize()
1098 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight)
1100 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight);
1102 /*resize the ListView to fit our window*/
1103 if(This->hWndList)
1105 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);
1108 return S_OK;
1110 /**********************************************************
1111 * ShellView_OnDeactivate()
1113 * NOTES
1114 * internal
1116 static void ShellView_OnDeactivate(IShellViewImpl * This)
1118 TRACE("%p\n",This);
1120 if(This->uState != SVUIA_DEACTIVATE)
1122 if(This->hMenu)
1124 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);
1125 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);
1126 DestroyMenu(This->hMenu);
1127 This->hMenu = 0;
1130 This->uState = SVUIA_DEACTIVATE;
1134 /**********************************************************
1135 * ShellView_OnActivate()
1137 static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState)
1139 OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
1140 MENUITEMINFOW mii;
1142 TRACE("(%p) uState=%x\n",This,uState);
1144 /* don't do anything if the state isn't really changing */
1145 if (This->uState == uState) return S_OK;
1147 ShellView_OnDeactivate(This);
1149 /* only do This if we are active */
1150 if (uState != SVUIA_DEACTIVATE)
1152 /* merge the menus */
1153 This->hMenu = CreateMenu();
1155 if (This->hMenu)
1157 static const WCHAR dummyW[] = {'d','u','m','m','y',' ','3','1',0};
1159 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
1160 TRACE("-- after fnInsertMenusSB\n");
1162 mii.cbSize = sizeof(mii);
1163 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
1164 mii.fType = MFT_STRING;
1165 mii.fState = MFS_ENABLED;
1166 mii.wID = 0;
1167 mii.hSubMenu = ShellView_BuildFileMenu(This);
1168 mii.hbmpChecked = NULL;
1169 mii.hbmpUnchecked = NULL;
1170 mii.dwItemData = 0;
1171 /* build the top level menu get the menu item's text */
1172 mii.dwTypeData = (LPWSTR)dummyW;
1173 mii.cch = 0;
1174 mii.hbmpItem = NULL;
1176 /* insert our menu into the menu bar */
1177 if (mii.hSubMenu)
1178 InsertMenuItemW(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
1180 /* get the view menu so we can merge with it */
1181 memset(&mii, 0, sizeof(mii));
1182 mii.cbSize = sizeof(mii);
1183 mii.fMask = MIIM_SUBMENU;
1185 if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
1186 ShellView_MergeViewMenu(This, mii.hSubMenu);
1188 /* add the items that should only be added if we have the focus */
1189 if (SVUIA_ACTIVATE_FOCUS == uState)
1191 /* get the file menu so we can merge with it */
1192 memset(&mii, 0, sizeof(mii));
1193 mii.cbSize = sizeof(mii);
1194 mii.fMask = MIIM_SUBMENU;
1196 if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
1197 ShellView_MergeFileMenu(This, mii.hSubMenu);
1200 TRACE("-- before fnSetMenuSB\n");
1201 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
1204 This->uState = uState;
1205 TRACE("--\n");
1206 return S_OK;
1209 /**********************************************************
1210 * ShellView_OnSetFocus()
1213 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
1215 TRACE("%p\n",This);
1217 /* Tell the browser one of our windows has received the focus. This
1218 should always be done before merging menus (OnActivate merges the
1219 menus) if one of our windows has the focus.*/
1221 IShellBrowser_OnViewWindowActive(This->pShellBrowser, (IShellView *)&This->IShellView3_iface);
1222 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
1224 /* Set the focus to the listview */
1225 SetFocus(This->hWndList);
1227 /* Notify the ICommDlgBrowser interface */
1228 OnStateChange(This,CDBOSC_SETFOCUS);
1230 return 0;
1233 /**********************************************************
1234 * ShellView_OnKillFocus()
1236 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
1238 TRACE("(%p) stub\n",This);
1240 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
1241 /* Notify the ICommDlgBrowser */
1242 OnStateChange(This,CDBOSC_KILLFOCUS);
1244 return 0;
1247 /**********************************************************
1248 * ShellView_OnCommand()
1250 * NOTES
1251 * the CmdIDs are the ones from the context menu
1253 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
1255 TRACE("(%p)->(0x%08x 0x%08x %p) stub\n",This, dwCmdID, dwCmd, hwndCmd);
1257 switch(dwCmdID)
1259 case FCIDM_SHVIEW_SMALLICON:
1260 This->FolderSettings.ViewMode = FVM_SMALLICON;
1261 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
1262 CheckToolbar(This);
1263 break;
1265 case FCIDM_SHVIEW_BIGICON:
1266 This->FolderSettings.ViewMode = FVM_ICON;
1267 SetStyle (This, LVS_ICON, LVS_TYPEMASK);
1268 CheckToolbar(This);
1269 break;
1271 case FCIDM_SHVIEW_LISTVIEW:
1272 This->FolderSettings.ViewMode = FVM_LIST;
1273 SetStyle (This, LVS_LIST, LVS_TYPEMASK);
1274 CheckToolbar(This);
1275 break;
1277 case FCIDM_SHVIEW_REPORTVIEW:
1278 This->FolderSettings.ViewMode = FVM_DETAILS;
1279 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
1280 CheckToolbar(This);
1281 break;
1283 /* the menu IDs for sorting are 0x30... see shell32.rc */
1284 case 0x30:
1285 case 0x31:
1286 case 0x32:
1287 case 0x33:
1288 This->ListViewSortInfo.nHeaderID = dwCmdID - 0x30;
1289 This->ListViewSortInfo.bIsAscending = TRUE;
1290 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1291 SendMessageW(This->hWndList, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems);
1292 break;
1294 default:
1295 TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID);
1297 return 0;
1300 /**********************************************************
1301 * ShellView_OnNotify()
1304 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
1305 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;
1306 NMLVDISPINFOW *lpdi = (NMLVDISPINFOW *)lpnmh;
1307 LPITEMIDLIST pidl;
1309 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);
1311 switch(lpnmh->code)
1313 case NM_SETFOCUS:
1314 TRACE("-- NM_SETFOCUS %p\n",This);
1315 ShellView_OnSetFocus(This);
1316 break;
1318 case NM_KILLFOCUS:
1319 TRACE("-- NM_KILLFOCUS %p\n",This);
1320 ShellView_OnDeactivate(This);
1321 /* Notify the ICommDlgBrowser interface */
1322 OnStateChange(This,CDBOSC_KILLFOCUS);
1323 break;
1325 case NM_CUSTOMDRAW:
1326 TRACE("-- NM_CUSTOMDRAW %p\n",This);
1327 return CDRF_DODEFAULT;
1329 case NM_RELEASEDCAPTURE:
1330 TRACE("-- NM_RELEASEDCAPTURE %p\n",This);
1331 break;
1333 case NM_CLICK:
1334 TRACE("-- NM_CLICK %p\n",This);
1335 break;
1337 case NM_RCLICK:
1338 TRACE("-- NM_RCLICK %p\n",This);
1339 break;
1341 case NM_DBLCLK:
1342 TRACE("-- NM_DBLCLK %p\n",This);
1343 if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
1344 break;
1346 case NM_RETURN:
1347 TRACE("-- NM_RETURN %p\n",This);
1348 if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
1349 break;
1351 case HDN_ENDTRACKW:
1352 TRACE("-- HDN_ENDTRACKW %p\n",This);
1353 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1354 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1355 break;
1357 case LVN_DELETEITEM:
1358 TRACE("-- LVN_DELETEITEM %p\n",This);
1359 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
1360 break;
1362 case LVN_DELETEALLITEMS:
1363 TRACE("-- LVN_DELETEALLITEMS %p\n",This);
1364 return FALSE;
1366 case LVN_INSERTITEM:
1367 TRACE("-- LVN_INSERTITEM (STUB)%p\n",This);
1368 break;
1370 case LVN_ITEMACTIVATE:
1371 TRACE("-- LVN_ITEMACTIVATE %p\n",This);
1372 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1373 break;
1375 case LVN_COLUMNCLICK:
1376 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem;
1377 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID)
1379 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending;
1381 else
1383 This->ListViewSortInfo.bIsAscending = TRUE;
1385 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1387 SendMessageW(lpnmlv->hdr.hwndFrom, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems);
1388 break;
1390 case LVN_GETDISPINFOA:
1391 case LVN_GETDISPINFOW:
1392 TRACE("-- LVN_GETDISPINFO %p\n",This);
1393 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1395 if(lpdi->item.mask & LVIF_TEXT) /* text requested */
1397 static WCHAR emptyW[] = { 0 };
1398 SHELLDETAILS sd;
1399 HRESULT hr;
1401 if (This->pSF2Parent)
1403 hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
1405 else
1407 IShellDetails *details;
1409 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
1410 if (hr == S_OK)
1412 hr = IShellDetails_GetDetailsOf(details, pidl, lpdi->item.iSubItem, &sd);
1413 IShellDetails_Release(details);
1415 else
1416 WARN("IShellFolder2/IShellDetails not supported\n");
1419 if (hr != S_OK)
1421 /* set to empty on failure */
1422 sd.str.uType = STRRET_WSTR;
1423 sd.str.u.pOleStr = emptyW;
1426 if (lpnmh->code == LVN_GETDISPINFOW)
1428 StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1429 TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
1431 else
1433 /* LVN_GETDISPINFOA - shouldn't happen */
1434 NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
1435 StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
1436 TRACE("-- text=%s\n", lpdiA->item.pszText);
1440 if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1442 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
1444 break;
1446 case LVN_ITEMCHANGED:
1447 TRACE("-- LVN_ITEMCHANGED %p\n",This);
1448 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1449 break;
1451 case LVN_BEGINDRAG:
1452 case LVN_BEGINRDRAG:
1453 TRACE("-- LVN_BEGINDRAG\n");
1455 if (ShellView_GetSelections(This))
1457 IDataObject * pda;
1458 DWORD dwAttributes = SFGAO_CANLINK;
1459 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
1461 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
1463 IDropSource *pds = &This->IDropSource_iface; /* own DropSource interface */
1465 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, (LPCITEMIDLIST*)This->apidl, &dwAttributes)))
1467 if (dwAttributes & SFGAO_CANLINK)
1469 dwEffect |= DROPEFFECT_LINK;
1473 if (pds)
1475 DWORD dwEffect2;
1476 DoDragDrop(pda, pds, dwEffect, &dwEffect2);
1478 IDataObject_Release(pda);
1481 break;
1483 case LVN_BEGINLABELEDITW:
1485 DWORD dwAttr = SFGAO_CANRENAME;
1486 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1488 TRACE("-- LVN_BEGINLABELEDITW %p\n",This);
1490 IShellFolder_GetAttributesOf(This->pSFParent, 1, (LPCITEMIDLIST*)&pidl, &dwAttr);
1491 if (SFGAO_CANRENAME & dwAttr)
1493 return FALSE;
1495 return TRUE;
1498 case LVN_ENDLABELEDITW:
1500 TRACE("-- LVN_ENDLABELEDITA %p\n",This);
1501 if (lpdi->item.pszText)
1503 HRESULT hr;
1504 LVITEMW lvItem;
1506 lvItem.iItem = lpdi->item.iItem;
1507 lvItem.iSubItem = 0;
1508 lvItem.mask = LVIF_PARAM;
1509 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
1511 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1512 hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidl);
1514 if(SUCCEEDED(hr) && pidl)
1516 lvItem.mask = LVIF_PARAM;
1517 lvItem.lParam = (LPARAM)pidl;
1518 SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
1519 return TRUE;
1522 return FALSE;
1525 case LVN_KEYDOWN:
1527 LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
1529 /* initiate a rename of the selected file or directory */
1530 switch (plvKeyDown->wVKey)
1532 case VK_F2:
1534 INT i = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
1536 if (i == 1)
1538 /* get selected item */
1539 i = SendMessageW(This->hWndList, LVM_GETNEXTITEM, -1, MAKELPARAM (LVNI_SELECTED, 0));
1541 SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, i, 0);
1542 SendMessageW(This->hWndList, LVM_EDITLABELW, i, 0);
1545 break;
1546 case VK_DELETE:
1548 UINT i, count;
1549 int item_index;
1550 LVITEMW item;
1551 LPITEMIDLIST* pItems;
1552 ISFHelper *psfhlp;
1553 HRESULT hr;
1555 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (void**)&psfhlp);
1556 if (hr != S_OK) return 0;
1558 if(!(count = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0)))
1560 ISFHelper_Release(psfhlp);
1561 return 0;
1564 /* allocate memory for the pidl array */
1565 pItems = HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST) * count);
1567 /* retrieve all selected items */
1568 i = 0;
1569 item_index = -1;
1571 while (count > i)
1573 /* get selected item */
1574 item_index = SendMessageW(This->hWndList, LVM_GETNEXTITEM, item_index,
1575 MAKELPARAM (LVNI_SELECTED, 0));
1576 item.iItem = item_index;
1577 item.mask = LVIF_PARAM;
1578 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM)&item);
1580 /* get item pidl */
1581 pItems[i] = (LPITEMIDLIST)item.lParam;
1583 i++;
1586 /* perform the item deletion */
1587 ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
1588 ISFHelper_Release(psfhlp);
1590 /* free pidl array memory */
1591 HeapFree(GetProcessHeap(), 0, pItems);
1593 break;
1595 case VK_F5:
1596 /* Initiate a refresh */
1597 IShellView3_Refresh(&This->IShellView3_iface);
1598 break;
1600 case VK_BACK:
1602 LPSHELLBROWSER lpSb;
1603 if((lpSb = (LPSHELLBROWSER)SendMessageW(This->hWndParent, CWM_GETISHELLBROWSER, 0, 0)))
1605 IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT);
1608 break;
1610 default:
1611 FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown->wVKey);
1614 break;
1616 default:
1617 TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);
1618 break;
1620 return 0;
1623 /**********************************************************
1624 * ShellView_OnChange()
1627 static LRESULT ShellView_OnChange(IShellViewImpl * This, const LPCITEMIDLIST *pidls, LONG event)
1629 BOOL ret = TRUE;
1631 TRACE("(%p)->(%p, %p, 0x%08x)\n", This, pidls[0], pidls[1], event);
1633 switch (event)
1635 case SHCNE_MKDIR:
1636 case SHCNE_CREATE:
1637 LV_AddItem(This, pidls[0]);
1638 break;
1639 case SHCNE_RMDIR:
1640 case SHCNE_DELETE:
1642 INT i = LV_FindItemByPidl(This, ILFindLastID(pidls[0]));
1643 ret = SendMessageW(This->hWndList, LVM_DELETEITEM, i, 0);
1644 break;
1646 case SHCNE_RENAMEFOLDER:
1647 case SHCNE_RENAMEITEM:
1648 LV_RenameItem(This, pidls[0], pidls[1]);
1649 break;
1650 case SHCNE_UPDATEITEM:
1651 break;
1653 return ret;
1655 /**********************************************************
1656 * ShellView_WndProc
1659 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
1661 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
1662 LPCREATESTRUCTW lpcs;
1664 TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
1666 switch (uMessage)
1668 case WM_NCCREATE:
1669 lpcs = (LPCREATESTRUCTW)lParam;
1670 pThis = lpcs->lpCreateParams;
1671 SetWindowLongPtrW(hWnd, GWLP_USERDATA, (ULONG_PTR)pThis);
1672 pThis->hWnd = hWnd; /*set the window handle*/
1673 break;
1675 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
1676 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis);
1677 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis);
1678 case WM_CREATE: return ShellView_OnCreate(pThis);
1679 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1680 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
1681 case WM_COMMAND: return ShellView_OnCommand(pThis,
1682 GET_WM_COMMAND_ID(wParam, lParam),
1683 GET_WM_COMMAND_CMD(wParam, lParam),
1684 GET_WM_COMMAND_HWND(wParam, lParam));
1685 case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (const LPCITEMIDLIST*)wParam, (LONG)lParam);
1687 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE);
1688 return 0;
1690 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList);
1691 break;
1693 case WM_GETDLGCODE: return SendMessageW(pThis->hWndList, uMessage, 0, 0);
1694 case WM_SETFONT: return SendMessageW(pThis->hWndList, WM_SETFONT, wParam, lParam);
1695 case WM_GETFONT: return SendMessageW(pThis->hWndList, WM_GETFONT, wParam, lParam);
1697 case WM_DESTROY:
1698 RevokeDragDrop(pThis->hWnd);
1699 SHChangeNotifyDeregister(pThis->hNotify);
1700 break;
1702 case WM_ERASEBKGND:
1703 if ((pThis->FolderSettings.fFlags & FWF_DESKTOP) ||
1704 (pThis->FolderSettings.fFlags & FWF_TRANSPARENT))
1705 return 1;
1706 break;
1709 return DefWindowProcW(hWnd, uMessage, wParam, lParam);
1711 /**********************************************************
1714 * The INTERFACE of the IShellView object
1717 **********************************************************
1718 * IShellView_QueryInterface
1720 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView3 *iface, REFIID riid, void **ppvObj)
1722 IShellViewImpl *This = impl_from_IShellView3(iface);
1724 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
1726 *ppvObj = NULL;
1728 if(IsEqualIID(riid, &IID_IUnknown) ||
1729 IsEqualIID(riid, &IID_IShellView) ||
1730 IsEqualIID(riid, &IID_IShellView2) ||
1731 IsEqualIID(riid, &IID_IShellView3))
1733 *ppvObj = &This->IShellView3_iface;
1735 else if(IsEqualIID(riid, &IID_IShellFolderView))
1737 *ppvObj = &This->IShellFolderView_iface;
1739 else if(IsEqualIID(riid, &IID_IFolderView) ||
1740 IsEqualIID(riid, &IID_IFolderView2))
1742 *ppvObj = &This->IFolderView2_iface;
1744 else if(IsEqualIID(riid, &IID_IOleCommandTarget))
1746 *ppvObj = &This->IOleCommandTarget_iface;
1748 else if(IsEqualIID(riid, &IID_IDropTarget))
1750 *ppvObj = &This->IDropTarget_iface;
1752 else if(IsEqualIID(riid, &IID_IDropSource))
1754 *ppvObj = &This->IDropSource_iface;
1756 else if(IsEqualIID(riid, &IID_IViewObject))
1758 *ppvObj = &This->IViewObject_iface;
1761 if(*ppvObj)
1763 IUnknown_AddRef( (IUnknown*)*ppvObj );
1764 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1765 return S_OK;
1767 TRACE("-- Interface: E_NOINTERFACE\n");
1768 return E_NOINTERFACE;
1771 /**********************************************************
1772 * IShellView_AddRef
1774 static ULONG WINAPI IShellView_fnAddRef(IShellView3 *iface)
1776 IShellViewImpl *This = impl_from_IShellView3(iface);
1777 ULONG refCount = InterlockedIncrement(&This->ref);
1779 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
1781 return refCount;
1783 /**********************************************************
1784 * IShellView_Release
1786 static ULONG WINAPI IShellView_fnRelease(IShellView3 *iface)
1788 IShellViewImpl *This = impl_from_IShellView3(iface);
1789 ULONG refCount = InterlockedDecrement(&This->ref);
1791 TRACE("(%p)->(count=%i)\n", This, refCount + 1);
1793 if (!refCount)
1795 TRACE(" destroying IShellView(%p)\n",This);
1797 DestroyWindow(This->hWndList);
1799 if(This->pSFParent)
1800 IShellFolder_Release(This->pSFParent);
1802 if(This->pSF2Parent)
1803 IShellFolder2_Release(This->pSF2Parent);
1805 SHFree(This->apidl);
1807 if(This->pAdvSink)
1808 IAdviseSink_Release(This->pAdvSink);
1810 HeapFree(GetProcessHeap(),0,This);
1812 return refCount;
1815 /**********************************************************
1816 * ShellView_GetWindow
1818 static HRESULT WINAPI IShellView_fnGetWindow(IShellView3 *iface, HWND *phWnd)
1820 IShellViewImpl *This = impl_from_IShellView3(iface);
1822 TRACE("(%p)\n", This);
1824 *phWnd = This->hWnd;
1825 return S_OK;
1828 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView3 *iface, BOOL mode)
1830 IShellViewImpl *This = impl_from_IShellView3(iface);
1831 TRACE("(%p)->(%d)\n", This, mode);
1832 return E_NOTIMPL;
1835 /**********************************************************
1836 * IShellView_TranslateAccelerator
1838 * FIXME:
1839 * use the accel functions
1841 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView3 *iface, MSG *lpmsg)
1843 #if 0
1844 IShellViewImpl *This = (IShellViewImpl *)iface;
1846 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%x wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1847 #endif
1849 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST))
1851 TRACE("-- key=0x04%lx\n",lpmsg->wParam) ;
1853 return S_FALSE; /* not handled */
1856 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView3 *iface, BOOL fEnable)
1858 IShellViewImpl *This = impl_from_IShellView3(iface);
1860 FIXME("(%p) stub\n", This);
1862 return E_NOTIMPL;
1865 static HRESULT WINAPI IShellView_fnUIActivate(IShellView3 *iface, UINT uState)
1867 IShellViewImpl *This = impl_from_IShellView3(iface);
1870 CHAR szName[MAX_PATH];
1872 LRESULT lResult;
1873 int nPartArray[1] = {-1};
1875 TRACE("(%p)->(state=%x) stub\n",This, uState);
1877 /*don't do anything if the state isn't really changing*/
1878 if(This->uState == uState)
1880 return S_OK;
1883 /*OnActivate handles the menu merging and internal state*/
1884 ShellView_OnActivate(This, uState);
1886 /*only do This if we are active*/
1887 if(uState != SVUIA_DEACTIVATE)
1891 GetFolderPath is not a method of IShellFolder
1892 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1894 /* set the number of parts */
1895 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1896 (LPARAM)nPartArray, &lResult);
1898 /* set the text for the parts */
1900 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1901 0, (LPARAM)szName, &lResult);
1905 return S_OK;
1908 static HRESULT WINAPI IShellView_fnRefresh(IShellView3 *iface)
1910 IShellViewImpl *This = impl_from_IShellView3(iface);
1912 TRACE("(%p)\n", This);
1914 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
1915 ShellView_FillList(This);
1917 return S_OK;
1920 static HRESULT WINAPI IShellView_fnCreateViewWindow(IShellView3 *iface, IShellView *prev_view,
1921 const FOLDERSETTINGS *settings, IShellBrowser *owner, RECT *rect, HWND *hWnd)
1923 IShellViewImpl *This = impl_from_IShellView3(iface);
1924 TRACE("(%p)->(%p %p %p %p %p)\n", This, prev_view, settings, owner, rect, hWnd);
1925 return IShellView3_CreateViewWindow3(iface, owner, prev_view, SV3CVW3_DEFAULT,
1926 settings->fFlags, settings->fFlags, settings->ViewMode, NULL, rect, hWnd);
1929 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView3 *iface)
1931 IShellViewImpl *This = impl_from_IShellView3(iface);
1933 TRACE("(%p)\n", This);
1935 if (!This->hWnd)
1936 return S_OK;
1938 /* Make absolutely sure all our UI is cleaned up. */
1939 IShellView3_UIActivate(iface, SVUIA_DEACTIVATE);
1941 if (This->hMenu)
1942 DestroyMenu(This->hMenu);
1944 DestroyWindow(This->hWnd);
1945 if (This->pShellBrowser) IShellBrowser_Release(This->pShellBrowser);
1946 if (This->pCommDlgBrowser) ICommDlgBrowser_Release(This->pCommDlgBrowser);
1948 This->hMenu = NULL;
1949 This->hWnd = NULL;
1950 This->pShellBrowser = NULL;
1951 This->pCommDlgBrowser = NULL;
1953 return S_OK;
1956 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView3 *iface, LPFOLDERSETTINGS lpfs)
1958 IShellViewImpl *This = impl_from_IShellView3(iface);
1960 TRACE("(%p)->(%p) vmode=%x flags=%x\n", This, lpfs,
1961 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
1963 if (!lpfs) return E_INVALIDARG;
1964 *lpfs = This->FolderSettings;
1965 return S_OK;
1968 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView3 *iface, DWORD dwReserved,
1969 LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1971 IShellViewImpl *This = impl_from_IShellView3(iface);
1972 FIXME("(%p) stub\n", This);
1973 return E_NOTIMPL;
1976 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView3 *iface)
1978 IShellViewImpl *This = impl_from_IShellView3(iface);
1979 FIXME("(%p) stub\n", This);
1980 return S_OK;
1983 static HRESULT WINAPI IShellView_fnSelectItem(IShellView3 *iface, LPCITEMIDLIST pidl, UINT flags)
1985 IShellViewImpl *This = impl_from_IShellView3(iface);
1986 int i;
1988 TRACE("(%p)->(pidl=%p, 0x%08x)\n",This, pidl, flags);
1990 i = LV_FindItemByPidl(This, pidl);
1991 if (i == -1) return S_OK;
1993 return IFolderView2_SelectItem(&This->IFolderView2_iface, i, flags);
1996 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView3 *iface, UINT uItem, REFIID riid,
1997 void **ppvOut)
1999 IShellViewImpl *This = impl_from_IShellView3(iface);
2000 HRESULT hr = E_NOINTERFACE;
2002 TRACE("(%p)->(0x%08x, %s, %p)\n",This, uItem, debugstr_guid(riid), ppvOut);
2004 *ppvOut = NULL;
2006 switch(uItem)
2008 case SVGIO_BACKGROUND:
2010 if (IsEqualIID(&IID_IContextMenu, riid))
2011 return BackgroundMenu_Constructor(This->pSFParent, FALSE, riid, ppvOut);
2012 else if (IsEqualIID(&IID_IDispatch, riid)) {
2013 *ppvOut = &This->IShellFolderViewDual3_iface;
2014 IShellFolderViewDual3_AddRef(&This->IShellFolderViewDual3_iface);
2015 return S_OK;
2017 else
2018 FIXME("unsupported interface requested %s\n", debugstr_guid(riid));
2020 break;
2022 case SVGIO_SELECTION:
2023 ShellView_GetSelections(This);
2024 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
2025 break;
2027 default:
2028 FIXME("unimplemented for uItem = 0x%08x\n", uItem);
2030 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
2032 return hr;
2035 static HRESULT WINAPI IShellView2_fnGetView(IShellView3 *iface, SHELLVIEWID *view_guid, ULONG view_type)
2037 FIXME("(%p)->(%s, %#x) stub!\n", iface, debugstr_guid(view_guid), view_type);
2038 return E_NOTIMPL;
2041 static HRESULT WINAPI IShellView2_fnCreateViewWindow2(IShellView3 *iface, SV2CVW2_PARAMS *view_params)
2043 IShellViewImpl *This = impl_from_IShellView3(iface);
2044 TRACE("(%p)->(%p)\n", This, view_params);
2045 return IShellView3_CreateViewWindow3(iface, view_params->psbOwner, view_params->psvPrev,
2046 SV3CVW3_DEFAULT, view_params->pfs->fFlags, view_params->pfs->fFlags,
2047 view_params->pfs->ViewMode, view_params->pvid, view_params->prcView, &view_params->hwndView);
2050 static HRESULT WINAPI IShellView2_fnHandleRename(IShellView3 *iface, LPCITEMIDLIST new_pidl)
2052 FIXME("(%p)->(new_pidl %p) stub!\n", iface, new_pidl);
2053 return E_NOTIMPL;
2056 static HRESULT WINAPI IShellView2_fnSelectAndPositionItem(IShellView3 *iface, LPCITEMIDLIST item,
2057 UINT flags, POINT *point)
2059 IShellViewImpl *This = impl_from_IShellView3(iface);
2060 TRACE("(%p)->(item %p, flags %#x, point %p)\n", This, item, flags, point);
2061 return IFolderView2_SelectAndPositionItems(&This->IFolderView2_iface, 1, &item, point, flags);
2064 static HRESULT WINAPI IShellView3_fnCreateViewWindow3(IShellView3 *iface, IShellBrowser *owner,
2065 IShellView *prev_view, SV3CVW3_FLAGS view_flags, FOLDERFLAGS mask, FOLDERFLAGS flags,
2066 FOLDERVIEWMODE mode, const SHELLVIEWID *view_id, const RECT *rect, HWND *hwnd)
2068 IShellViewImpl *This = impl_from_IShellView3(iface);
2069 INITCOMMONCONTROLSEX icex;
2070 WNDCLASSW wc;
2071 HRESULT hr;
2072 HWND wnd;
2074 TRACE("(%p)->(%p %p 0x%08x 0x%08x 0x%08x %d %s %s %p)\n", This, owner, prev_view, view_flags,
2075 mask, flags, mode, debugstr_guid(view_id), wine_dbgstr_rect(rect), hwnd);
2077 icex.dwSize = sizeof(icex);
2078 icex.dwICC = ICC_LISTVIEW_CLASSES;
2079 InitCommonControlsEx(&icex);
2081 *hwnd = NULL;
2083 if (!owner || This->hWnd)
2084 return E_UNEXPECTED;
2086 if (view_flags != SV3CVW3_DEFAULT)
2087 FIXME("unsupported view flags 0x%08x\n", view_flags);
2089 /* Set up the member variables */
2090 This->pShellBrowser = owner;
2091 This->FolderSettings.ViewMode = mode;
2092 This->FolderSettings.fFlags = mask & flags;
2094 if (view_id)
2096 if (IsEqualGUID(view_id, &VID_LargeIcons))
2097 This->FolderSettings.ViewMode = FVM_ICON;
2098 else if (IsEqualGUID(view_id, &VID_SmallIcons))
2099 This->FolderSettings.ViewMode = FVM_SMALLICON;
2100 else if (IsEqualGUID(view_id, &VID_List))
2101 This->FolderSettings.ViewMode = FVM_LIST;
2102 else if (IsEqualGUID(view_id, &VID_Details))
2103 This->FolderSettings.ViewMode = FVM_DETAILS;
2104 else if (IsEqualGUID(view_id, &VID_Thumbnails))
2105 This->FolderSettings.ViewMode = FVM_THUMBNAIL;
2106 else if (IsEqualGUID(view_id, &VID_Tile))
2107 This->FolderSettings.ViewMode = FVM_TILE;
2108 else if (IsEqualGUID(view_id, &VID_ThumbStrip))
2109 This->FolderSettings.ViewMode = FVM_THUMBSTRIP;
2110 else
2111 FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id));
2114 /* Get our parent window */
2115 IShellBrowser_AddRef(This->pShellBrowser);
2116 IShellBrowser_GetWindow(This->pShellBrowser, &This->hWndParent);
2118 /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2119 This->pCommDlgBrowser = NULL;
2120 hr = IShellBrowser_QueryInterface(This->pShellBrowser, &IID_ICommDlgBrowser, (void **)&This->pCommDlgBrowser);
2121 if (hr == S_OK)
2122 TRACE("-- CommDlgBrowser %p\n", This->pCommDlgBrowser);
2124 /* If our window class has not been registered, then do so */
2125 if (!GetClassInfoW(shell32_hInstance, SV_CLASS_NAME, &wc))
2127 wc.style = CS_HREDRAW | CS_VREDRAW;
2128 wc.lpfnWndProc = ShellView_WndProc;
2129 wc.cbClsExtra = 0;
2130 wc.cbWndExtra = 0;
2131 wc.hInstance = shell32_hInstance;
2132 wc.hIcon = 0;
2133 wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2134 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2135 wc.lpszMenuName = NULL;
2136 wc.lpszClassName = SV_CLASS_NAME;
2138 if (!RegisterClassW(&wc)) return E_FAIL;
2141 wnd = CreateWindowExW(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_TABSTOP,
2142 rect->left, rect->top,
2143 rect->right - rect->left,
2144 rect->bottom - rect->top,
2145 This->hWndParent, 0, shell32_hInstance, This);
2147 CheckToolbar(This);
2149 if (!wnd)
2151 IShellBrowser_Release(This->pShellBrowser);
2152 return E_FAIL;
2155 SetWindowPos(wnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
2156 UpdateWindow(wnd);
2158 *hwnd = wnd;
2160 return S_OK;
2163 static const IShellView3Vtbl shellviewvtbl =
2165 IShellView_fnQueryInterface,
2166 IShellView_fnAddRef,
2167 IShellView_fnRelease,
2168 IShellView_fnGetWindow,
2169 IShellView_fnContextSensitiveHelp,
2170 IShellView_fnTranslateAccelerator,
2171 IShellView_fnEnableModeless,
2172 IShellView_fnUIActivate,
2173 IShellView_fnRefresh,
2174 IShellView_fnCreateViewWindow,
2175 IShellView_fnDestroyViewWindow,
2176 IShellView_fnGetCurrentInfo,
2177 IShellView_fnAddPropertySheetPages,
2178 IShellView_fnSaveViewState,
2179 IShellView_fnSelectItem,
2180 IShellView_fnGetItemObject,
2181 IShellView2_fnGetView,
2182 IShellView2_fnCreateViewWindow2,
2183 IShellView2_fnHandleRename,
2184 IShellView2_fnSelectAndPositionItem,
2185 IShellView3_fnCreateViewWindow3
2189 /**********************************************************
2190 * ISVOleCmdTarget_QueryInterface (IUnknown)
2192 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(IOleCommandTarget *iface, REFIID iid, void **ppvObj)
2194 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2195 return IShellView3_QueryInterface(&This->IShellView3_iface, iid, ppvObj);
2198 /**********************************************************
2199 * ISVOleCmdTarget_AddRef (IUnknown)
2201 static ULONG WINAPI ISVOleCmdTarget_AddRef(IOleCommandTarget *iface)
2203 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2204 return IShellView3_AddRef(&This->IShellView3_iface);
2207 /**********************************************************
2208 * ISVOleCmdTarget_Release (IUnknown)
2210 static ULONG WINAPI ISVOleCmdTarget_Release(IOleCommandTarget *iface)
2212 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2213 return IShellView3_Release(&This->IShellView3_iface);
2216 /**********************************************************
2217 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2219 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
2220 IOleCommandTarget *iface,
2221 const GUID *pguidCmdGroup,
2222 ULONG cCmds,
2223 OLECMD *prgCmds,
2224 OLECMDTEXT *pCmdText)
2226 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2227 UINT i;
2229 FIXME("(%p)->(%s %d %p %p)\n",
2230 This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
2232 if (!prgCmds)
2233 return E_INVALIDARG;
2234 for (i = 0; i < cCmds; i++)
2236 FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
2237 prgCmds[i].cmdf = 0;
2239 return OLECMDERR_E_UNKNOWNGROUP;
2242 /**********************************************************
2243 * ISVOleCmdTarget_Exec (IOleCommandTarget)
2245 * nCmdID is the OLECMDID_* enumeration
2247 static HRESULT WINAPI ISVOleCmdTarget_Exec(
2248 IOleCommandTarget *iface,
2249 const GUID* pguidCmdGroup,
2250 DWORD nCmdID,
2251 DWORD nCmdexecopt,
2252 VARIANT* pvaIn,
2253 VARIANT* pvaOut)
2255 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2257 FIXME("(%p)->(%s %d 0x%08x %s %p)\n",
2258 This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
2260 if (!pguidCmdGroup)
2261 return OLECMDERR_E_UNKNOWNGROUP;
2263 if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) &&
2264 (nCmdID == OLECMDID_SHOWMESSAGE) &&
2265 (nCmdexecopt == 4) && pvaOut)
2266 return S_OK;
2267 if (IsEqualIID(pguidCmdGroup, &CGID_ShellDocView) &&
2268 (nCmdID == OLECMDID_SPELL) &&
2269 (nCmdexecopt == OLECMDEXECOPT_DODEFAULT))
2270 return S_FALSE;
2272 return OLECMDERR_E_UNKNOWNGROUP;
2275 static const IOleCommandTargetVtbl olecommandtargetvtbl =
2277 ISVOleCmdTarget_QueryInterface,
2278 ISVOleCmdTarget_AddRef,
2279 ISVOleCmdTarget_Release,
2280 ISVOleCmdTarget_QueryStatus,
2281 ISVOleCmdTarget_Exec
2284 /**********************************************************
2285 * ISVDropTarget implementation
2288 static HRESULT WINAPI ISVDropTarget_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObj)
2290 IShellViewImpl *This = impl_from_IDropTarget(iface);
2291 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2294 static ULONG WINAPI ISVDropTarget_AddRef(IDropTarget *iface)
2296 IShellViewImpl *This = impl_from_IDropTarget(iface);
2297 return IShellView3_AddRef(&This->IShellView3_iface);
2300 static ULONG WINAPI ISVDropTarget_Release(IDropTarget *iface)
2302 IShellViewImpl *This = impl_from_IDropTarget(iface);
2303 return IShellView3_Release(&This->IShellView3_iface);
2306 /******************************************************************************
2307 * drag_notify_subitem [Internal]
2309 * Figure out the shellfolder object, which is currently under the mouse cursor
2310 * and notify it via the IDropTarget interface.
2313 #define SCROLLAREAWIDTH 20
2315 static HRESULT drag_notify_subitem(IShellViewImpl *This, DWORD grfKeyState, POINTL pt,
2316 DWORD *pdwEffect)
2318 LVHITTESTINFO htinfo;
2319 LVITEMW lvItem;
2320 LONG lResult;
2321 HRESULT hr;
2322 RECT clientRect;
2324 /* Map from global to client coordinates and query the index of the listview-item, which is
2325 * currently under the mouse cursor. */
2326 htinfo.pt.x = pt.x;
2327 htinfo.pt.y = pt.y;
2328 htinfo.flags = LVHT_ONITEM;
2329 ScreenToClient(This->hWndList, &htinfo.pt);
2330 lResult = SendMessageW(This->hWndList, LVM_HITTEST, 0, (LPARAM)&htinfo);
2332 /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
2333 GetClientRect(This->hWndList, &clientRect);
2334 if (htinfo.pt.x == This->ptLastMousePos.x && htinfo.pt.y == This->ptLastMousePos.y &&
2335 (htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
2336 htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
2338 This->cScrollDelay = (This->cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
2339 if (This->cScrollDelay == 0) { /* Mouse did hover another 250 ms over the scroll-area */
2340 if (htinfo.pt.x < SCROLLAREAWIDTH)
2341 SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEUP, 0);
2342 if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
2343 SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEDOWN, 0);
2344 if (htinfo.pt.y < SCROLLAREAWIDTH)
2345 SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEUP, 0);
2346 if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
2347 SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEDOWN, 0);
2349 } else {
2350 This->cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
2352 This->ptLastMousePos = htinfo.pt;
2354 /* If we are still over the previous sub-item, notify it via DragOver and return. */
2355 if (This->pCurDropTarget && lResult == This->iDragOverItem)
2356 return IDropTarget_DragOver(This->pCurDropTarget, grfKeyState, pt, pdwEffect);
2358 /* We've left the previous sub-item, notify it via DragLeave and Release it. */
2359 if (This->pCurDropTarget) {
2360 IDropTarget_DragLeave(This->pCurDropTarget);
2361 IDropTarget_Release(This->pCurDropTarget);
2362 This->pCurDropTarget = NULL;
2365 This->iDragOverItem = lResult;
2366 if (lResult == -1) {
2367 /* We are not above one of the listview's subitems. Bind to the parent folder's
2368 * DropTarget interface. */
2369 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IDropTarget,
2370 (LPVOID*)&This->pCurDropTarget);
2371 } else {
2372 /* Query the relative PIDL of the shellfolder object represented by the currently
2373 * dragged over listview-item ... */
2374 lvItem.mask = LVIF_PARAM;
2375 lvItem.iItem = lResult;
2376 lvItem.iSubItem = 0;
2377 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
2379 /* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */
2380 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWndList, 1,
2381 (LPCITEMIDLIST*)&lvItem.lParam, &IID_IDropTarget, NULL, (LPVOID*)&This->pCurDropTarget);
2384 /* If anything failed, pCurDropTarget should be NULL now, which ought to be a save state. */
2385 if (FAILED(hr))
2386 return hr;
2388 /* Notify the item just entered via DragEnter. */
2389 return IDropTarget_DragEnter(This->pCurDropTarget, This->pCurDataObject, grfKeyState, pt, pdwEffect);
2392 static HRESULT WINAPI ISVDropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObject,
2393 DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2395 IShellViewImpl *This = impl_from_IDropTarget(iface);
2397 /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
2398 This->pCurDataObject = pDataObject;
2399 IDataObject_AddRef(pDataObject);
2401 return drag_notify_subitem(This, grfKeyState, pt, pdwEffect);
2404 static HRESULT WINAPI ISVDropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt,
2405 DWORD *pdwEffect)
2407 IShellViewImpl *This = impl_from_IDropTarget(iface);
2408 return drag_notify_subitem(This, grfKeyState, pt, pdwEffect);
2411 static HRESULT WINAPI ISVDropTarget_DragLeave(IDropTarget *iface)
2413 IShellViewImpl *This = impl_from_IDropTarget(iface);
2415 if (This->pCurDropTarget)
2417 IDropTarget_DragLeave(This->pCurDropTarget);
2418 IDropTarget_Release(This->pCurDropTarget);
2419 This->pCurDropTarget = NULL;
2422 if (This->pCurDataObject)
2424 IDataObject_Release(This->pCurDataObject);
2425 This->pCurDataObject = NULL;
2428 This->iDragOverItem = 0;
2430 return S_OK;
2433 static HRESULT WINAPI ISVDropTarget_Drop(IDropTarget *iface, IDataObject* pDataObject,
2434 DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2436 IShellViewImpl *This = impl_from_IDropTarget(iface);
2438 if (!This->pCurDropTarget) return DRAGDROP_E_INVALIDHWND;
2440 IDropTarget_Drop(This->pCurDropTarget, pDataObject, grfKeyState, pt, pdwEffect);
2442 IDropTarget_Release(This->pCurDropTarget);
2443 IDataObject_Release(This->pCurDataObject);
2444 This->pCurDataObject = NULL;
2445 This->pCurDropTarget = NULL;
2446 This->iDragOverItem = 0;
2448 return S_OK;
2451 static const IDropTargetVtbl droptargetvtbl =
2453 ISVDropTarget_QueryInterface,
2454 ISVDropTarget_AddRef,
2455 ISVDropTarget_Release,
2456 ISVDropTarget_DragEnter,
2457 ISVDropTarget_DragOver,
2458 ISVDropTarget_DragLeave,
2459 ISVDropTarget_Drop
2462 /**********************************************************
2463 * ISVDropSource implementation
2466 static HRESULT WINAPI ISVDropSource_QueryInterface(IDropSource *iface, REFIID riid, void **ppvObj)
2468 IShellViewImpl *This = impl_from_IDropSource(iface);
2469 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2472 static ULONG WINAPI ISVDropSource_AddRef(IDropSource *iface)
2474 IShellViewImpl *This = impl_from_IDropSource(iface);
2475 return IShellView3_AddRef(&This->IShellView3_iface);
2478 static ULONG WINAPI ISVDropSource_Release(IDropSource *iface)
2480 IShellViewImpl *This = impl_from_IDropSource(iface);
2481 return IShellView3_Release(&This->IShellView3_iface);
2484 static HRESULT WINAPI ISVDropSource_QueryContinueDrag(
2485 IDropSource *iface,
2486 BOOL fEscapePressed,
2487 DWORD grfKeyState)
2489 IShellViewImpl *This = impl_from_IDropSource(iface);
2490 TRACE("(%p)\n",This);
2492 if (fEscapePressed)
2493 return DRAGDROP_S_CANCEL;
2494 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
2495 return DRAGDROP_S_DROP;
2496 else
2497 return S_OK;
2500 static HRESULT WINAPI ISVDropSource_GiveFeedback(
2501 IDropSource *iface,
2502 DWORD dwEffect)
2504 IShellViewImpl *This = impl_from_IDropSource(iface);
2505 TRACE("(%p)\n",This);
2507 return DRAGDROP_S_USEDEFAULTCURSORS;
2510 static const IDropSourceVtbl dropsourcevtbl =
2512 ISVDropSource_QueryInterface,
2513 ISVDropSource_AddRef,
2514 ISVDropSource_Release,
2515 ISVDropSource_QueryContinueDrag,
2516 ISVDropSource_GiveFeedback
2518 /**********************************************************
2519 * ISVViewObject implementation
2522 static HRESULT WINAPI ISVViewObject_QueryInterface(IViewObject *iface, REFIID riid, void **ppvObj)
2524 IShellViewImpl *This = impl_from_IViewObject(iface);
2525 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2528 static ULONG WINAPI ISVViewObject_AddRef(IViewObject *iface)
2530 IShellViewImpl *This = impl_from_IViewObject(iface);
2531 return IShellView3_AddRef(&This->IShellView3_iface);
2534 static ULONG WINAPI ISVViewObject_Release(IViewObject *iface)
2536 IShellViewImpl *This = impl_from_IViewObject(iface);
2537 return IShellView3_Release(&This->IShellView3_iface);
2540 static HRESULT WINAPI ISVViewObject_Draw(
2541 IViewObject *iface,
2542 DWORD dwDrawAspect,
2543 LONG lindex,
2544 void* pvAspect,
2545 DVTARGETDEVICE* ptd,
2546 HDC hdcTargetDev,
2547 HDC hdcDraw,
2548 LPCRECTL lprcBounds,
2549 LPCRECTL lprcWBounds,
2550 BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
2551 ULONG_PTR dwContinue)
2554 IShellViewImpl *This = impl_from_IViewObject(iface);
2556 FIXME("Stub: This=%p\n",This);
2558 return E_NOTIMPL;
2560 static HRESULT WINAPI ISVViewObject_GetColorSet(
2561 IViewObject *iface,
2562 DWORD dwDrawAspect,
2563 LONG lindex,
2564 void *pvAspect,
2565 DVTARGETDEVICE* ptd,
2566 HDC hicTargetDevice,
2567 LOGPALETTE** ppColorSet)
2570 IShellViewImpl *This = impl_from_IViewObject(iface);
2572 FIXME("Stub: This=%p\n",This);
2574 return E_NOTIMPL;
2576 static HRESULT WINAPI ISVViewObject_Freeze(
2577 IViewObject *iface,
2578 DWORD dwDrawAspect,
2579 LONG lindex,
2580 void* pvAspect,
2581 DWORD* pdwFreeze)
2584 IShellViewImpl *This = impl_from_IViewObject(iface);
2586 FIXME("Stub: This=%p\n",This);
2588 return E_NOTIMPL;
2590 static HRESULT WINAPI ISVViewObject_Unfreeze(
2591 IViewObject *iface,
2592 DWORD dwFreeze)
2595 IShellViewImpl *This = impl_from_IViewObject(iface);
2597 FIXME("Stub: This=%p\n",This);
2599 return E_NOTIMPL;
2601 static HRESULT WINAPI ISVViewObject_SetAdvise(
2602 IViewObject *iface,
2603 DWORD aspects,
2604 DWORD advf,
2605 IAdviseSink* pAdvSink)
2608 IShellViewImpl *This = impl_from_IViewObject(iface);
2610 FIXME("partial stub: %p %08x %08x %p\n",
2611 This, aspects, advf, pAdvSink);
2613 /* FIXME: we set the AdviseSink, but never use it to send any advice */
2614 This->pAdvSink = pAdvSink;
2615 This->dwAspects = aspects;
2616 This->dwAdvf = advf;
2618 return S_OK;
2621 static HRESULT WINAPI ISVViewObject_GetAdvise(
2622 IViewObject *iface,
2623 DWORD* pAspects,
2624 DWORD* pAdvf,
2625 IAdviseSink** ppAdvSink)
2628 IShellViewImpl *This = impl_from_IViewObject(iface);
2630 TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
2631 This, pAspects, pAdvf, ppAdvSink);
2633 if( ppAdvSink )
2635 IAdviseSink_AddRef( This->pAdvSink );
2636 *ppAdvSink = This->pAdvSink;
2638 if( pAspects )
2639 *pAspects = This->dwAspects;
2640 if( pAdvf )
2641 *pAdvf = This->dwAdvf;
2643 return S_OK;
2647 static const IViewObjectVtbl viewobjectvtbl =
2649 ISVViewObject_QueryInterface,
2650 ISVViewObject_AddRef,
2651 ISVViewObject_Release,
2652 ISVViewObject_Draw,
2653 ISVViewObject_GetColorSet,
2654 ISVViewObject_Freeze,
2655 ISVViewObject_Unfreeze,
2656 ISVViewObject_SetAdvise,
2657 ISVViewObject_GetAdvise
2660 /* IFolderView2 */
2661 static HRESULT WINAPI FolderView_QueryInterface(IFolderView2 *iface, REFIID riid, void **ppvObj)
2663 IShellViewImpl *This = impl_from_IFolderView2(iface);
2664 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2667 static ULONG WINAPI FolderView_AddRef(IFolderView2 *iface)
2669 IShellViewImpl *This = impl_from_IFolderView2(iface);
2670 return IShellView3_AddRef(&This->IShellView3_iface);
2673 static ULONG WINAPI FolderView_Release(IFolderView2 *iface)
2675 IShellViewImpl *This = impl_from_IFolderView2(iface);
2676 return IShellView3_Release(&This->IShellView3_iface);
2679 static HRESULT WINAPI FolderView_GetCurrentViewMode(IFolderView2 *iface, UINT *mode)
2681 IShellViewImpl *This = impl_from_IFolderView2(iface);
2682 TRACE("(%p)->(%p), stub\n", This, mode);
2684 if(!mode)
2685 return E_INVALIDARG;
2687 *mode = This->FolderSettings.ViewMode;
2688 return S_OK;
2691 static HRESULT WINAPI FolderView_SetCurrentViewMode(IFolderView2 *iface, UINT mode)
2693 IShellViewImpl *This = impl_from_IFolderView2(iface);
2694 DWORD dwStyle;
2695 TRACE("(%p)->(%u), stub\n", This, mode);
2697 if((mode < FVM_FIRST || mode > FVM_LAST) &&
2698 (mode != FVM_AUTO))
2699 return E_INVALIDARG;
2701 /* Windows before Vista uses LVM_SETVIEW and possibly
2702 LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2703 while later versions seem to accomplish this through other
2704 means. */
2705 dwStyle = ViewModeToListStyle(mode);
2706 SetStyle(This, dwStyle, LVS_TYPEMASK);
2708 /* This will not necessarily be the actual mode set above.
2709 This mimics the behavior of Windows XP. */
2710 This->FolderSettings.ViewMode = mode;
2712 return S_OK;
2715 static HRESULT WINAPI FolderView_GetFolder(IFolderView2 *iface, REFIID riid, void **ppv)
2717 IShellViewImpl *This = impl_from_IFolderView2(iface);
2719 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
2721 return IShellFolder_QueryInterface(This->pSFParent, riid, ppv);
2724 static HRESULT WINAPI FolderView_Item(IFolderView2 *iface, int index, PITEMID_CHILD *ppidl)
2726 IShellViewImpl *This = impl_from_IFolderView2(iface);
2727 LVITEMW item;
2729 TRACE("(%p)->(%d %p)\n", This, index, ppidl);
2731 item.mask = LVIF_PARAM;
2732 item.iItem = index;
2734 if (SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM)&item))
2736 *ppidl = ILClone((PITEMID_CHILD)item.lParam);
2737 return S_OK;
2739 else
2741 *ppidl = 0;
2742 return E_INVALIDARG;
2746 static HRESULT WINAPI FolderView_ItemCount(IFolderView2 *iface, UINT flags, int *items)
2748 IShellViewImpl *This = impl_from_IFolderView2(iface);
2750 TRACE("(%p)->(%u %p)\n", This, flags, items);
2752 if (flags != SVGIO_ALLVIEW)
2753 FIXME("some flags unsupported, %x\n", flags & ~SVGIO_ALLVIEW);
2755 *items = SendMessageW(This->hWndList, LVM_GETITEMCOUNT, 0, 0);
2757 return S_OK;
2760 static HRESULT WINAPI FolderView_Items(IFolderView2 *iface, UINT flags, REFIID riid, void **ppv)
2762 IShellViewImpl *This = impl_from_IFolderView2(iface);
2763 FIXME("(%p)->(%u %s %p), stub\n", This, flags, debugstr_guid(riid), ppv);
2764 return E_NOTIMPL;
2767 static HRESULT WINAPI FolderView_GetSelectionMarkedItem(IFolderView2 *iface, int *item)
2769 IShellViewImpl *This = impl_from_IFolderView2(iface);
2771 TRACE("(%p)->(%p)\n", This, item);
2773 *item = SendMessageW(This->hWndList, LVM_GETSELECTIONMARK, 0, 0);
2775 return S_OK;
2778 static HRESULT WINAPI FolderView_GetFocusedItem(IFolderView2 *iface, int *item)
2780 IShellViewImpl *This = impl_from_IFolderView2(iface);
2782 TRACE("(%p)->(%p)\n", This, item);
2784 *item = SendMessageW(This->hWndList, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
2786 return S_OK;
2789 static HRESULT WINAPI FolderView_GetItemPosition(IFolderView2 *iface, PCUITEMID_CHILD pidl, POINT *ppt)
2791 IShellViewImpl *This = impl_from_IFolderView2(iface);
2792 FIXME("(%p)->(%p %p), stub\n", This, pidl, ppt);
2793 return E_NOTIMPL;
2796 static HRESULT WINAPI FolderView_GetSpacing(IFolderView2 *iface, POINT *pt)
2798 IShellViewImpl *This = impl_from_IFolderView2(iface);
2800 TRACE("(%p)->(%p)\n", This, pt);
2802 if (!This->hWndList) return S_FALSE;
2804 if (pt)
2806 DWORD ret;
2807 ret = SendMessageW(This->hWndList, LVM_GETITEMSPACING, 0, 0);
2809 pt->x = LOWORD(ret);
2810 pt->y = HIWORD(ret);
2813 return S_OK;
2816 static HRESULT WINAPI FolderView_GetDefaultSpacing(IFolderView2 *iface, POINT *pt)
2818 IShellViewImpl *This = impl_from_IFolderView2(iface);
2819 FIXME("(%p)->(%p), stub\n", This, pt);
2820 return E_NOTIMPL;
2823 static HRESULT WINAPI FolderView_GetAutoArrange(IFolderView2 *iface)
2825 IShellViewImpl *This = impl_from_IFolderView2(iface);
2826 FIXME("(%p), stub\n", This);
2827 return E_NOTIMPL;
2830 static HRESULT WINAPI FolderView_SelectItem(IFolderView2 *iface, int item, DWORD flags)
2832 IShellViewImpl *This = impl_from_IFolderView2(iface);
2833 LVITEMW lvItem;
2835 TRACE("(%p)->(%d, %x)\n", This, item, flags);
2837 lvItem.state = 0;
2838 lvItem.stateMask = LVIS_SELECTED;
2840 if (flags & SVSI_ENSUREVISIBLE)
2841 SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, item, 0);
2843 /* all items */
2844 if (flags & SVSI_DESELECTOTHERS)
2845 SendMessageW(This->hWndList, LVM_SETITEMSTATE, -1, (LPARAM)&lvItem);
2847 /* this item */
2848 if (flags & SVSI_SELECT)
2849 lvItem.state |= LVIS_SELECTED;
2851 if (flags & SVSI_FOCUSED)
2852 lvItem.stateMask |= LVIS_FOCUSED;
2854 SendMessageW(This->hWndList, LVM_SETITEMSTATE, item, (LPARAM)&lvItem);
2856 if (flags & SVSI_EDIT)
2857 SendMessageW(This->hWndList, LVM_EDITLABELW, item, 0);
2859 return S_OK;
2862 static HRESULT WINAPI FolderView_SelectAndPositionItems(IFolderView2 *iface, UINT cidl,
2863 PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD flags)
2865 IShellViewImpl *This = impl_from_IFolderView2(iface);
2866 FIXME("(%p)->(%u %p %p %x), stub\n", This, cidl, apidl, apt, flags);
2867 return E_NOTIMPL;
2870 static HRESULT WINAPI FolderView2_SetGroupBy(IFolderView2 *iface, REFPROPERTYKEY key, BOOL ascending)
2872 IShellViewImpl *This = impl_from_IFolderView2(iface);
2873 FIXME("(%p)->(%p %d), stub\n", This, key, ascending);
2874 return E_NOTIMPL;
2877 static HRESULT WINAPI FolderView2_GetGroupBy(IFolderView2 *iface, PROPERTYKEY *pkey, BOOL *ascending)
2879 IShellViewImpl *This = impl_from_IFolderView2(iface);
2880 FIXME("(%p)->(%p %p), stub\n", This, pkey, ascending);
2881 return E_NOTIMPL;
2884 static HRESULT WINAPI FolderView2_SetViewProperty(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2885 REFPROPERTYKEY propkey, REFPROPVARIANT propvar)
2887 IShellViewImpl *This = impl_from_IFolderView2(iface);
2888 FIXME("(%p)->(%p %p %p), stub\n", This, pidl, propkey, propvar);
2889 return E_NOTIMPL;
2892 static HRESULT WINAPI FolderView2_GetViewProperty(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2893 REFPROPERTYKEY propkey, PROPVARIANT *propvar)
2895 IShellViewImpl *This = impl_from_IFolderView2(iface);
2896 FIXME("(%p)->(%p %p %p), stub\n", This, pidl, propkey, propvar);
2897 return E_NOTIMPL;
2900 static HRESULT WINAPI FolderView2_SetTileViewProperties(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2901 LPCWSTR prop_list)
2903 IShellViewImpl *This = impl_from_IFolderView2(iface);
2904 FIXME("(%p)->(%p %s), stub\n", This, pidl, debugstr_w(prop_list));
2905 return E_NOTIMPL;
2908 static HRESULT WINAPI FolderView2_SetExtendedTileViewProperties(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2909 LPCWSTR prop_list)
2911 IShellViewImpl *This = impl_from_IFolderView2(iface);
2912 FIXME("(%p)->(%p %s), stub\n", This, pidl, debugstr_w(prop_list));
2913 return E_NOTIMPL;
2916 static HRESULT WINAPI FolderView2_SetText(IFolderView2 *iface, FVTEXTTYPE type, LPCWSTR text)
2918 IShellViewImpl *This = impl_from_IFolderView2(iface);
2919 FIXME("(%p)->(%d %s), stub\n", This, type, debugstr_w(text));
2920 return E_NOTIMPL;
2923 static HRESULT WINAPI FolderView2_SetCurrentFolderFlags(IFolderView2 *iface, DWORD mask, DWORD flags)
2925 IShellViewImpl *This = impl_from_IFolderView2(iface);
2926 FIXME("(%p)->(0x%08x 0x%08x), stub\n", This, mask, flags);
2927 return E_NOTIMPL;
2930 static HRESULT WINAPI FolderView2_GetCurrentFolderFlags(IFolderView2 *iface, DWORD *flags)
2932 IShellViewImpl *This = impl_from_IFolderView2(iface);
2933 FIXME("(%p)->(%p), stub\n", This, flags);
2934 return E_NOTIMPL;
2937 static HRESULT WINAPI FolderView2_GetSortColumnCount(IFolderView2 *iface, int *columns)
2939 IShellViewImpl *This = impl_from_IFolderView2(iface);
2940 FIXME("(%p)->(%p), stub\n", This, columns);
2941 return E_NOTIMPL;
2944 static HRESULT WINAPI FolderView2_SetSortColumns(IFolderView2 *iface, const SORTCOLUMN *columns,
2945 int count)
2947 IShellViewImpl *This = impl_from_IFolderView2(iface);
2948 FIXME("(%p)->(%p %d), stub\n", This, columns, count);
2949 return E_NOTIMPL;
2952 static HRESULT WINAPI FolderView2_GetSortColumns(IFolderView2 *iface, SORTCOLUMN *columns,
2953 int count)
2955 IShellViewImpl *This = impl_from_IFolderView2(iface);
2956 FIXME("(%p)->(%p %d), stub\n", This, columns, count);
2957 return E_NOTIMPL;
2960 static HRESULT WINAPI FolderView2_GetItem(IFolderView2 *iface, int item, REFIID riid, void **ppv)
2962 IShellViewImpl *This = impl_from_IFolderView2(iface);
2963 FIXME("(%p)->(%d %s %p), stub\n", This, item, debugstr_guid(riid), ppv);
2964 return E_NOTIMPL;
2967 static HRESULT WINAPI FolderView2_GetVisibleItem(IFolderView2 *iface, int start, BOOL previous,
2968 int *item)
2970 IShellViewImpl *This = impl_from_IFolderView2(iface);
2971 FIXME("(%p)->(%d %d %p), stub\n", This, start, previous, item);
2972 return E_NOTIMPL;
2975 static HRESULT WINAPI FolderView2_GetSelectedItem(IFolderView2 *iface, int start, int *item)
2977 IShellViewImpl *This = impl_from_IFolderView2(iface);
2978 FIXME("(%p)->(%d %p), stub\n", This, start, item);
2979 return E_NOTIMPL;
2982 static HRESULT WINAPI FolderView2_GetSelection(IFolderView2 *iface, BOOL none_implies_folder,
2983 IShellItemArray **array)
2985 IShellViewImpl *This = impl_from_IFolderView2(iface);
2986 FIXME("(%p)->(%d %p), stub\n", This, none_implies_folder, array);
2987 return E_NOTIMPL;
2990 static HRESULT WINAPI FolderView2_GetSelectionState(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2991 DWORD *flags)
2993 IShellViewImpl *This = impl_from_IFolderView2(iface);
2994 FIXME("(%p)->(%p %p), stub\n", This, pidl, flags);
2995 return E_NOTIMPL;
2998 static HRESULT WINAPI FolderView2_InvokeVerbOnSelection(IFolderView2 *iface, LPCSTR verb)
3000 IShellViewImpl *This = impl_from_IFolderView2(iface);
3001 FIXME("(%p)->(%s), stub\n", This, debugstr_a(verb));
3002 return E_NOTIMPL;
3005 static HRESULT WINAPI FolderView2_SetViewModeAndIconSize(IFolderView2 *iface, FOLDERVIEWMODE mode,
3006 int size)
3008 IShellViewImpl *This = impl_from_IFolderView2(iface);
3009 FIXME("(%p)->(%d %d), stub\n", This, mode, size);
3010 return E_NOTIMPL;
3013 static HRESULT WINAPI FolderView2_GetViewModeAndIconSize(IFolderView2 *iface, FOLDERVIEWMODE *mode,
3014 int *size)
3016 IShellViewImpl *This = impl_from_IFolderView2(iface);
3017 FIXME("(%p)->(%p %p), stub\n", This, mode, size);
3018 return E_NOTIMPL;
3021 static HRESULT WINAPI FolderView2_SetGroupSubsetCount(IFolderView2 *iface, UINT visible_rows)
3023 IShellViewImpl *This = impl_from_IFolderView2(iface);
3024 FIXME("(%p)->(%u), stub\n", This, visible_rows);
3025 return E_NOTIMPL;
3028 static HRESULT WINAPI FolderView2_GetGroupSubsetCount(IFolderView2 *iface, UINT *visible_rows)
3030 IShellViewImpl *This = impl_from_IFolderView2(iface);
3031 FIXME("(%p)->(%p), stub\n", This, visible_rows);
3032 return E_NOTIMPL;
3035 static HRESULT WINAPI FolderView2_SetRedraw(IFolderView2 *iface, BOOL redraw)
3037 IShellViewImpl *This = impl_from_IFolderView2(iface);
3038 TRACE("(%p)->(%d)\n", This, redraw);
3039 SendMessageW(This->hWndList, WM_SETREDRAW, redraw, 0);
3040 return S_OK;
3043 static HRESULT WINAPI FolderView2_IsMoveInSameFolder(IFolderView2 *iface)
3045 IShellViewImpl *This = impl_from_IFolderView2(iface);
3046 FIXME("(%p), stub\n", This);
3047 return E_NOTIMPL;
3050 static HRESULT WINAPI FolderView2_DoRename(IFolderView2 *iface)
3052 IShellViewImpl *This = impl_from_IFolderView2(iface);
3053 FIXME("(%p), stub\n", This);
3054 return E_NOTIMPL;
3057 static const IFolderView2Vtbl folderviewvtbl =
3059 FolderView_QueryInterface,
3060 FolderView_AddRef,
3061 FolderView_Release,
3062 FolderView_GetCurrentViewMode,
3063 FolderView_SetCurrentViewMode,
3064 FolderView_GetFolder,
3065 FolderView_Item,
3066 FolderView_ItemCount,
3067 FolderView_Items,
3068 FolderView_GetSelectionMarkedItem,
3069 FolderView_GetFocusedItem,
3070 FolderView_GetItemPosition,
3071 FolderView_GetSpacing,
3072 FolderView_GetDefaultSpacing,
3073 FolderView_GetAutoArrange,
3074 FolderView_SelectItem,
3075 FolderView_SelectAndPositionItems,
3076 FolderView2_SetGroupBy,
3077 FolderView2_GetGroupBy,
3078 FolderView2_SetViewProperty,
3079 FolderView2_GetViewProperty,
3080 FolderView2_SetTileViewProperties,
3081 FolderView2_SetExtendedTileViewProperties,
3082 FolderView2_SetText,
3083 FolderView2_SetCurrentFolderFlags,
3084 FolderView2_GetCurrentFolderFlags,
3085 FolderView2_GetSortColumnCount,
3086 FolderView2_SetSortColumns,
3087 FolderView2_GetSortColumns,
3088 FolderView2_GetItem,
3089 FolderView2_GetVisibleItem,
3090 FolderView2_GetSelectedItem,
3091 FolderView2_GetSelection,
3092 FolderView2_GetSelectionState,
3093 FolderView2_InvokeVerbOnSelection,
3094 FolderView2_SetViewModeAndIconSize,
3095 FolderView2_GetViewModeAndIconSize,
3096 FolderView2_SetGroupSubsetCount,
3097 FolderView2_GetGroupSubsetCount,
3098 FolderView2_SetRedraw,
3099 FolderView2_IsMoveInSameFolder,
3100 FolderView2_DoRename
3103 /* IShellFolderView */
3104 static HRESULT WINAPI IShellFolderView_fnQueryInterface(IShellFolderView *iface, REFIID riid, void **ppvObj)
3106 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3107 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
3110 static ULONG WINAPI IShellFolderView_fnAddRef(IShellFolderView *iface)
3112 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3113 return IShellView3_AddRef(&This->IShellView3_iface);
3116 static ULONG WINAPI IShellFolderView_fnRelease(IShellFolderView *iface)
3118 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3119 return IShellView3_Release(&This->IShellView3_iface);
3122 static HRESULT WINAPI IShellFolderView_fnRearrange(IShellFolderView *iface, LPARAM sort)
3124 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3125 FIXME("(%p)->(%ld) stub\n", This, sort);
3126 return E_NOTIMPL;
3129 static HRESULT WINAPI IShellFolderView_fnGetArrangeParam(IShellFolderView *iface, LPARAM *sort)
3131 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3132 FIXME("(%p)->(%p) stub\n", This, sort);
3133 return E_NOTIMPL;
3136 static HRESULT WINAPI IShellFolderView_fnArrangeGrid(IShellFolderView *iface)
3138 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3139 FIXME("(%p) stub\n", This);
3140 return E_NOTIMPL;
3143 static HRESULT WINAPI IShellFolderView_fnAutoArrange(IShellFolderView *iface)
3145 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3146 TRACE("(%p)\n", This);
3147 return IFolderView2_SetCurrentFolderFlags(&This->IFolderView2_iface, FWF_AUTOARRANGE, FWF_AUTOARRANGE);
3150 static HRESULT WINAPI IShellFolderView_fnGetAutoArrange(IShellFolderView *iface)
3152 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3153 TRACE("(%p)\n", This);
3154 return IFolderView2_GetAutoArrange(&This->IFolderView2_iface);
3157 static HRESULT WINAPI IShellFolderView_fnAddObject(
3158 IShellFolderView *iface,
3159 PITEMID_CHILD pidl,
3160 UINT *item)
3162 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3163 FIXME("(%p)->(%p %p) stub\n", This, pidl, item);
3164 return E_NOTIMPL;
3167 static HRESULT WINAPI IShellFolderView_fnGetObject(
3168 IShellFolderView *iface,
3169 PITEMID_CHILD *pidl,
3170 UINT item)
3172 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3173 TRACE("(%p)->(%p %d)\n", This, pidl, item);
3174 return IFolderView2_Item(&This->IFolderView2_iface, item, pidl);
3177 static HRESULT WINAPI IShellFolderView_fnRemoveObject(
3178 IShellFolderView *iface,
3179 PITEMID_CHILD pidl,
3180 UINT *item)
3182 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3184 TRACE("(%p)->(%p %p)\n", This, pidl, item);
3186 if (pidl)
3188 *item = LV_FindItemByPidl(This, ILFindLastID(pidl));
3189 SendMessageW(This->hWndList, LVM_DELETEITEM, *item, 0);
3191 else
3193 *item = 0;
3194 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
3197 return S_OK;
3200 static HRESULT WINAPI IShellFolderView_fnGetObjectCount(
3201 IShellFolderView *iface,
3202 UINT *count)
3204 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3205 TRACE("(%p)->(%p)\n", This, count);
3206 return IFolderView2_ItemCount(&This->IFolderView2_iface, SVGIO_ALLVIEW, (INT*)count);
3209 static HRESULT WINAPI IShellFolderView_fnSetObjectCount(
3210 IShellFolderView *iface,
3211 UINT count,
3212 UINT flags)
3214 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3215 FIXME("(%p)->(%d %x) stub\n", This, count, flags);
3216 return E_NOTIMPL;
3219 static HRESULT WINAPI IShellFolderView_fnUpdateObject(
3220 IShellFolderView *iface,
3221 PITEMID_CHILD pidl_old,
3222 PITEMID_CHILD pidl_new,
3223 UINT *item)
3225 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3226 FIXME("(%p)->(%p %p %p) stub\n", This, pidl_old, pidl_new, item);
3227 return E_NOTIMPL;
3230 static HRESULT WINAPI IShellFolderView_fnRefreshObject(
3231 IShellFolderView *iface,
3232 PITEMID_CHILD pidl,
3233 UINT *item)
3235 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3236 FIXME("(%p)->(%p %p) stub\n", This, pidl, item);
3237 return E_NOTIMPL;
3240 static HRESULT WINAPI IShellFolderView_fnSetRedraw(
3241 IShellFolderView *iface,
3242 BOOL redraw)
3244 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3245 TRACE("(%p)->(%d)\n", This, redraw);
3246 return IFolderView2_SetRedraw(&This->IFolderView2_iface, redraw);
3249 static HRESULT WINAPI IShellFolderView_fnGetSelectedCount(
3250 IShellFolderView *iface,
3251 UINT *count)
3253 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3254 IShellItemArray *selection;
3255 HRESULT hr;
3257 TRACE("(%p)->(%p)\n", This, count);
3259 *count = 0;
3260 hr = IFolderView2_GetSelection(&This->IFolderView2_iface, FALSE, &selection);
3261 if (FAILED(hr))
3262 return hr;
3264 hr = IShellItemArray_GetCount(selection, count);
3265 IShellItemArray_Release(selection);
3266 return hr;
3269 static HRESULT WINAPI IShellFolderView_fnGetSelectedObjects(
3270 IShellFolderView *iface,
3271 PCITEMID_CHILD **pidl,
3272 UINT *items)
3274 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3276 TRACE("(%p)->(%p %p)\n", This, pidl, items);
3278 *items = ShellView_GetSelections( This );
3280 if (*items)
3282 *pidl = LocalAlloc(0, *items*sizeof(LPITEMIDLIST));
3283 if (!*pidl) return E_OUTOFMEMORY;
3285 /* it's documented that caller shouldn't free PIDLs, only array itself */
3286 memcpy((PITEMID_CHILD*)*pidl, This->apidl, *items*sizeof(LPITEMIDLIST));
3289 return S_OK;
3292 static HRESULT WINAPI IShellFolderView_fnIsDropOnSource(
3293 IShellFolderView *iface,
3294 IDropTarget *drop_target)
3296 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3297 FIXME("(%p)->(%p) stub\n", This, drop_target);
3298 return E_NOTIMPL;
3301 static HRESULT WINAPI IShellFolderView_fnGetDragPoint(
3302 IShellFolderView *iface,
3303 POINT *pt)
3305 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3306 FIXME("(%p)->(%p) stub\n", This, pt);
3307 return E_NOTIMPL;
3310 static HRESULT WINAPI IShellFolderView_fnGetDropPoint(
3311 IShellFolderView *iface,
3312 POINT *pt)
3314 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3315 FIXME("(%p)->(%p) stub\n", This, pt);
3316 return E_NOTIMPL;
3319 static HRESULT WINAPI IShellFolderView_fnMoveIcons(
3320 IShellFolderView *iface,
3321 IDataObject *obj)
3323 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3324 TRACE("(%p)->(%p)\n", This, obj);
3325 return E_NOTIMPL;
3328 static HRESULT WINAPI IShellFolderView_fnSetItemPos(
3329 IShellFolderView *iface,
3330 PCUITEMID_CHILD pidl,
3331 POINT *pt)
3333 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3334 FIXME("(%p)->(%p %p) stub\n", This, pidl, pt);
3335 return E_NOTIMPL;
3338 static HRESULT WINAPI IShellFolderView_fnIsBkDropTarget(
3339 IShellFolderView *iface,
3340 IDropTarget *drop_target)
3342 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3343 FIXME("(%p)->(%p) stub\n", This, drop_target);
3344 return E_NOTIMPL;
3347 static HRESULT WINAPI IShellFolderView_fnSetClipboard(
3348 IShellFolderView *iface,
3349 BOOL move)
3351 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3352 FIXME("(%p)->(%d) stub\n", This, move);
3353 return E_NOTIMPL;
3356 static HRESULT WINAPI IShellFolderView_fnSetPoints(
3357 IShellFolderView *iface,
3358 IDataObject *obj)
3360 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3361 FIXME("(%p)->(%p) stub\n", This, obj);
3362 return E_NOTIMPL;
3365 static HRESULT WINAPI IShellFolderView_fnGetItemSpacing(
3366 IShellFolderView *iface,
3367 ITEMSPACING *spacing)
3369 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3370 FIXME("(%p)->(%p) stub\n", This, spacing);
3371 return E_NOTIMPL;
3374 static HRESULT WINAPI IShellFolderView_fnSetCallback(
3375 IShellFolderView *iface,
3376 IShellFolderViewCB *new_cb,
3377 IShellFolderViewCB **old_cb)
3380 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3381 FIXME("(%p)->(%p %p) stub\n", This, new_cb, old_cb);
3382 return E_NOTIMPL;
3385 static HRESULT WINAPI IShellFolderView_fnSelect(
3386 IShellFolderView *iface,
3387 UINT flags)
3389 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3390 FIXME("(%p)->(%d) stub\n", This, flags);
3391 return E_NOTIMPL;
3394 static HRESULT WINAPI IShellFolderView_fnQuerySupport(
3395 IShellFolderView *iface,
3396 UINT *support)
3398 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3399 TRACE("(%p)->(%p)\n", This, support);
3400 return S_OK;
3403 static HRESULT WINAPI IShellFolderView_fnSetAutomationObject(
3404 IShellFolderView *iface,
3405 IDispatch *disp)
3407 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3408 FIXME("(%p)->(%p) stub\n", This, disp);
3409 return E_NOTIMPL;
3412 static const IShellFolderViewVtbl shellfolderviewvtbl =
3414 IShellFolderView_fnQueryInterface,
3415 IShellFolderView_fnAddRef,
3416 IShellFolderView_fnRelease,
3417 IShellFolderView_fnRearrange,
3418 IShellFolderView_fnGetArrangeParam,
3419 IShellFolderView_fnArrangeGrid,
3420 IShellFolderView_fnAutoArrange,
3421 IShellFolderView_fnGetAutoArrange,
3422 IShellFolderView_fnAddObject,
3423 IShellFolderView_fnGetObject,
3424 IShellFolderView_fnRemoveObject,
3425 IShellFolderView_fnGetObjectCount,
3426 IShellFolderView_fnSetObjectCount,
3427 IShellFolderView_fnUpdateObject,
3428 IShellFolderView_fnRefreshObject,
3429 IShellFolderView_fnSetRedraw,
3430 IShellFolderView_fnGetSelectedCount,
3431 IShellFolderView_fnGetSelectedObjects,
3432 IShellFolderView_fnIsDropOnSource,
3433 IShellFolderView_fnGetDragPoint,
3434 IShellFolderView_fnGetDropPoint,
3435 IShellFolderView_fnMoveIcons,
3436 IShellFolderView_fnSetItemPos,
3437 IShellFolderView_fnIsBkDropTarget,
3438 IShellFolderView_fnSetClipboard,
3439 IShellFolderView_fnSetPoints,
3440 IShellFolderView_fnGetItemSpacing,
3441 IShellFolderView_fnSetCallback,
3442 IShellFolderView_fnSelect,
3443 IShellFolderView_fnQuerySupport,
3444 IShellFolderView_fnSetAutomationObject
3447 static HRESULT WINAPI shellfolderviewdual_QueryInterface(IShellFolderViewDual3 *iface, REFIID riid, void **ppvObj)
3449 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3451 TRACE("(%p)->(IID:%s,%p)\n", This, debugstr_guid(riid), ppvObj);
3453 if (IsEqualIID(riid, &IID_IShellFolderViewDual3) ||
3454 IsEqualIID(riid, &IID_IShellFolderViewDual2) ||
3455 IsEqualIID(riid, &IID_IShellFolderViewDual) ||
3456 IsEqualIID(riid, &IID_IDispatch) ||
3457 IsEqualIID(riid, &IID_IUnknown))
3459 *ppvObj = iface;
3460 IShellFolderViewDual3_AddRef(iface);
3461 return S_OK;
3464 WARN("unsupported interface %s\n", debugstr_guid(riid));
3465 return E_NOINTERFACE;
3468 static ULONG WINAPI shellfolderviewdual_AddRef(IShellFolderViewDual3 *iface)
3470 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3471 return IShellView3_AddRef(&This->IShellView3_iface);
3474 static ULONG WINAPI shellfolderviewdual_Release(IShellFolderViewDual3 *iface)
3476 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3477 return IShellView3_Release(&This->IShellView3_iface);
3480 static HRESULT WINAPI shellfolderviewdual_GetTypeInfoCount(IShellFolderViewDual3 *iface, UINT *pctinfo)
3482 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3483 TRACE("%p %p\n", This, pctinfo);
3484 *pctinfo = 1;
3485 return S_OK;
3488 static HRESULT WINAPI shellfolderviewdual_GetTypeInfo(IShellFolderViewDual3 *iface,
3489 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
3491 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3492 HRESULT hr;
3494 TRACE("(%p,%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
3496 hr = get_typeinfo(IShellFolderViewDual3_tid, ppTInfo);
3497 if (SUCCEEDED(hr))
3498 ITypeInfo_AddRef(*ppTInfo);
3499 return hr;
3502 static HRESULT WINAPI shellfolderviewdual_GetIDsOfNames(
3503 IShellFolderViewDual3 *iface, REFIID riid, LPOLESTR *rgszNames, UINT
3504 cNames, LCID lcid, DISPID *rgDispId)
3506 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3507 ITypeInfo *ti;
3508 HRESULT hr;
3510 TRACE("(%p, %s, %p, %u, %d, %p)\n", This, debugstr_guid(riid), rgszNames,
3511 cNames, lcid, rgDispId);
3513 hr = get_typeinfo(IShellFolderViewDual3_tid, &ti);
3514 if (SUCCEEDED(hr))
3515 hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
3516 return hr;
3519 static HRESULT WINAPI shellfolderviewdual_Invoke(IShellFolderViewDual3 *iface,
3520 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
3521 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
3522 UINT *puArgErr)
3524 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3525 ITypeInfo *ti;
3526 HRESULT hr;
3528 TRACE("(%p, %d, %s, %d, %u, %p, %p, %p, %p)\n", This, dispIdMember,
3529 debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult,
3530 pExcepInfo, puArgErr);
3532 hr = get_typeinfo(IShellFolderViewDual3_tid, &ti);
3533 if (SUCCEEDED(hr))
3534 hr = ITypeInfo_Invoke(ti, &This->IShellFolderViewDual3_iface, dispIdMember, wFlags, pDispParams,
3535 pVarResult, pExcepInfo, puArgErr);
3536 return hr;
3540 static HRESULT WINAPI shellfolderviewdual_get_Application(IShellFolderViewDual3 *iface,
3541 IDispatch **disp)
3543 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3545 TRACE("%p %p\n", This, disp);
3547 if (!disp)
3548 return E_INVALIDARG;
3550 return IShellDispatch_Constructor(NULL, &IID_IDispatch, (void**)disp);
3553 static HRESULT WINAPI shellfolderviewdual_get_Parent(IShellFolderViewDual3 *iface, IDispatch **disp)
3555 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3556 FIXME("%p %p\n", This, disp);
3557 return E_NOTIMPL;
3560 static HRESULT WINAPI shellfolderviewdual_get_Folder(IShellFolderViewDual3 *iface, Folder **folder)
3562 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3563 FIXME("%p %p\n", This, folder);
3564 return E_NOTIMPL;
3567 static HRESULT WINAPI shellfolderviewdual_SelectedItems(IShellFolderViewDual3 *iface, FolderItems **items)
3569 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3570 FIXME("%p %p\n", This, items);
3571 return E_NOTIMPL;
3574 static HRESULT WINAPI shellfolderviewdual_get_FocusedItem(IShellFolderViewDual3 *iface,
3575 FolderItem **item)
3577 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3578 FIXME("%p %p\n", This, item);
3579 return E_NOTIMPL;
3582 static HRESULT WINAPI shellfolderviewdual_SelectItem(IShellFolderViewDual3 *iface,
3583 VARIANT *v, int flags)
3585 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3586 FIXME("%p %s %x\n", This, debugstr_variant(v), flags);
3587 return E_NOTIMPL;
3590 static HRESULT WINAPI shellfolderviewdual_PopupItemMenu(IShellFolderViewDual3 *iface,
3591 FolderItem *item, VARIANT vx, VARIANT vy, BSTR *command)
3593 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3594 FIXME("%p %p %s %s %p\n", This, item, debugstr_variant(&vx), debugstr_variant(&vy), command);
3595 return E_NOTIMPL;
3598 static HRESULT WINAPI shellfolderviewdual_get_Script(IShellFolderViewDual3 *iface, IDispatch **disp)
3600 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3601 FIXME("%p %p\n", This, disp);
3602 return E_NOTIMPL;
3605 static HRESULT WINAPI shellfolderviewdual_get_ViewOptions(IShellFolderViewDual3 *iface, LONG *options)
3607 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3608 FIXME("%p %p\n", This, options);
3609 return E_NOTIMPL;
3612 static HRESULT WINAPI shellfolderviewdual_get_CurrentViewMode(IShellFolderViewDual3 *iface, UINT *mode)
3614 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3615 FIXME("%p %p\n", This, mode);
3616 return E_NOTIMPL;
3619 static HRESULT WINAPI shellfolderviewdual_put_CurrentViewMode(IShellFolderViewDual3 *iface, UINT mode)
3621 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3622 FIXME("%p %u\n", This, mode);
3623 return E_NOTIMPL;
3626 static HRESULT WINAPI shellfolderviewdual_SelectItemRelative(IShellFolderViewDual3 *iface, int relative)
3628 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3629 FIXME("%p %d\n", This, relative);
3630 return E_NOTIMPL;
3633 static HRESULT WINAPI shellfolderviewdual_get_GroupBy(IShellFolderViewDual3 *iface, BSTR *groupby)
3635 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3636 FIXME("%p %p\n", This, groupby);
3637 return E_NOTIMPL;
3640 static HRESULT WINAPI shellfolderviewdual_put_GroupBy(IShellFolderViewDual3 *iface, BSTR groupby)
3642 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3643 FIXME("%p %s\n", This, debugstr_w(groupby));
3644 return E_NOTIMPL;
3647 static HRESULT WINAPI shellfolderviewdual_get_FolderFlags(IShellFolderViewDual3 *iface, DWORD *flags)
3649 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3650 FIXME("%p %p\n", This, flags);
3651 return E_NOTIMPL;
3654 static HRESULT WINAPI shellfolderviewdual_put_FolderFlags(IShellFolderViewDual3 *iface, DWORD flags)
3656 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3657 FIXME("%p 0x%08x\n", This, flags);
3658 return E_NOTIMPL;
3661 static HRESULT WINAPI shellfolderviewdual_get_SortColumns(IShellFolderViewDual3 *iface, BSTR *sortcolumns)
3663 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3664 FIXME("%p %p\n", This, sortcolumns);
3665 return E_NOTIMPL;
3668 static HRESULT WINAPI shellfolderviewdual_put_SortColumns(IShellFolderViewDual3 *iface, BSTR sortcolumns)
3670 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3671 FIXME("%p %s\n", This, debugstr_w(sortcolumns));
3672 return E_NOTIMPL;
3675 static HRESULT WINAPI shellfolderviewdual_put_IconSize(IShellFolderViewDual3 *iface, int icon_size)
3677 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3678 FIXME("%p %d\n", This, icon_size);
3679 return E_NOTIMPL;
3682 static HRESULT WINAPI shellfolderviewdual_get_IconSize(IShellFolderViewDual3 *iface, int *icon_size)
3684 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3685 FIXME("%p %p\n", This, icon_size);
3686 return E_NOTIMPL;
3689 static HRESULT WINAPI shellfolderviewdual_FilterView(IShellFolderViewDual3 *iface, BSTR filter_text)
3691 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3692 FIXME("%p %s\n", This, debugstr_w(filter_text));
3693 return E_NOTIMPL;
3696 static const IShellFolderViewDual3Vtbl shellfolderviewdualvtbl =
3698 shellfolderviewdual_QueryInterface,
3699 shellfolderviewdual_AddRef,
3700 shellfolderviewdual_Release,
3701 shellfolderviewdual_GetTypeInfoCount,
3702 shellfolderviewdual_GetTypeInfo,
3703 shellfolderviewdual_GetIDsOfNames,
3704 shellfolderviewdual_Invoke,
3705 shellfolderviewdual_get_Application,
3706 shellfolderviewdual_get_Parent,
3707 shellfolderviewdual_get_Folder,
3708 shellfolderviewdual_SelectedItems,
3709 shellfolderviewdual_get_FocusedItem,
3710 shellfolderviewdual_SelectItem,
3711 shellfolderviewdual_PopupItemMenu,
3712 shellfolderviewdual_get_Script,
3713 shellfolderviewdual_get_ViewOptions,
3714 shellfolderviewdual_get_CurrentViewMode,
3715 shellfolderviewdual_put_CurrentViewMode,
3716 shellfolderviewdual_SelectItemRelative,
3717 shellfolderviewdual_get_GroupBy,
3718 shellfolderviewdual_put_GroupBy,
3719 shellfolderviewdual_get_FolderFlags,
3720 shellfolderviewdual_put_FolderFlags,
3721 shellfolderviewdual_get_SortColumns,
3722 shellfolderviewdual_put_SortColumns,
3723 shellfolderviewdual_put_IconSize,
3724 shellfolderviewdual_get_IconSize,
3725 shellfolderviewdual_FilterView
3728 /**********************************************************
3729 * IShellView_Constructor
3731 IShellView *IShellView_Constructor(IShellFolder *folder)
3733 IShellViewImpl *sv;
3735 sv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
3736 if (!sv)
3737 return NULL;
3739 sv->ref = 1;
3740 sv->IShellView3_iface.lpVtbl = &shellviewvtbl;
3741 sv->IOleCommandTarget_iface.lpVtbl = &olecommandtargetvtbl;
3742 sv->IDropTarget_iface.lpVtbl = &droptargetvtbl;
3743 sv->IDropSource_iface.lpVtbl = &dropsourcevtbl;
3744 sv->IViewObject_iface.lpVtbl = &viewobjectvtbl;
3745 sv->IFolderView2_iface.lpVtbl = &folderviewvtbl;
3746 sv->IShellFolderView_iface.lpVtbl = &shellfolderviewvtbl;
3747 sv->IShellFolderViewDual3_iface.lpVtbl = &shellfolderviewdualvtbl;
3749 sv->pSFParent = folder;
3750 if (folder) IShellFolder_AddRef(folder);
3751 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (void**)&sv->pSF2Parent);
3753 sv->pCurDropTarget = NULL;
3754 sv->pCurDataObject = NULL;
3755 sv->iDragOverItem = 0;
3756 sv->cScrollDelay = 0;
3757 sv->ptLastMousePos.x = 0;
3758 sv->ptLastMousePos.y = 0;
3760 TRACE("(%p)->(%p)\n", sv, folder);
3761 return (IShellView*)&sv->IShellView3_iface;