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
32 #define NO_SHLWAPI_STREAM
34 #include "filedlgbrowser.h"
37 #include "wine/obj_serviceprovider.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(commdlg
);
45 ICOM_VTABLE(IShellBrowser
) * lpVtbl
;
46 ICOM_VTABLE(ICommDlgBrowser
) * lpVtblCommDlgBrowser
;
47 ICOM_VTABLE(IServiceProvider
)* lpVtblServiceProvider
;
48 DWORD ref
; /* Reference counter */
49 HWND hwndOwner
; /* Owner dialog of the interface */
53 /**************************************************************************
56 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
;
57 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
58 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
;
60 /**************************************************************************
64 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
);
66 LPITEMIDLIST
GetSelectedPidl(IShellView
*ppshv
);
69 /**************************************************************************
72 extern const char *FileOpenDlgInfosStr
;
74 extern HRESULT
GetName(LPSHELLFOLDER lpsf
, LPITEMIDLIST pidl
,DWORD dwFlags
,LPSTR lpstrFileName
);
75 extern HRESULT
GetFileName(HWND hwnd
, LPITEMIDLIST pidl
, LPSTR lpstrFileName
);
76 extern IShellFolder
* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs
);
77 extern LPITEMIDLIST
GetParentPidl(LPITEMIDLIST pidl
);
78 extern LPITEMIDLIST
GetPidlFromName(IShellFolder
*psf
,LPCSTR lpcstrFileName
);
80 extern BOOL
FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd
,
81 LPITEMIDLIST pidlCurrentFolder
,
84 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd
,LPITEMIDLIST pidl
);
85 extern BOOL
FILEDLG95_OnOpen(HWND hwnd
);
86 extern HRESULT
SendCustomDlgNotificationMessage(HWND hwndParentDlg
, UINT uCode
);
93 static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos
*fodInfos
)
95 char lpstrPath
[MAX_PATH
];
96 SHGetPathFromIDListA(fodInfos
->ShellInfos
.pidlAbsCurrent
,lpstrPath
);
97 SetCurrentDirectoryA(lpstrPath
);
98 TRACE("new current folder %s\n", lpstrPath
);
101 /* copied from shell32 to avoid linking to it */
102 static HRESULT
COMDLG32_StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
104 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
109 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
110 COMDLG32_SHFree(src
->u
.pOleStr
);
114 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, src
->u
.cStr
, -1, (LPWSTR
)dest
, len
))
115 ((LPWSTR
)dest
)[len
-1] = 0;
121 if (len
&& !MultiByteToWideChar( CP_ACP
, 0, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
,
122 -1, (LPWSTR
)dest
, len
))
123 ((LPWSTR
)dest
)[len
-1] = 0;
128 FIXME("unknown type!\n");
130 { *(LPWSTR
)dest
= '\0';
141 /**************************************************************************
142 * IShellBrowserImpl_Construct
144 IShellBrowser
* IShellBrowserImpl_Construct(HWND hwndOwner
)
146 IShellBrowserImpl
*sb
;
147 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(hwndOwner
,FileOpenDlgInfosStr
);
149 sb
=(IShellBrowserImpl
*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl
));
151 /* Initialisation of the member variables */
153 sb
->hwndOwner
= hwndOwner
;
155 /* Initialisation of the vTables */
156 sb
->lpVtbl
= &IShellBrowserImpl_Vtbl
;
157 sb
->lpVtblCommDlgBrowser
= &IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
158 sb
->lpVtblServiceProvider
= &IShellBrowserImpl_IServiceProvider_Vtbl
;
159 SHGetSpecialFolderLocation(hwndOwner
, CSIDL_DESKTOP
,
160 &fodInfos
->ShellInfos
.pidlAbsCurrent
);
164 return (IShellBrowser
*) sb
;
167 /***************************************************************************
168 * IShellBrowserImpl_QueryInterface
170 HRESULT WINAPI
IShellBrowserImpl_QueryInterface(IShellBrowser
*iface
,
174 ICOM_THIS(IShellBrowserImpl
, iface
);
176 TRACE("(%p)\n\t%s\n", This
, debugstr_guid(riid
));
180 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
183 else if(IsEqualIID(riid
, &IID_IOleWindow
)) /*IOleWindow*/
184 { *ppvObj
= (IOleWindow
*)This
;
187 else if(IsEqualIID(riid
, &IID_IShellBrowser
)) /*IShellBrowser*/
188 { *ppvObj
= (IShellBrowser
*)This
;
191 else if(IsEqualIID(riid
, &IID_ICommDlgBrowser
)) /*ICommDlgBrowser*/
192 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblCommDlgBrowser
);
195 else if(IsEqualIID(riid
, &IID_IServiceProvider
)) /* IServiceProvider */
196 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtblServiceProvider
);
200 { IUnknown_AddRef( (IShellBrowser
*) *ppvObj
);
203 FIXME("Unknown interface requested\n");
204 return E_NOINTERFACE
;
207 /**************************************************************************
208 * IShellBrowser::AddRef
210 ULONG WINAPI
IShellBrowserImpl_AddRef(IShellBrowser
* iface
)
212 ICOM_THIS(IShellBrowserImpl
, iface
);
214 TRACE("(%p)\n", This
);
216 return ++(This
->ref
);
219 /**************************************************************************
220 * IShellBrowserImpl_Release
222 ULONG WINAPI
IShellBrowserImpl_Release(IShellBrowser
* iface
)
224 ICOM_THIS(IShellBrowserImpl
, iface
);
226 TRACE("(%p)\n", This
);
230 HeapFree(GetProcessHeap(),0, This
);
240 /**************************************************************************
241 * IShellBrowserImpl_GetWindow (IOleWindow)
243 * Inherited from IOleWindow::GetWindow
245 * See Windows documentation for more details
247 * Note : We will never be window less in the File Open dialog
250 HRESULT WINAPI
IShellBrowserImpl_GetWindow(IShellBrowser
* iface
,
253 ICOM_THIS(IShellBrowserImpl
, iface
);
255 TRACE("(%p)\n", This
);
260 *phwnd
= This
->hwndOwner
;
262 return (*phwnd
) ? S_OK
: E_UNEXPECTED
;
266 /**************************************************************************
267 * IShellBrowserImpl_ContextSensitiveHelp
269 HRESULT WINAPI
IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser
* iface
,
272 ICOM_THIS(IShellBrowserImpl
, iface
);
274 TRACE("(%p)\n", This
);
276 /* Feature not implemented */
284 /**************************************************************************
285 * IShellBrowserImpl_BrowseObject
287 * See Windows documentation on IShellBrowser::BrowseObject for more details
289 * This function will override user specified flags and will always
290 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
292 HRESULT WINAPI
IShellBrowserImpl_BrowseObject(IShellBrowser
*iface
,
297 IShellFolder
*psfTmp
;
299 FileOpenDlgInfos
*fodInfos
;
300 LPITEMIDLIST pidlTmp
;
305 ICOM_THIS(IShellBrowserImpl
, iface
);
307 TRACE("(%p)(%p,0x%08x)\n", This
, pidl
, wFlags
);
309 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
311 /* Format the pidl according to its parameter's category */
312 if(wFlags
& SBSP_RELATIVE
)
315 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
316 if(FAILED(hRes
= IShellFolder_BindToObject(fodInfos
->Shell
.FOIShellFolder
,
317 pidl
, NULL
, &IID_IShellFolder
, (LPVOID
*)&psfTmp
)))
319 ERR("bind to object failed\n");
322 /* create an absolute pidl */
323 pidlTmp
= COMDLG32_PIDL_ILCombine(fodInfos
->ShellInfos
.pidlAbsCurrent
,
326 else if(wFlags
& SBSP_PARENT
)
328 /* Browse the parent folder (ignores the pidl) */
329 pidlTmp
= GetParentPidl(fodInfos
->ShellInfos
.pidlAbsCurrent
);
330 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
333 else /* SBSP_ABSOLUTE is 0x0000 */
335 /* An absolute pidl (relative from the desktop) */
336 pidlTmp
= COMDLG32_PIDL_ILClone((LPITEMIDLIST
)pidl
);
337 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
342 ERR("could not browse to folder\n");
346 /* If the pidl to browse to is equal to the actual pidl ...
347 do nothing and pretend you did it*/
348 if(COMDLG32_PIDL_ILIsEqual(pidlTmp
,fodInfos
->ShellInfos
.pidlAbsCurrent
))
350 IShellFolder_Release(psfTmp
);
351 COMDLG32_SHFree(pidlTmp
);
352 TRACE("keep current folder\n");
356 /* Release the current DataObject */
357 if (fodInfos
->Shell
.FOIDataObject
)
359 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
360 fodInfos
->Shell
.FOIDataObject
= NULL
;
363 /* Create the associated view */
364 TRACE("create view object\n");
365 if(FAILED(hRes
= IShellFolder_CreateViewObject(psfTmp
, fodInfos
->ShellInfos
.hwndOwner
,
366 &IID_IShellView
, (LPVOID
*)&psvTmp
))) goto error
;
368 /* Check if listview has focus */
369 bViewHasFocus
= IsChild(fodInfos
->ShellInfos
.hwndView
,GetFocus());
371 /* Get the foldersettings from the old view */
372 if(fodInfos
->Shell
.FOIShellView
)
373 IShellView_GetCurrentInfo(fodInfos
->Shell
.FOIShellView
, &fodInfos
->ShellInfos
.folderSettings
);
375 /* Release the old fodInfos->Shell.FOIShellView and update its value.
376 We have to update this early since ShellView_CreateViewWindow of native
377 shell32 calls OnStateChange and needs the correct view here.*/
378 if(fodInfos
->Shell
.FOIShellView
)
380 IShellView_DestroyViewWindow(fodInfos
->Shell
.FOIShellView
);
381 IShellView_Release(fodInfos
->Shell
.FOIShellView
);
383 fodInfos
->Shell
.FOIShellView
= psvTmp
;
385 /* Release old FOIShellFolder and update its value */
386 if (fodInfos
->Shell
.FOIShellFolder
)
387 IShellFolder_Release(fodInfos
->Shell
.FOIShellFolder
);
388 fodInfos
->Shell
.FOIShellFolder
= psfTmp
;
390 /* Release old pidlAbsCurrent and update its value */
391 COMDLG32_SHFree((LPVOID
)fodInfos
->ShellInfos
.pidlAbsCurrent
);
392 fodInfos
->ShellInfos
.pidlAbsCurrent
= pidlTmp
;
394 COMDLG32_UpdateCurrentDir(fodInfos
);
396 /* Create the window */
397 TRACE("create view window\n");
398 if(FAILED(hRes
= IShellView_CreateViewWindow(psvTmp
, NULL
,
399 &fodInfos
->ShellInfos
.folderSettings
, fodInfos
->Shell
.FOIShellBrowser
,
400 &fodInfos
->ShellInfos
.rectView
, &hwndView
))) goto error
;
402 fodInfos
->ShellInfos
.hwndView
= hwndView
;
404 /* Select the new folder in the Look In combo box of the Open file dialog */
405 FILEDLG95_LOOKIN_SelectItem(fodInfos
->DlgInfos
.hwndLookInCB
,fodInfos
->ShellInfos
.pidlAbsCurrent
);
407 /* changes the tab order of the ListView to reflect the window's File Dialog */
408 hDlgWnd
= GetDlgItem(GetParent(hwndView
), IDC_LOOKIN
);
409 SetWindowPos(hwndView
, hDlgWnd
, 0,0,0,0, SWP_NOMOVE
| SWP_NOSIZE
);
411 /* Since we destroyed the old view if it had focus set focus to the newly created view */
413 SetFocus(fodInfos
->ShellInfos
.hwndView
);
417 ERR("Failed with error 0x%08lx\n", hRes
);
421 /**************************************************************************
422 * IShellBrowserImpl_EnableModelessSB
424 HRESULT WINAPI
IShellBrowserImpl_EnableModelessSB(IShellBrowser
*iface
,
428 ICOM_THIS(IShellBrowserImpl
, iface
);
430 TRACE("(%p)\n", This
);
432 /* Feature not implemented */
436 /**************************************************************************
437 * IShellBrowserImpl_GetControlWindow
439 HRESULT WINAPI
IShellBrowserImpl_GetControlWindow(IShellBrowser
*iface
,
444 ICOM_THIS(IShellBrowserImpl
, iface
);
446 TRACE("(%p)\n", This
);
448 /* Feature not implemented */
451 /**************************************************************************
452 * IShellBrowserImpl_GetViewStateStream
454 HRESULT WINAPI
IShellBrowserImpl_GetViewStateStream(IShellBrowser
*iface
,
459 ICOM_THIS(IShellBrowserImpl
, iface
);
461 FIXME("(%p 0x%08lx %p)\n", This
, grfMode
, ppStrm
);
463 /* Feature not implemented */
466 /**************************************************************************
467 * IShellBrowserImpl_InsertMenusSB
469 HRESULT WINAPI
IShellBrowserImpl_InsertMenusSB(IShellBrowser
*iface
,
471 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
474 ICOM_THIS(IShellBrowserImpl
, iface
);
476 TRACE("(%p)\n", This
);
478 /* Feature not implemented */
481 /**************************************************************************
482 * IShellBrowserImpl_OnViewWindowActive
484 HRESULT WINAPI
IShellBrowserImpl_OnViewWindowActive(IShellBrowser
*iface
,
488 ICOM_THIS(IShellBrowserImpl
, iface
);
490 TRACE("(%p)\n", This
);
492 /* Feature not implemented */
495 /**************************************************************************
496 * IShellBrowserImpl_QueryActiveShellView
498 HRESULT WINAPI
IShellBrowserImpl_QueryActiveShellView(IShellBrowser
*iface
,
502 ICOM_THIS(IShellBrowserImpl
, iface
);
504 FileOpenDlgInfos
*fodInfos
;
506 TRACE("(%p)\n", This
);
508 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
510 if(!(*ppshv
= fodInfos
->Shell
.FOIShellView
))
514 IShellView_AddRef(fodInfos
->Shell
.FOIShellView
);
517 /**************************************************************************
518 * IShellBrowserImpl_RemoveMenusSB
520 HRESULT WINAPI
IShellBrowserImpl_RemoveMenusSB(IShellBrowser
*iface
,
524 ICOM_THIS(IShellBrowserImpl
, iface
);
526 TRACE("(%p)\n", This
);
528 /* Feature not implemented */
531 /**************************************************************************
532 * IShellBrowserImpl_SendControlMsg
534 HRESULT WINAPI
IShellBrowserImpl_SendControlMsg(IShellBrowser
*iface
,
542 ICOM_THIS(IShellBrowserImpl
, iface
);
545 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This
, id
, uMsg
, wParam
, lParam
, pret
);
550 lres
= SendDlgItemMessageA( This
->hwndOwner
, IDC_TOOLBAR
, uMsg
, wParam
, lParam
);
553 FIXME("ctrl id: %x\n", id
);
556 if (pret
) *pret
= lres
;
559 /**************************************************************************
560 * IShellBrowserImpl_SetMenuSB
562 HRESULT WINAPI
IShellBrowserImpl_SetMenuSB(IShellBrowser
*iface
,
564 HOLEMENU holemenuReserved
,
565 HWND hwndActiveObject
)
568 ICOM_THIS(IShellBrowserImpl
, iface
);
570 TRACE("(%p)\n", This
);
572 /* Feature not implemented */
575 /**************************************************************************
576 * IShellBrowserImpl_SetStatusTextSB
578 HRESULT WINAPI
IShellBrowserImpl_SetStatusTextSB(IShellBrowser
*iface
,
579 LPCOLESTR lpszStatusText
)
582 ICOM_THIS(IShellBrowserImpl
, iface
);
584 TRACE("(%p)\n", This
);
586 /* Feature not implemented */
589 /**************************************************************************
590 * IShellBrowserImpl_SetToolbarItems
592 HRESULT WINAPI
IShellBrowserImpl_SetToolbarItems(IShellBrowser
*iface
,
593 LPTBBUTTON lpButtons
,
598 ICOM_THIS(IShellBrowserImpl
, iface
);
600 TRACE("(%p)\n", This
);
602 /* Feature not implemented */
605 /**************************************************************************
606 * IShellBrowserImpl_TranslateAcceleratorSB
608 HRESULT WINAPI
IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser
*iface
,
613 ICOM_THIS(IShellBrowserImpl
, iface
);
615 TRACE("(%p)\n", This
);
617 /* Feature not implemented */
621 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
=
623 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
625 IShellBrowserImpl_QueryInterface
,
626 IShellBrowserImpl_AddRef
,
627 IShellBrowserImpl_Release
,
629 IShellBrowserImpl_GetWindow
,
630 IShellBrowserImpl_ContextSensitiveHelp
,
632 IShellBrowserImpl_InsertMenusSB
,
633 IShellBrowserImpl_SetMenuSB
,
634 IShellBrowserImpl_RemoveMenusSB
,
635 IShellBrowserImpl_SetStatusTextSB
,
636 IShellBrowserImpl_EnableModelessSB
,
637 IShellBrowserImpl_TranslateAcceleratorSB
,
638 IShellBrowserImpl_BrowseObject
,
639 IShellBrowserImpl_GetViewStateStream
,
640 IShellBrowserImpl_GetControlWindow
,
641 IShellBrowserImpl_SendControlMsg
,
642 IShellBrowserImpl_QueryActiveShellView
,
643 IShellBrowserImpl_OnViewWindowActive
,
644 IShellBrowserImpl_SetToolbarItems
653 /***************************************************************************
654 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
656 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
657 ICommDlgBrowser
*iface
,
661 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
663 TRACE("(%p)\n", This
);
665 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
668 /**************************************************************************
669 * IShellBrowserImpl_ICommDlgBrowser_AddRef
671 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser
* iface
)
673 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
675 TRACE("(%p)\n", This
);
677 return IShellBrowserImpl_AddRef(This
);
680 /**************************************************************************
681 * IShellBrowserImpl_ICommDlgBrowser_Release
683 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser
* iface
)
685 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
687 TRACE("(%p)\n", This
);
689 return IShellBrowserImpl_Release(This
);
691 /**************************************************************************
692 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
694 * Called when a user double-clicks in the view or presses the ENTER key
696 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser
*iface
,
700 FileOpenDlgInfos
*fodInfos
;
702 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
704 TRACE("(%p)\n", This
);
706 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
708 /* If the selected object is not a folder, send a IDOK command to parent window */
709 if((pidl
= GetPidlFromDataObject(fodInfos
->Shell
.FOIDataObject
, 1)))
713 ULONG ulAttr
= SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
;
714 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
715 if (ulAttr
& (SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
) )
717 hRes
= IShellBrowser_BrowseObject((IShellBrowser
*)This
,pidl
,SBSP_RELATIVE
);
721 /* Tell the dialog that the user selected a file */
722 hRes
= PostMessageA(This
->hwndOwner
, WM_COMMAND
, IDOK
, 0L);
725 /* Free memory used by pidl */
726 COMDLG32_SHFree((LPVOID
)pidl
);
734 /**************************************************************************
735 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
737 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser
*iface
,
742 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
744 TRACE("(%p shv=%p)\n", This
, ppshv
);
748 case CDBOSC_SETFOCUS
:
749 /* FIXME: Reset the default button.
750 This should be taken care of by defdlg. If control
751 other than button receives focus the default button
752 should be restored. */
753 SendMessageA(This
->hwndOwner
, DM_SETDEFID
, IDOK
, 0);
756 case CDBOSC_KILLFOCUS
:
758 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
759 if(fodInfos
->DlgInfos
.dwDlgProp
& FODPROP_SAVEDLG
)
760 SetDlgItemTextA(fodInfos
->ShellInfos
.hwndOwner
,IDOK
,"&Save");
763 case CDBOSC_SELCHANGE
:
764 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface
,ppshv
);
773 /**************************************************************************
774 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
776 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser
*iface
,
780 FileOpenDlgInfos
*fodInfos
;
783 WCHAR szPathW
[MAX_PATH
];
785 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
787 TRACE("(%p)\n", This
);
789 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
791 ulAttr
= SFGAO_HIDDEN
| SFGAO_FOLDER
| SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
| SFGAO_LINK
;
792 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
794 if( (ulAttr
& SFGAO_HIDDEN
) /* hidden */
795 | !(ulAttr
& (SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
))) /* special folder */
798 /* always include directories and links */
799 if(ulAttr
& (SFGAO_FOLDER
| SFGAO_LINK
))
802 /* Check if there is a mask to apply if not */
803 if(!fodInfos
->ShellInfos
.lpstrCurrentFilter
|| !lstrlenW(fodInfos
->ShellInfos
.lpstrCurrentFilter
))
806 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos
->Shell
.FOIShellFolder
, pidl
, SHGDN_INFOLDER
| SHGDN_FORPARSING
, &str
)))
808 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW
, MAX_PATH
, &str
, pidl
)))
810 if (PathMatchSpecW(szPathW
, fodInfos
->ShellInfos
.lpstrCurrentFilter
))
818 /**************************************************************************
819 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
821 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
)
823 FileOpenDlgInfos
*fodInfos
;
825 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
827 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
828 TRACE("(%p do=%p view=%p)\n", This
, fodInfos
->Shell
.FOIDataObject
, fodInfos
->Shell
.FOIShellView
);
830 /* release old selections */
831 if (fodInfos
->Shell
.FOIDataObject
)
832 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
834 /* get a new DataObject from the ShellView */
835 if(FAILED(IShellView_GetItemObject(fodInfos
->Shell
.FOIShellView
, SVGIO_SELECTION
,
836 &IID_IDataObject
, (LPVOID
*)&fodInfos
->Shell
.FOIDataObject
)))
839 FILEDLG95_FILENAME_FillFromSelection(This
->hwndOwner
);
841 SendCustomDlgNotificationMessage(This
->hwndOwner
, CDN_SELCHANGE
);
845 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
=
847 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
849 IShellBrowserImpl_ICommDlgBrowser_QueryInterface
,
850 IShellBrowserImpl_ICommDlgBrowser_AddRef
,
851 IShellBrowserImpl_ICommDlgBrowser_Release
,
852 /* ICommDlgBrowser */
853 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
,
854 IShellBrowserImpl_ICommDlgBrowser_OnStateChange
,
855 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
865 /***************************************************************************
866 * IShellBrowserImpl_IServiceProvider_QueryInterface
868 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryInterface(
869 IServiceProvider
*iface
,
873 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
875 FIXME("(%p)\n", This
);
877 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
880 /**************************************************************************
881 * IShellBrowserImpl_IServiceProvider_AddRef
883 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider
* iface
)
885 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
887 FIXME("(%p)\n", This
);
889 return IShellBrowserImpl_AddRef(This
);
892 /**************************************************************************
893 * IShellBrowserImpl_IServiceProvider_Release
895 ULONG WINAPI
IShellBrowserImpl_IServiceProvider_Release(IServiceProvider
* iface
)
897 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
899 FIXME("(%p)\n", This
);
901 return IShellBrowserImpl_Release(This
);
904 /**************************************************************************
905 * IShellBrowserImpl_IServiceProvider_Release
908 * the w2k shellview asks for
909 * guidService = SID_STopLevelBrowser
910 * riid = IShellBrowser
916 HRESULT WINAPI
IShellBrowserImpl_IServiceProvider_QueryService(
917 IServiceProvider
* iface
,
922 _ICOM_THIS_FromIServiceProvider(IShellBrowser
,iface
);
924 FIXME("(%p)\n\t%s\n\t%s\n", This
,debugstr_guid(guidService
), debugstr_guid(riid
) );
927 if(guidService
&& IsEqualIID(guidService
, &SID_STopLevelBrowser
))
929 return IShellBrowserImpl_QueryInterface(This
,riid
,ppv
);
931 FIXME("(%p) unknown interface requested\n", This
);
932 return E_NOINTERFACE
;
936 static ICOM_VTABLE(IServiceProvider
) IShellBrowserImpl_IServiceProvider_Vtbl
=
938 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
940 IShellBrowserImpl_IServiceProvider_QueryInterface
,
941 IShellBrowserImpl_IServiceProvider_AddRef
,
942 IShellBrowserImpl_IServiceProvider_Release
,
943 /* IServiceProvider */
944 IShellBrowserImpl_IServiceProvider_QueryService