2 * Implementation of IShellBrowser for the File Open common dialog
4 * Copyright 1999 Francois Boisvert
5 * Copyright 1999, 2000 Juergen Schmied
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
37 #define NO_SHLWAPI_STREAM
39 #include "filedlgbrowser.h"
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
50 IShellBrowserVtbl * lpVtbl;
51 ICommDlgBrowserVtbl * lpVtblCommDlgBrowser;
52 IServiceProviderVtbl* lpVtblServiceProvider;
53 DWORD ref; /* Reference counter */
54 HWND hwndOwner; /* Owner dialog of the interface */
58 /**************************************************************************
61 static IShellBrowserVtbl IShellBrowserImpl_Vtbl;
62 static ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl;
63 static IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl;
65 /**************************************************************************
69 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
71 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
74 /**************************************************************************
77 extern const char *FileOpenDlgInfosStr;
79 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
80 extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
81 extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
82 extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl);
83 extern LPITEMIDLIST GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
85 extern BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
86 LPITEMIDLIST pidlCurrentFolder,
89 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
90 extern BOOL FILEDLG95_OnOpen(HWND hwnd);
91 extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
98 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos)
100 char lpstrPath[MAX_PATH];
101 if(SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath)) {
102 SetCurrentDirectoryA(lpstrPath);
103 TRACE("new current folder %s\n", lpstrPath);
107 /* copied from shell32 to avoid linking to it */
108 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPCITEMIDLIST pidl)
110 TRACE("dest=%p len=0x%lx strret=%p pidl=%p stub\n",dest,len,src,pidl);
115 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
116 COMDLG32_SHFree(src->u.pOleStr);
120 if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len ))
121 ((LPWSTR)dest)[len-1] = 0;
127 if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset,
128 -1, (LPWSTR)dest, len ))
129 ((LPWSTR)dest)[len-1] = 0;
134 FIXME("unknown type!\n");
136 { *(LPWSTR)dest = '\0';
147 /**************************************************************************
148 * IShellBrowserImpl_Construct
150 IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
152 IShellBrowserImpl *sb;
153 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
155 sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
157 /* Initialisation of the member variables */
159 sb->hwndOwner = hwndOwner;
161 /* Initialisation of the vTables */
162 sb->lpVtbl = &IShellBrowserImpl_Vtbl;
163 sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
164 sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl;
165 SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
166 &fodInfos->ShellInfos.pidlAbsCurrent);
170 return (IShellBrowser *) sb;
173 /***************************************************************************
174 * IShellBrowserImpl_QueryInterface
176 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
180 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
182 TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
186 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
189 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/
190 { *ppvObj = (IOleWindow*)This;
193 else if(IsEqualIID(riid, &IID_IShellBrowser)) /*IShellBrowser*/
194 { *ppvObj = (IShellBrowser*)This;
197 else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
198 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblCommDlgBrowser);
201 else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */
202 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblServiceProvider);
206 { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
209 FIXME("Unknown interface requested\n");
210 return E_NOINTERFACE;
213 /**************************************************************************
214 * IShellBrowser::AddRef
216 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
218 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
219 ULONG ref = InterlockedIncrement(&This->ref);
221 TRACE("(%p,%lu)\n", This, ref - 1);
226 /**************************************************************************
227 * IShellBrowserImpl_Release
229 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
231 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
232 ULONG ref = InterlockedDecrement(&This->ref);
234 TRACE("(%p,%lu)\n", This, ref + 1);
238 COMDLG32_SHFree(This);
239 TRACE("-- destroyed\n");
249 /**************************************************************************
250 * IShellBrowserImpl_GetWindow (IOleWindow)
252 * Inherited from IOleWindow::GetWindow
254 * See Windows documentation for more details
256 * Note : We will never be window less in the File Open dialog
259 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
262 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
264 TRACE("(%p)\n", This);
269 *phwnd = This->hwndOwner;
271 return (*phwnd) ? S_OK : E_UNEXPECTED;
275 /**************************************************************************
276 * IShellBrowserImpl_ContextSensitiveHelp
278 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
281 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
283 TRACE("(%p)\n", This);
285 /* Feature not implemented */
293 /**************************************************************************
294 * IShellBrowserImpl_BrowseObject
296 * See Windows documentation on IShellBrowser::BrowseObject for more details
298 * This function will override user specified flags and will always
299 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
301 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
306 IShellFolder *psfTmp;
308 FileOpenDlgInfos *fodInfos;
309 LPITEMIDLIST pidlTmp;
315 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
317 TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags,
318 (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" :
319 (wFlags & SBSP_PARENT) ? "SBSP_PARENT" :
320 (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????");
322 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
324 /* Format the pidl according to its parameter's category */
325 if(wFlags & SBSP_RELATIVE)
328 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
329 if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
330 pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
332 ERR("bind to object failed\n");
335 /* create an absolute pidl */
336 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
339 else if(wFlags & SBSP_PARENT)
341 /* Browse the parent folder (ignores the pidl) */
342 pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
343 psfTmp = GetShellFolderFromPidl(pidlTmp);
346 else /* SBSP_ABSOLUTE is 0x0000 */
348 /* An absolute pidl (relative from the desktop) */
349 pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
350 psfTmp = GetShellFolderFromPidl(pidlTmp);
355 ERR("could not browse to folder\n");
359 /* If the pidl to browse to is equal to the actual pidl ...
360 do nothing and pretend you did it*/
361 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
363 IShellFolder_Release(psfTmp);
364 COMDLG32_SHFree(pidlTmp);
365 TRACE("keep current folder\n");
369 /* Release the current DataObject */
370 if (fodInfos->Shell.FOIDataObject)
372 IDataObject_Release(fodInfos->Shell.FOIDataObject);
373 fodInfos->Shell.FOIDataObject = NULL;
376 /* Create the associated view */
377 TRACE("create view object\n");
378 if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
379 &IID_IShellView, (LPVOID *)&psvTmp))) goto error;
381 /* Check if listview has focus */
382 bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
384 /* Get the foldersettings from the old view */
385 if(fodInfos->Shell.FOIShellView)
386 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
388 /* Release the old fodInfos->Shell.FOIShellView and update its value.
389 We have to update this early since ShellView_CreateViewWindow of native
390 shell32 calls OnStateChange and needs the correct view here.*/
391 if(fodInfos->Shell.FOIShellView)
393 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
394 IShellView_Release(fodInfos->Shell.FOIShellView);
396 fodInfos->Shell.FOIShellView = psvTmp;
398 /* Release old FOIShellFolder and update its value */
399 if (fodInfos->Shell.FOIShellFolder)
400 IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
401 fodInfos->Shell.FOIShellFolder = psfTmp;
403 /* Release old pidlAbsCurrent and update its value */
404 COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
405 fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
407 COMDLG32_UpdateCurrentDir(fodInfos);
409 GetWindowRect(GetDlgItem(This->hwndOwner, IDC_SHELLSTATIC), &rectView);
410 MapWindowPoints(0, This->hwndOwner, (LPPOINT)&rectView, 2);
412 /* Create the window */
413 TRACE("create view window\n");
414 if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
415 &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
416 &rectView, &hwndView))) goto error;
418 fodInfos->ShellInfos.hwndView = hwndView;
420 /* Select the new folder in the Look In combo box of the Open file dialog */
421 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
423 /* changes the tab order of the ListView to reflect the window's File Dialog */
424 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
425 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
427 /* Since we destroyed the old view if it had focus set focus to the newly created view */
429 SetFocus(fodInfos->ShellInfos.hwndView);
433 ERR("Failed with error 0x%08lx\n", hRes);
437 /**************************************************************************
438 * IShellBrowserImpl_EnableModelessSB
440 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
444 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
446 TRACE("(%p)\n", This);
448 /* Feature not implemented */
452 /**************************************************************************
453 * IShellBrowserImpl_GetControlWindow
455 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
460 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
462 TRACE("(%p)\n", This);
464 /* Feature not implemented */
467 /**************************************************************************
468 * IShellBrowserImpl_GetViewStateStream
470 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
475 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
477 FIXME("(%p 0x%08lx %p)\n", This, grfMode, ppStrm);
479 /* Feature not implemented */
482 /**************************************************************************
483 * IShellBrowserImpl_InsertMenusSB
485 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
487 LPOLEMENUGROUPWIDTHS lpMenuWidths)
490 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
492 TRACE("(%p)\n", This);
494 /* Feature not implemented */
497 /**************************************************************************
498 * IShellBrowserImpl_OnViewWindowActive
500 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
504 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
506 TRACE("(%p)\n", This);
508 /* Feature not implemented */
511 /**************************************************************************
512 * IShellBrowserImpl_QueryActiveShellView
514 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
518 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
520 FileOpenDlgInfos *fodInfos;
522 TRACE("(%p)\n", This);
524 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
526 if(!(*ppshv = fodInfos->Shell.FOIShellView))
530 IShellView_AddRef(fodInfos->Shell.FOIShellView);
533 /**************************************************************************
534 * IShellBrowserImpl_RemoveMenusSB
536 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
540 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
542 TRACE("(%p)\n", This);
544 /* Feature not implemented */
547 /**************************************************************************
548 * IShellBrowserImpl_SendControlMsg
550 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
558 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
561 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
566 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
569 FIXME("ctrl id: %x\n", id);
572 if (pret) *pret = lres;
575 /**************************************************************************
576 * IShellBrowserImpl_SetMenuSB
578 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
580 HOLEMENU holemenuReserved,
581 HWND hwndActiveObject)
584 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
586 TRACE("(%p)\n", This);
588 /* Feature not implemented */
591 /**************************************************************************
592 * IShellBrowserImpl_SetStatusTextSB
594 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
595 LPCOLESTR lpszStatusText)
598 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
600 TRACE("(%p)\n", This);
602 /* Feature not implemented */
605 /**************************************************************************
606 * IShellBrowserImpl_SetToolbarItems
608 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
609 LPTBBUTTON lpButtons,
614 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
616 TRACE("(%p)\n", This);
618 /* Feature not implemented */
621 /**************************************************************************
622 * IShellBrowserImpl_TranslateAcceleratorSB
624 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
629 IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
631 TRACE("(%p)\n", This);
633 /* Feature not implemented */
637 static IShellBrowserVtbl IShellBrowserImpl_Vtbl =
640 IShellBrowserImpl_QueryInterface,
641 IShellBrowserImpl_AddRef,
642 IShellBrowserImpl_Release,
644 IShellBrowserImpl_GetWindow,
645 IShellBrowserImpl_ContextSensitiveHelp,
647 IShellBrowserImpl_InsertMenusSB,
648 IShellBrowserImpl_SetMenuSB,
649 IShellBrowserImpl_RemoveMenusSB,
650 IShellBrowserImpl_SetStatusTextSB,
651 IShellBrowserImpl_EnableModelessSB,
652 IShellBrowserImpl_TranslateAcceleratorSB,
653 IShellBrowserImpl_BrowseObject,
654 IShellBrowserImpl_GetViewStateStream,
655 IShellBrowserImpl_GetControlWindow,
656 IShellBrowserImpl_SendControlMsg,
657 IShellBrowserImpl_QueryActiveShellView,
658 IShellBrowserImpl_OnViewWindowActive,
659 IShellBrowserImpl_SetToolbarItems
668 /***************************************************************************
669 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
671 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
672 ICommDlgBrowser *iface,
676 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
678 TRACE("(%p)\n", This);
680 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
683 /**************************************************************************
684 * IShellBrowserImpl_ICommDlgBrowser_AddRef
686 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface)
688 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
690 TRACE("(%p)\n", This);
692 return IShellBrowserImpl_AddRef(This);
695 /**************************************************************************
696 * IShellBrowserImpl_ICommDlgBrowser_Release
698 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface)
700 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
702 TRACE("(%p)\n", This);
704 return IShellBrowserImpl_Release(This);
706 /**************************************************************************
707 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
709 * Called when a user double-clicks in the view or presses the ENTER key
711 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
715 FileOpenDlgInfos *fodInfos;
717 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
719 TRACE("(%p)\n", This);
721 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
723 /* If the selected object is not a folder, send an IDOK command to parent window */
724 if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
728 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
729 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr);
730 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
732 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
733 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
737 /* Tell the dialog that the user selected a file */
738 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
741 /* Free memory used by pidl */
742 COMDLG32_SHFree((LPVOID)pidl);
750 /**************************************************************************
751 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
753 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
758 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
760 TRACE("(%p shv=%p)\n", This, ppshv);
764 case CDBOSC_SETFOCUS:
765 /* FIXME: Reset the default button.
766 This should be taken care of by defdlg. If control
767 other than button receives focus the default button
768 should be restored. */
769 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
772 case CDBOSC_KILLFOCUS:
774 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
775 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
776 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
779 case CDBOSC_SELCHANGE:
780 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
789 /**************************************************************************
790 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
792 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
796 FileOpenDlgInfos *fodInfos;
799 WCHAR szPathW[MAX_PATH];
801 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
803 TRACE("(%p)\n", This);
805 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
807 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
808 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
810 if( (ulAttr & SFGAO_HIDDEN) /* hidden */
811 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
814 /* always include directories and links */
815 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
818 /* Check if there is a mask to apply if not */
819 if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
822 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
824 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
826 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
834 /**************************************************************************
835 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
837 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
839 FileOpenDlgInfos *fodInfos;
841 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
843 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
844 TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
846 /* release old selections */
847 if (fodInfos->Shell.FOIDataObject)
848 IDataObject_Release(fodInfos->Shell.FOIDataObject);
850 /* get a new DataObject from the ShellView */
851 if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
852 &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
855 FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
857 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
861 static ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl =
864 IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
865 IShellBrowserImpl_ICommDlgBrowser_AddRef,
866 IShellBrowserImpl_ICommDlgBrowser_Release,
867 /* ICommDlgBrowser */
868 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
869 IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
870 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
880 /***************************************************************************
881 * IShellBrowserImpl_IServiceProvider_QueryInterface
883 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
884 IServiceProvider *iface,
888 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
890 FIXME("(%p)\n", This);
892 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
895 /**************************************************************************
896 * IShellBrowserImpl_IServiceProvider_AddRef
898 ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
900 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
902 FIXME("(%p)\n", This);
904 return IShellBrowserImpl_AddRef(This);
907 /**************************************************************************
908 * IShellBrowserImpl_IServiceProvider_Release
910 ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
912 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
914 FIXME("(%p)\n", This);
916 return IShellBrowserImpl_Release(This);
919 /**************************************************************************
920 * IShellBrowserImpl_IServiceProvider_Release
923 * the w2k shellview asks for (guidService = SID_STopLevelBrowser,
924 * riid = IShellBrowser) to call SendControlMsg ().
930 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
931 IServiceProvider * iface,
936 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
938 FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
941 if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
943 return IShellBrowserImpl_QueryInterface(This,riid,ppv);
945 FIXME("(%p) unknown interface requested\n", This);
946 return E_NOINTERFACE;
950 static IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl =
953 IShellBrowserImpl_IServiceProvider_QueryInterface,
954 IShellBrowserImpl_IServiceProvider_AddRef,
955 IShellBrowserImpl_IServiceProvider_Release,
956 /* IServiceProvider */
957 IShellBrowserImpl_IServiceProvider_QueryService