2 * Implementation of IShellBrowser for the File Open common dialog
15 #include "debugtools.h"
18 #include "filedlgbrowser.h"
21 #include "wine/obj_serviceprovider.h"
23 DEFAULT_DEBUG_CHANNEL(commdlg
);
28 ICOM_VTABLE(IShellBrowser
) * lpVtbl
;
29 ICOM_VTABLE(ICommDlgBrowser
) * lpVtblCommDlgBrowser
;
30 ICOM_VTABLE(IServiceProvider
)* lpVtblServiceProvider
;
31 DWORD ref
; /* Reference counter */
32 HWND hwndOwner
; /* Owner dialog of the interface */
36 /**************************************************************************
39 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
;
40 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
41 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
;
43 /**************************************************************************
47 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
);
49 LPITEMIDLIST
GetSelectedPidl(IShellView
*ppshv
);
52 /**************************************************************************
55 extern const char *FileOpenDlgInfosStr
;
57 extern HRESULT
GetName(LPSHELLFOLDER lpsf
, LPITEMIDLIST pidl
,DWORD dwFlags
,LPSTR lpstrFileName
);
58 extern HRESULT
GetFileName(HWND hwnd
, LPITEMIDLIST pidl
, LPSTR lpstrFileName
);
59 extern IShellFolder
* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs
);
60 extern LPITEMIDLIST
GetParentPidl(LPITEMIDLIST pidl
);
61 extern LPITEMIDLIST
GetPidlFromName(IShellFolder
*psf
,LPCSTR lpcstrFileName
);
63 extern BOOL
FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd
,
64 LPITEMIDLIST pidlCurrentFolder
,
67 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd
,LPITEMIDLIST pidl
);
68 extern BOOL
FILEDLG95_OnOpen(HWND hwnd
);
69 extern HRESULT
SendCustomDlgNotificationMessage(HWND hwndParentDlg
, UINT uCode
);
76 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos
*fodInfos
)
78 char lpstrPath
[MAX_PATH
];
79 SHGetPathFromIDListA(fodInfos
->ShellInfos
.pidlAbsCurrent
,lpstrPath
);
80 SetCurrentDirectoryA(lpstrPath
);
81 TRACE("new current folder %s\n", lpstrPath
);
84 /* copied from shell32 to avoid linking to it */
85 static HRESULT
COMDLG32_StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
87 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
92 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
93 COMDLG32_SHFree(src
->u
.pOleStr
);
97 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, src
->u
.cStr
, -1, (LPWSTR
)dest
, len
))
98 ((LPWSTR
)dest
)[len
-1] = 0;
104 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
,
105 -1, (LPWSTR
)dest
, len
))
106 ((LPWSTR
)dest
)[len
-1] = 0;
111 FIXME("unknown type!\n");
113 { *(LPWSTR
)dest
= '\0';
124 /**************************************************************************
125 * IShellBrowserImpl_Construct
127 IShellBrowser
* IShellBrowserImpl_Construct(HWND hwndOwner
)
129 IShellBrowserImpl
*sb
;
130 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(hwndOwner
,FileOpenDlgInfosStr
);
132 sb
=(IShellBrowserImpl
*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl
));
134 /* Initialisation of the member variables */
136 sb
->hwndOwner
= hwndOwner
;
138 /* Initialisation of the vTables */
139 sb
->lpVtbl
= &IShellBrowserImpl_Vtbl
;
140 sb
->lpVtblCommDlgBrowser
= &IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
141 sb
->lpVtblServiceProvider
= &IShellBrowserImpl_IServiceProvider_Vtbl
;
142 SHGetSpecialFolderLocation(hwndOwner
, CSIDL_DESKTOP
,
143 &fodInfos
->ShellInfos
.pidlAbsCurrent
);
147 return (IShellBrowser
*) sb
;
150 /***************************************************************************
151 * IShellBrowserImpl_QueryInterface
153 HRESULT WINAPI
IShellBrowserImpl_QueryInterface(IShellBrowser
*iface
,
157 ICOM_THIS(IShellBrowserImpl
, iface
);
159 TRACE("(%p)\n\t%s\n", This
, debugstr_guid(riid
));
163 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
166 else if(IsEqualIID(riid
, &IID_IOleWindow
)) /*IOleWindow*/
167 { *ppvObj
= (IOleWindow
*)This
;
170 else if(IsEqualIID(riid
, &IID_IShellBrowser
)) /*IShellBrowser*/
171 { *ppvObj
= (IShellBrowser
*)This
;
174 else if(IsEqualIID(riid
, &IID_ICommDlgBrowser
)) /*ICommDlgBrowser*/
175 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblCommDlgBrowser
);
178 else if(IsEqualIID(riid
, &IID_IServiceProvider
)) /* IServiceProvider */
179 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblServiceProvider
);
183 { IUnknown_AddRef( (IShellBrowser
*) *ppvObj
);
186 FIXME("Unknown interface requested\n");
187 return E_NOINTERFACE
;
190 /**************************************************************************
191 * IShellBrowser::AddRef
193 ULONG WINAPI
IShellBrowserImpl_AddRef(IShellBrowser
* iface
)
195 ICOM_THIS(IShellBrowserImpl
, iface
);
197 TRACE("(%p)\n", This
);
199 return ++(This
->ref
);
202 /**************************************************************************
203 * IShellBrowserImpl_Release
205 ULONG WINAPI
IShellBrowserImpl_Release(IShellBrowser
* iface
)
207 ICOM_THIS(IShellBrowserImpl
, iface
);
209 TRACE("(%p)\n", This
);
213 HeapFree(GetProcessHeap(),0, This
);
223 /**************************************************************************
224 * IShellBrowserImpl_GetWindow (IOleWindow)
226 * Inherited from IOleWindow::GetWindow
228 * See Windows documentation for more details
230 * Note : We will never be window less in the File Open dialog
233 HRESULT WINAPI
IShellBrowserImpl_GetWindow(IShellBrowser
* iface
,
236 ICOM_THIS(IShellBrowserImpl
, iface
);
238 TRACE("(%p)\n", This
);
243 *phwnd
= This
->hwndOwner
;
245 return (*phwnd
) ? S_OK
: E_UNEXPECTED
;
249 /**************************************************************************
250 * IShellBrowserImpl_ContextSensitiveHelp
252 HRESULT WINAPI
IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser
* iface
,
255 ICOM_THIS(IShellBrowserImpl
, iface
);
257 TRACE("(%p)\n", This
);
259 /* Feature not implemented */
267 /**************************************************************************
268 * IShellBrowserImpl_BrowseObject
270 * See Windows documentation on IShellBrowser::BrowseObject for more details
272 * This function will override user specified flags and will always
273 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
275 HRESULT WINAPI
IShellBrowserImpl_BrowseObject(IShellBrowser
*iface
,
280 IShellFolder
*psfTmp
;
282 FileOpenDlgInfos
*fodInfos
;
283 LPITEMIDLIST pidlTmp
;
288 ICOM_THIS(IShellBrowserImpl
, iface
);
290 TRACE("(%p)(%p,0x%08x)\n", This
, pidl
, wFlags
);
292 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
294 /* Format the pidl according to its parameter's category */
295 if(wFlags
& SBSP_RELATIVE
)
298 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
299 if(FAILED(hRes
= IShellFolder_BindToObject(fodInfos
->Shell
.FOIShellFolder
,
300 pidl
, NULL
, &IID_IShellFolder
, (LPVOID
*)&psfTmp
)))
302 ERR("bind to object failed\n");
305 /* create an absolute pidl */
306 pidlTmp
= COMDLG32_PIDL_ILCombine(fodInfos
->ShellInfos
.pidlAbsCurrent
,
309 else if(wFlags
& SBSP_PARENT
)
311 /* Browse the parent folder (ignores the pidl) */
312 pidlTmp
= GetParentPidl(fodInfos
->ShellInfos
.pidlAbsCurrent
);
313 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
316 else /* SBSP_ABSOLUTE is 0x0000 */
318 /* An absolute pidl (relative from the desktop) */
319 pidlTmp
= COMDLG32_PIDL_ILClone((LPITEMIDLIST
)pidl
);
320 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
325 ERR("could not browse to folder\n");
329 /* If the pidl to browse to is equal to the actual pidl ...
330 do nothing and pretend you did it*/
331 if(COMDLG32_PIDL_ILIsEqual(pidlTmp
,fodInfos
->ShellInfos
.pidlAbsCurrent
))
333 IShellFolder_Release(psfTmp
);
334 COMDLG32_SHFree(pidlTmp
);
335 TRACE("keep current folder\n");
339 /* Release the current DataObject */
340 if (fodInfos
->Shell
.FOIDataObject
)
342 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
343 fodInfos
->Shell
.FOIDataObject
= NULL
;
346 /* Create the associated view */
347 TRACE("create view object\n");
348 if(FAILED(hRes
= IShellFolder_CreateViewObject(psfTmp
, fodInfos
->ShellInfos
.hwndOwner
,
349 &IID_IShellView
, (LPVOID
*)&psvTmp
))) goto error
;
351 /* Check if listview has focus */
352 bViewHasFocus
= IsChild(fodInfos
->ShellInfos
.hwndView
,GetFocus());
354 /* Get the foldersettings from the old view */
355 if(fodInfos
->Shell
.FOIShellView
)
356 IShellView_GetCurrentInfo(fodInfos
->Shell
.FOIShellView
, &fodInfos
->ShellInfos
.folderSettings
);
358 /* Release the old fodInfos->Shell.FOIShellView and update its value.
359 We have to update this early since ShellView_CreateViewWindow of native
360 shell32 calls OnStateChange and needs the correct view here.*/
361 if(fodInfos
->Shell
.FOIShellView
)
363 IShellView_DestroyViewWindow(fodInfos
->Shell
.FOIShellView
);
364 IShellView_Release(fodInfos
->Shell
.FOIShellView
);
366 fodInfos
->Shell
.FOIShellView
= psvTmp
;
368 /* Release old FOIShellFolder and update its value */
369 if (fodInfos
->Shell
.FOIShellFolder
)
370 IShellFolder_Release(fodInfos
->Shell
.FOIShellFolder
);
371 fodInfos
->Shell
.FOIShellFolder
= psfTmp
;
373 /* Release old pidlAbsCurrent and update its value */
374 COMDLG32_SHFree((LPVOID
)fodInfos
->ShellInfos
.pidlAbsCurrent
);
375 fodInfos
->ShellInfos
.pidlAbsCurrent
= pidlTmp
;
377 COMDLG32_UpdateCurrentDir(fodInfos
);
379 /* Create the window */
380 TRACE("create view window\n");
381 if(FAILED(hRes
= IShellView_CreateViewWindow(psvTmp
, NULL
,
382 &fodInfos
->ShellInfos
.folderSettings
, fodInfos
->Shell
.FOIShellBrowser
,
383 &fodInfos
->ShellInfos
.rectView
, &hwndView
))) goto error
;
385 fodInfos
->ShellInfos
.hwndView
= hwndView
;
387 /* Select the new folder in the Look In combo box of the Open file dialog */
388 FILEDLG95_LOOKIN_SelectItem(fodInfos
->DlgInfos
.hwndLookInCB
,fodInfos
->ShellInfos
.pidlAbsCurrent
);
390 /* changes the tab order of the ListView to reflect the window's File Dialog */
391 hDlgWnd
= GetDlgItem(GetParent(hwndView
), IDC_LOOKIN
);
392 SetWindowPos(hwndView
, hDlgWnd
, 0,0,0,0, SWP_NOMOVE
| SWP_NOSIZE
);
394 /* Since we destroyed the old view if it had focus set focus to the newly created view */
396 SetFocus(fodInfos
->ShellInfos
.hwndView
);
400 ERR("Failed with error 0x%08lx\n", hRes
);
404 /**************************************************************************
405 * IShellBrowserImpl_EnableModelessSB
407 HRESULT WINAPI
IShellBrowserImpl_EnableModelessSB(IShellBrowser
*iface
,
411 ICOM_THIS(IShellBrowserImpl
, iface
);
413 TRACE("(%p)\n", This
);
415 /* Feature not implemented */
419 /**************************************************************************
420 * IShellBrowserImpl_GetControlWindow
422 HRESULT WINAPI
IShellBrowserImpl_GetControlWindow(IShellBrowser
*iface
,
427 ICOM_THIS(IShellBrowserImpl
, iface
);
429 TRACE("(%p)\n", This
);
431 /* Feature not implemented */
434 /**************************************************************************
435 * IShellBrowserImpl_GetViewStateStream
437 HRESULT WINAPI
IShellBrowserImpl_GetViewStateStream(IShellBrowser
*iface
,
442 ICOM_THIS(IShellBrowserImpl
, iface
);
444 FIXME("(%p 0x%08lx %p)\n", This
, grfMode
, ppStrm
);
446 /* Feature not implemented */
449 /**************************************************************************
450 * IShellBrowserImpl_InsertMenusSB
452 HRESULT WINAPI
IShellBrowserImpl_InsertMenusSB(IShellBrowser
*iface
,
454 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
457 ICOM_THIS(IShellBrowserImpl
, iface
);
459 TRACE("(%p)\n", This
);
461 /* Feature not implemented */
464 /**************************************************************************
465 * IShellBrowserImpl_OnViewWindowActive
467 HRESULT WINAPI
IShellBrowserImpl_OnViewWindowActive(IShellBrowser
*iface
,
471 ICOM_THIS(IShellBrowserImpl
, iface
);
473 TRACE("(%p)\n", This
);
475 /* Feature not implemented */
478 /**************************************************************************
479 * IShellBrowserImpl_QueryActiveShellView
481 HRESULT WINAPI
IShellBrowserImpl_QueryActiveShellView(IShellBrowser
*iface
,
485 ICOM_THIS(IShellBrowserImpl
, iface
);
487 FileOpenDlgInfos
*fodInfos
;
489 TRACE("(%p)\n", This
);
491 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
493 if(!(*ppshv
= fodInfos
->Shell
.FOIShellView
))
497 IShellView_AddRef(fodInfos
->Shell
.FOIShellView
);
500 /**************************************************************************
501 * IShellBrowserImpl_RemoveMenusSB
503 HRESULT WINAPI
IShellBrowserImpl_RemoveMenusSB(IShellBrowser
*iface
,
507 ICOM_THIS(IShellBrowserImpl
, iface
);
509 TRACE("(%p)\n", This
);
511 /* Feature not implemented */
514 /**************************************************************************
515 * IShellBrowserImpl_SendControlMsg
517 HRESULT WINAPI
IShellBrowserImpl_SendControlMsg(IShellBrowser
*iface
,
525 ICOM_THIS(IShellBrowserImpl
, iface
);
528 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This
, id
, uMsg
, wParam
, lParam
, pret
);
533 lres
= SendDlgItemMessageA( This
->hwndOwner
, IDC_TOOLBAR
, uMsg
, wParam
, lParam
);
536 FIXME("ctrl id: %x\n", id
);
539 if (pret
) *pret
= lres
;
542 /**************************************************************************
543 * IShellBrowserImpl_SetMenuSB
545 HRESULT WINAPI
IShellBrowserImpl_SetMenuSB(IShellBrowser
*iface
,
547 HOLEMENU holemenuReserved
,
548 HWND hwndActiveObject
)
551 ICOM_THIS(IShellBrowserImpl
, iface
);
553 TRACE("(%p)\n", This
);
555 /* Feature not implemented */
558 /**************************************************************************
559 * IShellBrowserImpl_SetStatusTextSB
561 HRESULT WINAPI
IShellBrowserImpl_SetStatusTextSB(IShellBrowser
*iface
,
562 LPCOLESTR lpszStatusText
)
565 ICOM_THIS(IShellBrowserImpl
, iface
);
567 TRACE("(%p)\n", This
);
569 /* Feature not implemented */
572 /**************************************************************************
573 * IShellBrowserImpl_SetToolbarItems
575 HRESULT WINAPI
IShellBrowserImpl_SetToolbarItems(IShellBrowser
*iface
,
576 LPTBBUTTON lpButtons
,
581 ICOM_THIS(IShellBrowserImpl
, iface
);
583 TRACE("(%p)\n", This
);
585 /* Feature not implemented */
588 /**************************************************************************
589 * IShellBrowserImpl_TranslateAcceleratorSB
591 HRESULT WINAPI
IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser
*iface
,
596 ICOM_THIS(IShellBrowserImpl
, iface
);
598 TRACE("(%p)\n", This
);
600 /* Feature not implemented */
604 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
=
606 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
608 IShellBrowserImpl_QueryInterface
,
609 IShellBrowserImpl_AddRef
,
610 IShellBrowserImpl_Release
,
612 IShellBrowserImpl_GetWindow
,
613 IShellBrowserImpl_ContextSensitiveHelp
,
615 IShellBrowserImpl_InsertMenusSB
,
616 IShellBrowserImpl_SetMenuSB
,
617 IShellBrowserImpl_RemoveMenusSB
,
618 IShellBrowserImpl_SetStatusTextSB
,
619 IShellBrowserImpl_EnableModelessSB
,
620 IShellBrowserImpl_TranslateAcceleratorSB
,
621 IShellBrowserImpl_BrowseObject
,
622 IShellBrowserImpl_GetViewStateStream
,
623 IShellBrowserImpl_GetControlWindow
,
624 IShellBrowserImpl_SendControlMsg
,
625 IShellBrowserImpl_QueryActiveShellView
,
626 IShellBrowserImpl_OnViewWindowActive
,
627 IShellBrowserImpl_SetToolbarItems
636 /***************************************************************************
637 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
639 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
640 ICommDlgBrowser
*iface
,
644 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
646 TRACE("(%p)\n", This
);
648 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
651 /**************************************************************************
652 * IShellBrowserImpl_ICommDlgBrowser_AddRef
654 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser
* iface
)
656 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
658 TRACE("(%p)\n", This
);
660 return IShellBrowserImpl_AddRef(This
);
663 /**************************************************************************
664 * IShellBrowserImpl_ICommDlgBrowser_Release
666 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser
* iface
)
668 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
670 TRACE("(%p)\n", This
);
672 return IShellBrowserImpl_Release(This
);
674 /**************************************************************************
675 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
677 * Called when a user double-clicks in the view or presses the ENTER key
679 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser
*iface
,
683 FileOpenDlgInfos
*fodInfos
;
685 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
687 TRACE("(%p)\n", This
);
689 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
691 /* If the selected object is not a folder, send a IDOK command to parent window */
692 if((pidl
= GetPidlFromDataObject(fodInfos
->Shell
.FOIDataObject
, 1)))
696 ULONG ulAttr
= SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
;
697 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
698 if (ulAttr
& (SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
) )
700 hRes
= IShellBrowser_BrowseObject((IShellBrowser
*)This
,pidl
,SBSP_RELATIVE
);
704 /* Tell the dialog that the user selected a file */
705 hRes
= PostMessageA(This
->hwndOwner
, WM_COMMAND
, IDOK
, 0L);
708 /* Free memory used by pidl */
709 COMDLG32_SHFree((LPVOID
)pidl
);
717 /**************************************************************************
718 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
720 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser
*iface
,
725 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
727 TRACE("(%p shv=%p)\n", This
, ppshv
);
731 case CDBOSC_SETFOCUS
:
732 /* FIXME: Reset the default button.
733 This should be taken care of by defdlg. If control
734 other than button receives focus the default button
735 should be restored. */
736 SendMessageA(This
->hwndOwner
, DM_SETDEFID
, IDOK
, 0);
739 case CDBOSC_KILLFOCUS
:
741 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
742 if(fodInfos
->DlgInfos
.dwDlgProp
& FODPROP_SAVEDLG
)
743 SetDlgItemTextA(fodInfos
->ShellInfos
.hwndOwner
,IDOK
,"&Save");
746 case CDBOSC_SELCHANGE
:
747 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface
,ppshv
);
756 /**************************************************************************
757 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
759 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser
*iface
,
763 FileOpenDlgInfos
*fodInfos
;
766 WCHAR szPathW
[MAX_PATH
];
768 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
770 TRACE("(%p)\n", This
);
772 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
774 ulAttr
= SFGAO_HIDDEN
| SFGAO_FOLDER
| SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
| SFGAO_LINK
;
775 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
777 if( (ulAttr
& SFGAO_HIDDEN
) /* hidden */
778 | !(ulAttr
& (SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
))) /* special folder */
781 /* always include directorys and links */
782 if(ulAttr
& (SFGAO_FOLDER
| SFGAO_LINK
))
785 /* Check if there is a mask to apply if not */
786 if(!fodInfos
->ShellInfos
.lpstrCurrentFilter
|| !lstrlenW(fodInfos
->ShellInfos
.lpstrCurrentFilter
))
789 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos
->Shell
.FOIShellFolder
, pidl
, SHGDN_INFOLDER
| SHGDN_FORPARSING
, &str
)))
791 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW
, MAX_PATH
, &str
, pidl
)))
793 if (PathMatchSpecW(szPathW
, fodInfos
->ShellInfos
.lpstrCurrentFilter
))
801 /**************************************************************************
802 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
804 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
)
806 FileOpenDlgInfos
*fodInfos
;
808 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
810 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
811 TRACE("(%p do=%p view=%p)\n", This
, fodInfos
->Shell
.FOIDataObject
, fodInfos
->Shell
.FOIShellView
);
813 /* release old selections */
814 if (fodInfos
->Shell
.FOIDataObject
)
815 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
817 /* get a new DataObject from the ShellView */
818 if(FAILED(IShellView_GetItemObject(fodInfos
->Shell
.FOIShellView
, SVGIO_SELECTION
,
819 &IID_IDataObject
, (LPVOID
*)&fodInfos
->Shell
.FOIDataObject
)))
822 FILEDLG95_FILENAME_FillFromSelection(This
->hwndOwner
);
824 SendCustomDlgNotificationMessage(This
->hwndOwner
, CDN_SELCHANGE
);
828 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
=
830 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
832 IShellBrowserImpl_ICommDlgBrowser_QueryInterface
,
833 IShellBrowserImpl_ICommDlgBrowser_AddRef
,
834 IShellBrowserImpl_ICommDlgBrowser_Release
,
835 /* ICommDlgBrowser */
836 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
,
837 IShellBrowserImpl_ICommDlgBrowser_OnStateChange
,
838 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
848 /***************************************************************************
849 * IShellBrowserImpl_IServiceProvider_QueryInterface
851 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryInterface(
852 IServiceProvider
*iface
,
856 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
858 FIXME("(%p)\n", This
);
860 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
863 /**************************************************************************
864 * IShellBrowserImpl_IServiceProvider_AddRef
866 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider
* iface
)
868 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
870 FIXME("(%p)\n", This
);
872 return IShellBrowserImpl_AddRef(This
);
875 /**************************************************************************
876 * IShellBrowserImpl_IServiceProvider_Release
878 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_Release(IServiceProvider
* iface
)
880 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
882 FIXME("(%p)\n", This
);
884 return IShellBrowserImpl_Release(This
);
887 /**************************************************************************
888 * IShellBrowserImpl_IServiceProvider_Release
891 * the w2k shellview asks for
892 * guidService = SID_STopLevelBrowser
893 * riid = IShellBrowser
899 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryService(
900 IServiceProvider
* iface
,
905 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
907 FIXME("(%p)\n\t%s\n\t%s\n", This
,debugstr_guid(guidService
), debugstr_guid(riid
) );
910 if(guidService
&& IsEqualIID(guidService
, &SID_STopLevelBrowser
))
912 return IShellBrowserImpl_QueryInterface(This
,riid
,ppv
);
914 FIXME("(%p) unknown interface requested\n", This
);
915 return E_NOINTERFACE
;
919 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
=
921 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
923 IShellBrowserImpl_IServiceProvider_QueryInterface
,
924 IShellBrowserImpl_IServiceProvider_AddRef
,
925 IShellBrowserImpl_IServiceProvider_Release
,
926 /* IServiceProvider */
927 IShellBrowserImpl_IServiceProvider_QueryService