2 * Implementation of IShellBrowser for the File Open common dialog
16 #include "debugtools.h"
19 #include "filedlgbrowser.h"
22 #include "wine/obj_serviceprovider.h"
24 DEFAULT_DEBUG_CHANNEL(commdlg
);
29 ICOM_VTABLE(IShellBrowser
) * lpVtbl
;
30 ICOM_VTABLE(ICommDlgBrowser
) * lpVtblCommDlgBrowser
;
31 ICOM_VTABLE(IServiceProvider
)* lpVtblServiceProvider
;
32 DWORD ref
; /* Reference counter */
33 HWND hwndOwner
; /* Owner dialog of the interface */
37 /**************************************************************************
40 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
;
41 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
42 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
;
44 /**************************************************************************
48 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
);
50 LPITEMIDLIST
GetSelectedPidl(IShellView
*ppshv
);
53 /**************************************************************************
56 extern const char *FileOpenDlgInfosStr
;
58 extern HRESULT
GetName(LPSHELLFOLDER lpsf
, LPITEMIDLIST pidl
,DWORD dwFlags
,LPSTR lpstrFileName
);
59 extern HRESULT
GetFileName(HWND hwnd
, LPITEMIDLIST pidl
, LPSTR lpstrFileName
);
60 extern IShellFolder
* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs
);
61 extern LPITEMIDLIST
GetParentPidl(LPITEMIDLIST pidl
);
62 extern LPITEMIDLIST
GetPidlFromName(IShellFolder
*psf
,LPCSTR lpcstrFileName
);
64 extern BOOL
FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd
,
65 LPITEMIDLIST pidlCurrentFolder
,
68 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd
,LPITEMIDLIST pidl
);
69 extern BOOL
FILEDLG95_OnOpen(HWND hwnd
);
70 extern HRESULT
SendCustomDlgNotificationMessage(HWND hwndParentDlg
, UINT uCode
);
77 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos
*fodInfos
)
79 char lpstrPath
[MAX_PATH
];
80 SHGetPathFromIDListA(fodInfos
->ShellInfos
.pidlAbsCurrent
,lpstrPath
);
81 SetCurrentDirectoryA(lpstrPath
);
82 TRACE("new current folder %s\n", lpstrPath
);
85 /* copied from shell32 to avoid linking to it */
86 static HRESULT
COMDLG32_StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
88 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
93 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
94 COMDLG32_SHFree(src
->u
.pOleStr
);
98 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, src
->u
.cStr
, -1, (LPWSTR
)dest
, len
))
99 ((LPWSTR
)dest
)[len
-1] = 0;
105 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
,
106 -1, (LPWSTR
)dest
, len
))
107 ((LPWSTR
)dest
)[len
-1] = 0;
112 FIXME("unknown type!\n");
114 { *(LPWSTR
)dest
= '\0';
125 /**************************************************************************
126 * IShellBrowserImpl_Construct
128 IShellBrowser
* IShellBrowserImpl_Construct(HWND hwndOwner
)
130 IShellBrowserImpl
*sb
;
131 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(hwndOwner
,FileOpenDlgInfosStr
);
133 sb
=(IShellBrowserImpl
*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl
));
135 /* Initialisation of the member variables */
137 sb
->hwndOwner
= hwndOwner
;
139 /* Initialisation of the vTables */
140 sb
->lpVtbl
= &IShellBrowserImpl_Vtbl
;
141 sb
->lpVtblCommDlgBrowser
= &IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
142 sb
->lpVtblServiceProvider
= &IShellBrowserImpl_IServiceProvider_Vtbl
;
143 SHGetSpecialFolderLocation(hwndOwner
, CSIDL_DESKTOP
,
144 &fodInfos
->ShellInfos
.pidlAbsCurrent
);
148 return (IShellBrowser
*) sb
;
151 /***************************************************************************
152 * IShellBrowserImpl_QueryInterface
154 HRESULT WINAPI
IShellBrowserImpl_QueryInterface(IShellBrowser
*iface
,
158 ICOM_THIS(IShellBrowserImpl
, iface
);
160 TRACE("(%p)\n\t%s\n", This
, debugstr_guid(riid
));
164 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
167 else if(IsEqualIID(riid
, &IID_IOleWindow
)) /*IOleWindow*/
168 { *ppvObj
= (IOleWindow
*)This
;
171 else if(IsEqualIID(riid
, &IID_IShellBrowser
)) /*IShellBrowser*/
172 { *ppvObj
= (IShellBrowser
*)This
;
175 else if(IsEqualIID(riid
, &IID_ICommDlgBrowser
)) /*ICommDlgBrowser*/
176 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblCommDlgBrowser
);
179 else if(IsEqualIID(riid
, &IID_IServiceProvider
)) /* IServiceProvider */
180 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblServiceProvider
);
184 { IUnknown_AddRef( (IShellBrowser
*) *ppvObj
);
187 FIXME("Unknown interface requested\n");
188 return E_NOINTERFACE
;
191 /**************************************************************************
192 * IShellBrowser::AddRef
194 ULONG WINAPI
IShellBrowserImpl_AddRef(IShellBrowser
* iface
)
196 ICOM_THIS(IShellBrowserImpl
, iface
);
198 TRACE("(%p)\n", This
);
200 return ++(This
->ref
);
203 /**************************************************************************
204 * IShellBrowserImpl_Release
206 ULONG WINAPI
IShellBrowserImpl_Release(IShellBrowser
* iface
)
208 ICOM_THIS(IShellBrowserImpl
, iface
);
210 TRACE("(%p)\n", This
);
214 HeapFree(GetProcessHeap(),0, This
);
224 /**************************************************************************
225 * IShellBrowserImpl_GetWindow (IOleWindow)
227 * Inherited from IOleWindow::GetWindow
229 * See Windows documentation for more details
231 * Note : We will never be window less in the File Open dialog
234 HRESULT WINAPI
IShellBrowserImpl_GetWindow(IShellBrowser
* iface
,
237 ICOM_THIS(IShellBrowserImpl
, iface
);
239 TRACE("(%p)\n", This
);
244 *phwnd
= This
->hwndOwner
;
246 return (*phwnd
) ? S_OK
: E_UNEXPECTED
;
250 /**************************************************************************
251 * IShellBrowserImpl_ContextSensitiveHelp
253 HRESULT WINAPI
IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser
* iface
,
256 ICOM_THIS(IShellBrowserImpl
, iface
);
258 TRACE("(%p)\n", This
);
260 /* Feature not implemented */
268 /**************************************************************************
269 * IShellBrowserImpl_BrowseObject
271 * See Windows documentation on IShellBrowser::BrowseObject for more details
273 * This function will override user specified flags and will always
274 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
276 HRESULT WINAPI
IShellBrowserImpl_BrowseObject(IShellBrowser
*iface
,
281 IShellFolder
*psfTmp
;
283 FileOpenDlgInfos
*fodInfos
;
284 LPITEMIDLIST pidlTmp
;
289 ICOM_THIS(IShellBrowserImpl
, iface
);
291 TRACE("(%p)(%p,0x%08x)\n", This
, pidl
, wFlags
);
293 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
295 /* Format the pidl according to its parameter's category */
296 if(wFlags
& SBSP_RELATIVE
)
299 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
300 if(FAILED(hRes
= IShellFolder_BindToObject(fodInfos
->Shell
.FOIShellFolder
,
301 pidl
, NULL
, &IID_IShellFolder
, (LPVOID
*)&psfTmp
)))
303 ERR("bind to object failed\n");
306 /* create an absolute pidl */
307 pidlTmp
= COMDLG32_PIDL_ILCombine(fodInfos
->ShellInfos
.pidlAbsCurrent
,
310 else if(wFlags
& SBSP_PARENT
)
312 /* Browse the parent folder (ignores the pidl) */
313 pidlTmp
= GetParentPidl(fodInfos
->ShellInfos
.pidlAbsCurrent
);
314 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
317 else /* SBSP_ABSOLUTE is 0x0000 */
319 /* An absolute pidl (relative from the desktop) */
320 pidlTmp
= COMDLG32_PIDL_ILClone((LPITEMIDLIST
)pidl
);
321 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
326 ERR("could not browse to folder\n");
330 /* If the pidl to browse to is equal to the actual pidl ...
331 do nothing and pretend you did it*/
332 if(COMDLG32_PIDL_ILIsEqual(pidlTmp
,fodInfos
->ShellInfos
.pidlAbsCurrent
))
334 IShellFolder_Release(psfTmp
);
335 COMDLG32_SHFree(pidlTmp
);
336 TRACE("keep current folder\n");
340 /* Release the current DataObject */
341 if (fodInfos
->Shell
.FOIDataObject
)
343 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
344 fodInfos
->Shell
.FOIDataObject
= NULL
;
347 /* Create the associated view */
348 TRACE("create view object\n");
349 if(FAILED(hRes
= IShellFolder_CreateViewObject(psfTmp
, fodInfos
->ShellInfos
.hwndOwner
,
350 &IID_IShellView
, (LPVOID
*)&psvTmp
))) goto error
;
352 /* Check if listview has focus */
353 bViewHasFocus
= IsChild(fodInfos
->ShellInfos
.hwndView
,GetFocus());
355 /* Get the foldersettings from the old view */
356 if(fodInfos
->Shell
.FOIShellView
)
357 IShellView_GetCurrentInfo(fodInfos
->Shell
.FOIShellView
, &fodInfos
->ShellInfos
.folderSettings
);
359 /* Release the old fodInfos->Shell.FOIShellView and update its value.
360 We have to update this early since ShellView_CreateViewWindow of native
361 shell32 calls OnStateChange and needs the correct view here.*/
362 if(fodInfos
->Shell
.FOIShellView
)
364 IShellView_DestroyViewWindow(fodInfos
->Shell
.FOIShellView
);
365 IShellView_Release(fodInfos
->Shell
.FOIShellView
);
367 fodInfos
->Shell
.FOIShellView
= psvTmp
;
369 /* Release old FOIShellFolder and update its value */
370 if (fodInfos
->Shell
.FOIShellFolder
)
371 IShellFolder_Release(fodInfos
->Shell
.FOIShellFolder
);
372 fodInfos
->Shell
.FOIShellFolder
= psfTmp
;
374 /* Release old pidlAbsCurrent and update its value */
375 COMDLG32_SHFree((LPVOID
)fodInfos
->ShellInfos
.pidlAbsCurrent
);
376 fodInfos
->ShellInfos
.pidlAbsCurrent
= pidlTmp
;
378 COMDLG32_UpdateCurrentDir(fodInfos
);
380 /* Create the window */
381 TRACE("create view window\n");
382 if(FAILED(hRes
= IShellView_CreateViewWindow(psvTmp
, NULL
,
383 &fodInfos
->ShellInfos
.folderSettings
, fodInfos
->Shell
.FOIShellBrowser
,
384 &fodInfos
->ShellInfos
.rectView
, &hwndView
))) goto error
;
386 fodInfos
->ShellInfos
.hwndView
= hwndView
;
388 /* Select the new folder in the Look In combo box of the Open file dialog */
389 FILEDLG95_LOOKIN_SelectItem(fodInfos
->DlgInfos
.hwndLookInCB
,fodInfos
->ShellInfos
.pidlAbsCurrent
);
391 /* changes the tab order of the ListView to reflect the window's File Dialog */
392 hDlgWnd
= GetDlgItem(GetParent(hwndView
), IDC_LOOKIN
);
393 SetWindowPos(hwndView
, hDlgWnd
, 0,0,0,0, SWP_NOMOVE
| SWP_NOSIZE
);
395 /* Since we destroyed the old view if it had focus set focus to the newly created view */
397 SetFocus(fodInfos
->ShellInfos
.hwndView
);
401 ERR("Failed with error 0x%08lx\n", hRes
);
405 /**************************************************************************
406 * IShellBrowserImpl_EnableModelessSB
408 HRESULT WINAPI
IShellBrowserImpl_EnableModelessSB(IShellBrowser
*iface
,
412 ICOM_THIS(IShellBrowserImpl
, iface
);
414 TRACE("(%p)\n", This
);
416 /* Feature not implemented */
420 /**************************************************************************
421 * IShellBrowserImpl_GetControlWindow
423 HRESULT WINAPI
IShellBrowserImpl_GetControlWindow(IShellBrowser
*iface
,
428 ICOM_THIS(IShellBrowserImpl
, iface
);
430 TRACE("(%p)\n", This
);
432 /* Feature not implemented */
435 /**************************************************************************
436 * IShellBrowserImpl_GetViewStateStream
438 HRESULT WINAPI
IShellBrowserImpl_GetViewStateStream(IShellBrowser
*iface
,
443 ICOM_THIS(IShellBrowserImpl
, iface
);
445 FIXME("(%p 0x%08lx %p)\n", This
, grfMode
, ppStrm
);
447 /* Feature not implemented */
450 /**************************************************************************
451 * IShellBrowserImpl_InsertMenusSB
453 HRESULT WINAPI
IShellBrowserImpl_InsertMenusSB(IShellBrowser
*iface
,
455 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
458 ICOM_THIS(IShellBrowserImpl
, iface
);
460 TRACE("(%p)\n", This
);
462 /* Feature not implemented */
465 /**************************************************************************
466 * IShellBrowserImpl_OnViewWindowActive
468 HRESULT WINAPI
IShellBrowserImpl_OnViewWindowActive(IShellBrowser
*iface
,
472 ICOM_THIS(IShellBrowserImpl
, iface
);
474 TRACE("(%p)\n", This
);
476 /* Feature not implemented */
479 /**************************************************************************
480 * IShellBrowserImpl_QueryActiveShellView
482 HRESULT WINAPI
IShellBrowserImpl_QueryActiveShellView(IShellBrowser
*iface
,
486 ICOM_THIS(IShellBrowserImpl
, iface
);
488 FileOpenDlgInfos
*fodInfos
;
490 TRACE("(%p)\n", This
);
492 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
494 if(!(*ppshv
= fodInfos
->Shell
.FOIShellView
))
498 IShellView_AddRef(fodInfos
->Shell
.FOIShellView
);
501 /**************************************************************************
502 * IShellBrowserImpl_RemoveMenusSB
504 HRESULT WINAPI
IShellBrowserImpl_RemoveMenusSB(IShellBrowser
*iface
,
508 ICOM_THIS(IShellBrowserImpl
, iface
);
510 TRACE("(%p)\n", This
);
512 /* Feature not implemented */
515 /**************************************************************************
516 * IShellBrowserImpl_SendControlMsg
518 HRESULT WINAPI
IShellBrowserImpl_SendControlMsg(IShellBrowser
*iface
,
526 ICOM_THIS(IShellBrowserImpl
, iface
);
529 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This
, id
, uMsg
, wParam
, lParam
, pret
);
534 lres
= SendDlgItemMessageA( This
->hwndOwner
, IDC_TOOLBAR
, uMsg
, wParam
, lParam
);
537 FIXME("ctrl id: %x\n", id
);
540 if (pret
) *pret
= lres
;
543 /**************************************************************************
544 * IShellBrowserImpl_SetMenuSB
546 HRESULT WINAPI
IShellBrowserImpl_SetMenuSB(IShellBrowser
*iface
,
548 HOLEMENU holemenuReserved
,
549 HWND hwndActiveObject
)
552 ICOM_THIS(IShellBrowserImpl
, iface
);
554 TRACE("(%p)\n", This
);
556 /* Feature not implemented */
559 /**************************************************************************
560 * IShellBrowserImpl_SetStatusTextSB
562 HRESULT WINAPI
IShellBrowserImpl_SetStatusTextSB(IShellBrowser
*iface
,
563 LPCOLESTR lpszStatusText
)
566 ICOM_THIS(IShellBrowserImpl
, iface
);
568 TRACE("(%p)\n", This
);
570 /* Feature not implemented */
573 /**************************************************************************
574 * IShellBrowserImpl_SetToolbarItems
576 HRESULT WINAPI
IShellBrowserImpl_SetToolbarItems(IShellBrowser
*iface
,
577 LPTBBUTTON lpButtons
,
582 ICOM_THIS(IShellBrowserImpl
, iface
);
584 TRACE("(%p)\n", This
);
586 /* Feature not implemented */
589 /**************************************************************************
590 * IShellBrowserImpl_TranslateAcceleratorSB
592 HRESULT WINAPI
IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser
*iface
,
597 ICOM_THIS(IShellBrowserImpl
, iface
);
599 TRACE("(%p)\n", This
);
601 /* Feature not implemented */
605 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
=
607 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
609 IShellBrowserImpl_QueryInterface
,
610 IShellBrowserImpl_AddRef
,
611 IShellBrowserImpl_Release
,
613 IShellBrowserImpl_GetWindow
,
614 IShellBrowserImpl_ContextSensitiveHelp
,
616 IShellBrowserImpl_InsertMenusSB
,
617 IShellBrowserImpl_SetMenuSB
,
618 IShellBrowserImpl_RemoveMenusSB
,
619 IShellBrowserImpl_SetStatusTextSB
,
620 IShellBrowserImpl_EnableModelessSB
,
621 IShellBrowserImpl_TranslateAcceleratorSB
,
622 IShellBrowserImpl_BrowseObject
,
623 IShellBrowserImpl_GetViewStateStream
,
624 IShellBrowserImpl_GetControlWindow
,
625 IShellBrowserImpl_SendControlMsg
,
626 IShellBrowserImpl_QueryActiveShellView
,
627 IShellBrowserImpl_OnViewWindowActive
,
628 IShellBrowserImpl_SetToolbarItems
637 /***************************************************************************
638 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
640 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
641 ICommDlgBrowser
*iface
,
645 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
647 TRACE("(%p)\n", This
);
649 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
652 /**************************************************************************
653 * IShellBrowserImpl_ICommDlgBrowser_AddRef
655 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser
* iface
)
657 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
659 TRACE("(%p)\n", This
);
661 return IShellBrowserImpl_AddRef(This
);
664 /**************************************************************************
665 * IShellBrowserImpl_ICommDlgBrowser_Release
667 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser
* iface
)
669 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
671 TRACE("(%p)\n", This
);
673 return IShellBrowserImpl_Release(This
);
675 /**************************************************************************
676 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
678 * Called when a user double-clicks in the view or presses the ENTER key
680 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser
*iface
,
684 FileOpenDlgInfos
*fodInfos
;
686 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
688 TRACE("(%p)\n", This
);
690 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
692 /* If the selected object is not a folder, send a IDOK command to parent window */
693 if((pidl
= GetPidlFromDataObject(fodInfos
->Shell
.FOIDataObject
, 1)))
697 ULONG ulAttr
= SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
;
698 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
699 if (ulAttr
& (SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
) )
701 hRes
= IShellBrowser_BrowseObject((IShellBrowser
*)This
,pidl
,SBSP_RELATIVE
);
705 /* Tell the dialog that the user selected a file */
706 hRes
= PostMessageA(This
->hwndOwner
, WM_COMMAND
, IDOK
, 0L);
709 /* Free memory used by pidl */
710 COMDLG32_SHFree((LPVOID
)pidl
);
718 /**************************************************************************
719 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
721 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser
*iface
,
726 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
728 TRACE("(%p shv=%p)\n", This
, ppshv
);
732 case CDBOSC_SETFOCUS
:
733 /* FIXME: Reset the default button.
734 This should be taken care of by defdlg. If control
735 other than button receives focus the default button
736 should be restored. */
737 SendMessageA(This
->hwndOwner
, DM_SETDEFID
, IDOK
, 0);
740 case CDBOSC_KILLFOCUS
:
742 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
743 if(fodInfos
->DlgInfos
.dwDlgProp
& FODPROP_SAVEDLG
)
744 SetDlgItemTextA(fodInfos
->ShellInfos
.hwndOwner
,IDOK
,"&Save");
747 case CDBOSC_SELCHANGE
:
748 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface
,ppshv
);
757 /**************************************************************************
758 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
760 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser
*iface
,
764 FileOpenDlgInfos
*fodInfos
;
767 WCHAR szPathW
[MAX_PATH
];
769 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
771 TRACE("(%p)\n", This
);
773 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
775 ulAttr
= SFGAO_HIDDEN
| SFGAO_FOLDER
| SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
| SFGAO_LINK
;
776 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
778 if( (ulAttr
& SFGAO_HIDDEN
) /* hidden */
779 | !(ulAttr
& (SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
))) /* special folder */
782 /* always include directorys and links */
783 if(ulAttr
& (SFGAO_FOLDER
| SFGAO_LINK
))
786 /* Check if there is a mask to apply if not */
787 if(!fodInfos
->ShellInfos
.lpstrCurrentFilter
|| !lstrlenW(fodInfos
->ShellInfos
.lpstrCurrentFilter
))
790 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos
->Shell
.FOIShellFolder
, pidl
, SHGDN_INFOLDER
| SHGDN_FORPARSING
, &str
)))
792 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW
, MAX_PATH
, &str
, pidl
)))
794 if (PathMatchSpecW(szPathW
, fodInfos
->ShellInfos
.lpstrCurrentFilter
))
802 /**************************************************************************
803 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
805 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
)
807 FileOpenDlgInfos
*fodInfos
;
809 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
811 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
812 TRACE("(%p do=%p view=%p)\n", This
, fodInfos
->Shell
.FOIDataObject
, fodInfos
->Shell
.FOIShellView
);
814 /* release old selections */
815 if (fodInfos
->Shell
.FOIDataObject
)
816 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
818 /* get a new DataObject from the ShellView */
819 if(FAILED(IShellView_GetItemObject(fodInfos
->Shell
.FOIShellView
, SVGIO_SELECTION
,
820 &IID_IDataObject
, (LPVOID
*)&fodInfos
->Shell
.FOIDataObject
)))
823 FILEDLG95_FILENAME_FillFromSelection(This
->hwndOwner
);
825 SendCustomDlgNotificationMessage(This
->hwndOwner
, CDN_SELCHANGE
);
829 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
=
831 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
833 IShellBrowserImpl_ICommDlgBrowser_QueryInterface
,
834 IShellBrowserImpl_ICommDlgBrowser_AddRef
,
835 IShellBrowserImpl_ICommDlgBrowser_Release
,
836 /* ICommDlgBrowser */
837 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
,
838 IShellBrowserImpl_ICommDlgBrowser_OnStateChange
,
839 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
849 /***************************************************************************
850 * IShellBrowserImpl_IServiceProvider_QueryInterface
852 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryInterface(
853 IServiceProvider
*iface
,
857 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
859 FIXME("(%p)\n", This
);
861 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
864 /**************************************************************************
865 * IShellBrowserImpl_IServiceProvider_AddRef
867 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider
* iface
)
869 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
871 FIXME("(%p)\n", This
);
873 return IShellBrowserImpl_AddRef(This
);
876 /**************************************************************************
877 * IShellBrowserImpl_IServiceProvider_Release
879 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_Release(IServiceProvider
* iface
)
881 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
883 FIXME("(%p)\n", This
);
885 return IShellBrowserImpl_Release(This
);
888 /**************************************************************************
889 * IShellBrowserImpl_IServiceProvider_Release
892 * the w2k shellview asks for
893 * guidService = SID_STopLevelBrowser
894 * riid = IShellBrowser
900 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryService(
901 IServiceProvider
* iface
,
906 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
908 FIXME("(%p)\n\t%s\n\t%s\n", This
,debugstr_guid(guidService
), debugstr_guid(riid
) );
911 if(guidService
&& IsEqualIID(guidService
, &SID_STopLevelBrowser
))
913 return IShellBrowserImpl_QueryInterface(This
,riid
,ppv
);
915 FIXME("(%p) unknown interface requested\n", This
);
916 return E_NOINTERFACE
;
920 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
=
922 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
924 IShellBrowserImpl_IServiceProvider_QueryInterface
,
925 IShellBrowserImpl_IServiceProvider_AddRef
,
926 IShellBrowserImpl_IServiceProvider_Release
,
927 /* IServiceProvider */
928 IShellBrowserImpl_IServiceProvider_QueryService