2 * Implementation of IShellBrowser for the File Open common dialog
9 #include "filedlgbrowser.h"
14 #include "wine/obj_dataobject.h"
15 #include "debugtools.h"
17 #include "wine/undocshell.h"
19 DEFAULT_DEBUG_CHANNEL(commdlg
)
21 /**************************************************************************
24 static ICOM_VTABLE(IShellBrowser
) IShellBrowserImpl_Vtbl
=
26 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
28 IShellBrowserImpl_QueryInterface
,
29 IShellBrowserImpl_AddRef
,
30 IShellBrowserImpl_Release
,
32 IShellBrowserImpl_GetWindow
,
33 IShellBrowserImpl_ContextSensitiveHelp
,
35 IShellBrowserImpl_InsertMenusSB
,
36 IShellBrowserImpl_SetMenuSB
,
37 IShellBrowserImpl_RemoveMenusSB
,
38 IShellBrowserImpl_SetStatusTextSB
,
39 IShellBrowserImpl_EnableModelessSB
,
40 IShellBrowserImpl_TranslateAcceleratorSB
,
41 IShellBrowserImpl_BrowseObject
,
42 IShellBrowserImpl_GetViewStateStream
,
43 IShellBrowserImpl_GetControlWindow
,
44 IShellBrowserImpl_SendControlMsg
,
45 IShellBrowserImpl_QueryActiveShellView
,
46 IShellBrowserImpl_OnViewWindowActive
,
47 IShellBrowserImpl_SetToolbarItems
50 static ICOM_VTABLE(ICommDlgBrowser
) IShellBrowserImpl_ICommDlgBrowser_Vtbl
=
52 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
54 IShellBrowserImpl_ICommDlgBrowser_QueryInterface
,
55 IShellBrowserImpl_ICommDlgBrowser_AddRef
,
56 IShellBrowserImpl_ICommDlgBrowser_Release
,
58 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
,
59 IShellBrowserImpl_ICommDlgBrowser_OnStateChange
,
60 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
64 /**************************************************************************
68 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
);
70 LPITEMIDLIST
GetSelectedPidl(IShellView
*ppshv
);
73 /**************************************************************************
76 extern const char *FileOpenDlgInfosStr
;
78 extern HRESULT
GetName(LPSHELLFOLDER lpsf
, LPITEMIDLIST pidl
,DWORD dwFlags
,LPSTR lpstrFileName
);
79 extern HRESULT
GetFileName(HWND hwnd
, LPITEMIDLIST pidl
, LPSTR lpstrFileName
);
80 extern IShellFolder
* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs
);
81 extern LPITEMIDLIST
GetParentPidl(LPITEMIDLIST pidl
);
82 extern LPITEMIDLIST
GetPidlFromName(IShellFolder
*psf
,LPCSTR lpcstrFileName
);
84 extern BOOL
FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd
,
85 LPITEMIDLIST pidlCurrentFolder
,
88 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd
,LPITEMIDLIST pidl
);
89 extern BOOL
FILEDLG95_OnOpen(HWND hwnd
);
90 extern HRESULT
SendCustomDlgNotificationMessage(HWND hwndParentDlg
, UINT uCode
);
93 /**************************************************************************
94 * IShellBrowserImpl_Construct
96 IShellBrowser
* IShellBrowserImpl_Construct(HWND hwndOwner
)
98 IShellBrowserImpl
*sb
;
99 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(hwndOwner
,FileOpenDlgInfosStr
);
101 sb
=(IShellBrowserImpl
*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl
));
103 /* Initialisation of the member variables */
105 sb
->hwndOwner
= hwndOwner
;
107 /* Initialisation of the vTables */
108 sb
->lpVtbl
= &IShellBrowserImpl_Vtbl
;
109 sb
->lpVtbl2
= &IShellBrowserImpl_ICommDlgBrowser_Vtbl
;
111 COMDLG32_SHGetSpecialFolderLocation(hwndOwner
, CSIDL_DESKTOP
,
112 &fodInfos
->ShellInfos
.pidlAbsCurrent
);
116 return (IShellBrowser
*) sb
;
119 /**************************************************************************
122 * The INTERFACE of the IShellBrowser object
130 /***************************************************************************
131 * IShellBrowserImpl_QueryInterface
133 HRESULT WINAPI
IShellBrowserImpl_QueryInterface(IShellBrowser
*iface
,
137 ICOM_THIS(IShellBrowserImpl
, iface
);
139 TRACE("(%p)\n", This
);
143 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
146 else if(IsEqualIID(riid
, &IID_IOleWindow
)) /*IOleWindow*/
147 { *ppvObj
= (IOleWindow
*)This
;
150 else if(IsEqualIID(riid
, &IID_IShellBrowser
)) /*IShellBrowser*/
151 { *ppvObj
= (IShellBrowser
*)This
;
154 else if(IsEqualIID(riid
, &IID_ICommDlgBrowser
)) /*ICommDlgBrowser*/
155 { *ppvObj
= (ICommDlgBrowser
*) &(This
->lpVtbl2
);
159 { IUnknown_AddRef( (IShellBrowser
*) *ppvObj
);
162 return E_NOINTERFACE
;
165 /**************************************************************************
166 * IShellBrowser::AddRef
168 ULONG WINAPI
IShellBrowserImpl_AddRef(IShellBrowser
* iface
)
170 ICOM_THIS(IShellBrowserImpl
, iface
);
172 TRACE("(%p)\n", This
);
174 return ++(This
->ref
);
177 /**************************************************************************
178 * IShellBrowserImpl_Release
180 ULONG WINAPI
IShellBrowserImpl_Release(IShellBrowser
* iface
)
182 ICOM_THIS(IShellBrowserImpl
, iface
);
184 TRACE("(%p)\n", This
);
188 HeapFree(GetProcessHeap(),0, This
);
198 /**************************************************************************
199 * IShellBrowserImpl_GetWindow (IOleWindow)
201 * Inherited from IOleWindow::GetWindow
203 * See Windows documentation for more details
205 * Note : We will never be window less in the File Open dialog
208 HRESULT WINAPI
IShellBrowserImpl_GetWindow(IShellBrowser
* iface
,
211 ICOM_THIS(IShellBrowserImpl
, iface
);
213 TRACE("(%p)\n", This
);
218 *phwnd
= This
->hwndOwner
;
220 return (*phwnd
) ? S_OK
: E_UNEXPECTED
;
224 /**************************************************************************
225 * IShellBrowserImpl_ContextSensitiveHelp
227 HRESULT WINAPI
IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser
* iface
,
230 ICOM_THIS(IShellBrowserImpl
, iface
);
232 TRACE("(%p)\n", This
);
234 /* Feature not implemented */
242 /**************************************************************************
243 * IShellBrowserImpl_BrowseObject
245 * See Windows documentation on IShellBrowser::BrowseObject for more details
247 * This function will override user specified flags and will always
248 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
250 HRESULT WINAPI
IShellBrowserImpl_BrowseObject(IShellBrowser
*iface
,
255 IShellFolder
*psfTmp
;
257 FileOpenDlgInfos
*fodInfos
;
258 LPITEMIDLIST pidlTmp
;
263 ICOM_THIS(IShellBrowserImpl
, iface
);
265 TRACE("(%p)(%p,0x%08x)\n", This
, pidl
, wFlags
);
267 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
269 /* Format the pidl according to its parameter's category */
270 if(wFlags
& SBSP_RELATIVE
)
273 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
274 if(FAILED(hRes
= IShellFolder_BindToObject(fodInfos
->Shell
.FOIShellFolder
,
275 pidl
, NULL
, &IID_IShellFolder
, (LPVOID
*)&psfTmp
)))
277 ERR("bind to object failed\n");
280 /* create an absolute pidl */
281 pidlTmp
= COMDLG32_PIDL_ILCombine(fodInfos
->ShellInfos
.pidlAbsCurrent
,
284 else if(wFlags
& SBSP_PARENT
)
286 /* Browse the parent folder (ignores the pidl) */
287 pidlTmp
= GetParentPidl(fodInfos
->ShellInfos
.pidlAbsCurrent
);
288 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
291 else /* SBSP_ABSOLUTE is 0x0000 */
293 /* An absolute pidl (relative from the desktop) */
294 pidlTmp
= COMDLG32_PIDL_ILClone((LPITEMIDLIST
)pidl
);
295 psfTmp
= GetShellFolderFromPidl(pidlTmp
);
298 if(!psfTmp
) return E_FAIL
;
300 /* If the pidl to browse to is equal to the actual pidl ...
301 do nothing and pretend you did it*/
302 if(COMDLG32_PIDL_ILIsEqual(pidlTmp
,fodInfos
->ShellInfos
.pidlAbsCurrent
))
304 IShellFolder_Release(psfTmp
);
305 COMDLG32_SHFree(pidlTmp
);
309 /* Release the current DataObject */
310 if (fodInfos
->Shell
.FOIDataObject
)
312 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
313 fodInfos
->Shell
.FOIDataObject
= NULL
;
316 /* Create the associated view */
317 if(FAILED(hRes
= IShellFolder_CreateViewObject(psfTmp
, fodInfos
->ShellInfos
.hwndOwner
,
318 &IID_IShellView
, (LPVOID
*)&psvTmp
))) return hRes
;
320 /* Check if listview has focus */
321 bViewHasFocus
= IsChild(fodInfos
->ShellInfos
.hwndView
,GetFocus());
323 /* Get the foldersettings from the old view */
324 if(fodInfos
->Shell
.FOIShellView
)
325 IShellView_GetCurrentInfo(fodInfos
->Shell
.FOIShellView
, &fodInfos
->ShellInfos
.folderSettings
);
327 /* Release the old fodInfos->Shell.FOIShellView and update its value.
328 We have to update this early since ShellView_CreateViewWindow of native
329 shell32 calls OnStateChange and needs the correct view here.*/
330 if(fodInfos
->Shell
.FOIShellView
)
332 IShellView_DestroyViewWindow(fodInfos
->Shell
.FOIShellView
);
333 IShellView_Release(fodInfos
->Shell
.FOIShellView
);
335 fodInfos
->Shell
.FOIShellView
= psvTmp
;
337 /* Release old FOIShellFolder and update its value */
338 if (fodInfos
->Shell
.FOIShellFolder
)
339 IShellFolder_Release(fodInfos
->Shell
.FOIShellFolder
);
340 fodInfos
->Shell
.FOIShellFolder
= psfTmp
;
342 /* Release old pidlAbsCurrent and update its value */
343 COMDLG32_SHFree((LPVOID
)fodInfos
->ShellInfos
.pidlAbsCurrent
);
344 fodInfos
->ShellInfos
.pidlAbsCurrent
= pidlTmp
;
346 /* Create the window */
347 TRACE("create view window\n");
348 if(FAILED(hRes
= IShellView_CreateViewWindow(psvTmp
, NULL
,
349 &fodInfos
->ShellInfos
.folderSettings
, fodInfos
->Shell
.FOIShellBrowser
,
350 &fodInfos
->ShellInfos
.rectView
, &hwndView
))) return hRes
;
352 fodInfos
->ShellInfos
.hwndView
= hwndView
;
354 /* Select the new folder in the Look In combo box of the Open file dialog */
355 FILEDLG95_LOOKIN_SelectItem(fodInfos
->DlgInfos
.hwndLookInCB
,fodInfos
->ShellInfos
.pidlAbsCurrent
);
357 /* changes the tab order of the ListView to reflect the window's File Dialog */
358 hDlgWnd
= GetDlgItem(GetParent(hwndView
), IDC_LOOKIN
);
359 SetWindowPos(hwndView
, hDlgWnd
, 0,0,0,0, SWP_NOMOVE
| SWP_NOSIZE
);
361 /* Since we destroyed the old view if it had focus set focus to the newly created view */
363 SetFocus(fodInfos
->ShellInfos
.hwndView
);
368 /**************************************************************************
369 * IShellBrowserImpl_EnableModelessSB
371 HRESULT WINAPI
IShellBrowserImpl_EnableModelessSB(IShellBrowser
*iface
,
375 ICOM_THIS(IShellBrowserImpl
, iface
);
377 TRACE("(%p)\n", This
);
379 /* Feature not implemented */
383 /**************************************************************************
384 * IShellBrowserImpl_GetControlWindow
386 HRESULT WINAPI
IShellBrowserImpl_GetControlWindow(IShellBrowser
*iface
,
391 ICOM_THIS(IShellBrowserImpl
, iface
);
393 TRACE("(%p)\n", This
);
395 /* Feature not implemented */
398 /**************************************************************************
399 * IShellBrowserImpl_GetViewStateStream
401 HRESULT WINAPI
IShellBrowserImpl_GetViewStateStream(IShellBrowser
*iface
,
406 ICOM_THIS(IShellBrowserImpl
, iface
);
408 TRACE("(%p)\n", This
);
410 /* Feature not implemented */
413 /**************************************************************************
414 * IShellBrowserImpl_InsertMenusSB
416 HRESULT WINAPI
IShellBrowserImpl_InsertMenusSB(IShellBrowser
*iface
,
418 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
421 ICOM_THIS(IShellBrowserImpl
, iface
);
423 TRACE("(%p)\n", This
);
425 /* Feature not implemented */
428 /**************************************************************************
429 * IShellBrowserImpl_OnViewWindowActive
431 HRESULT WINAPI
IShellBrowserImpl_OnViewWindowActive(IShellBrowser
*iface
,
435 ICOM_THIS(IShellBrowserImpl
, iface
);
437 TRACE("(%p)\n", This
);
439 /* Feature not implemented */
442 /**************************************************************************
443 * IShellBrowserImpl_QueryActiveShellView
445 HRESULT WINAPI
IShellBrowserImpl_QueryActiveShellView(IShellBrowser
*iface
,
449 ICOM_THIS(IShellBrowserImpl
, iface
);
451 FileOpenDlgInfos
*fodInfos
;
453 TRACE("(%p)\n", This
);
455 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
457 if(!(*ppshv
= fodInfos
->Shell
.FOIShellView
))
461 IShellView_AddRef(fodInfos
->Shell
.FOIShellView
);
464 /**************************************************************************
465 * IShellBrowserImpl_RemoveMenusSB
467 HRESULT WINAPI
IShellBrowserImpl_RemoveMenusSB(IShellBrowser
*iface
,
471 ICOM_THIS(IShellBrowserImpl
, iface
);
473 TRACE("(%p)\n", This
);
475 /* Feature not implemented */
478 /**************************************************************************
479 * IShellBrowserImpl_SendControlMsg
481 HRESULT WINAPI
IShellBrowserImpl_SendControlMsg(IShellBrowser
*iface
,
489 ICOM_THIS(IShellBrowserImpl
, iface
);
492 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This
, id
, uMsg
, wParam
, lParam
, pret
);
497 lres
= SendDlgItemMessageA( This
->hwndOwner
, IDC_TOOLBAR
, uMsg
, wParam
, lParam
);
500 FIXME("ctrl id: %x\n", id
);
503 if (pret
) *pret
= lres
;
506 /**************************************************************************
507 * IShellBrowserImpl_SetMenuSB
509 HRESULT WINAPI
IShellBrowserImpl_SetMenuSB(IShellBrowser
*iface
,
511 HOLEMENU holemenuReserved
,
512 HWND hwndActiveObject
)
515 ICOM_THIS(IShellBrowserImpl
, iface
);
517 TRACE("(%p)\n", This
);
519 /* Feature not implemented */
522 /**************************************************************************
523 * IShellBrowserImpl_SetStatusTextSB
525 HRESULT WINAPI
IShellBrowserImpl_SetStatusTextSB(IShellBrowser
*iface
,
526 LPCOLESTR lpszStatusText
)
529 ICOM_THIS(IShellBrowserImpl
, iface
);
531 TRACE("(%p)\n", This
);
533 /* Feature not implemented */
536 /**************************************************************************
537 * IShellBrowserImpl_SetToolbarItems
539 HRESULT WINAPI
IShellBrowserImpl_SetToolbarItems(IShellBrowser
*iface
,
540 LPTBBUTTON lpButtons
,
545 ICOM_THIS(IShellBrowserImpl
, iface
);
547 TRACE("(%p)\n", This
);
549 /* Feature not implemented */
552 /**************************************************************************
553 * IShellBrowserImpl_TranslateAcceleratorSB
555 HRESULT WINAPI
IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser
*iface
,
560 ICOM_THIS(IShellBrowserImpl
, iface
);
562 TRACE("(%p)\n", This
);
564 /* Feature not implemented */
572 /***************************************************************************
573 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
575 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser
*iface
,
579 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
581 TRACE("(%p)\n", This
);
583 return IShellBrowserImpl_QueryInterface(This
,riid
,ppvObj
);
586 /**************************************************************************
587 * IShellBrowserImpl_ICommDlgBrowser_AddRef
589 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser
* iface
)
591 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
593 TRACE("(%p)\n", This
);
595 return IShellBrowserImpl_AddRef(This
);
598 /**************************************************************************
599 * IShellBrowserImpl_ICommDlgBrowser_Release
601 ULONG WINAPI
IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser
* iface
)
603 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser
,iface
);
605 TRACE("(%p)\n", This
);
607 return IShellBrowserImpl_Release(This
);
609 /**************************************************************************
610 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
612 * Called when a user double-clicks in the view or presses the ENTER key
614 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser
*iface
,
618 FileOpenDlgInfos
*fodInfos
;
620 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
622 TRACE("(%p)\n", This
);
624 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
626 /* If the selected object is not a folder, send a IDOK command to parent window */
627 if((pidl
= GetPidlFromDataObject(fodInfos
->Shell
.FOIDataObject
, 1)))
631 ULONG ulAttr
= SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
;
632 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
633 if (ulAttr
& (SFGAO_FOLDER
| SFGAO_HASSUBFOLDER
) )
635 hRes
= IShellBrowser_BrowseObject((IShellBrowser
*)This
,pidl
,SBSP_RELATIVE
);
639 /* Tell the dialog that the user selected a file */
640 hRes
= PostMessageA(This
->hwndOwner
, WM_COMMAND
, IDOK
, 0L);
643 /* Free memory used by pidl */
644 COMDLG32_SHFree((LPVOID
)pidl
);
652 /**************************************************************************
653 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
655 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser
*iface
,
660 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
662 TRACE("(%p shv=%p)\n", This
, ppshv
);
666 case CDBOSC_SETFOCUS
:
667 /* FIXME: Reset the default button.
668 This should be taken care of by defdlg. If control
669 other than button receives focus the default button
670 should be restored. */
671 SendMessageA(This
->hwndOwner
, DM_SETDEFID
, IDOK
, 0);
674 case CDBOSC_KILLFOCUS
:
676 FileOpenDlgInfos
*fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
677 if(fodInfos
->DlgInfos
.dwDlgProp
& FODPROP_SAVEDLG
)
678 SetDlgItemTextA(fodInfos
->ShellInfos
.hwndOwner
,IDOK
,"&Save");
681 case CDBOSC_SELCHANGE
:
682 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface
,ppshv
);
691 /* copied from shell32 to avoid linking to it */
692 static HRESULT
COMDLG32_StrRetToStrNW (LPVOID dest
, DWORD len
, LPSTRRET src
, LPITEMIDLIST pidl
)
694 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest
,len
,src
,pidl
);
699 lstrcpynW((LPWSTR
)dest
, src
->u
.pOleStr
, len
);
700 COMDLG32_SHFree(src
->u
.pOleStr
);
704 lstrcpynAtoW((LPWSTR
)dest
, src
->u
.cStr
, len
);
710 lstrcpynAtoW((LPWSTR
)dest
, ((LPCSTR
)&pidl
->mkid
)+src
->u
.uOffset
, len
);
715 FIXME("unknown type!\n");
717 { *(LPSTR
)dest
= '\0';
723 /**************************************************************************
724 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
726 HRESULT WINAPI
IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser
*iface
,
730 FileOpenDlgInfos
*fodInfos
;
733 WCHAR szPathW
[MAX_PATH
];
735 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
737 TRACE("(%p)\n", This
);
739 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
741 ulAttr
= SFGAO_HIDDEN
| SFGAO_FOLDER
| SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
| SFGAO_LINK
;
742 IShellFolder_GetAttributesOf(fodInfos
->Shell
.FOIShellFolder
, 1, &pidl
, &ulAttr
);
744 if( (ulAttr
& SFGAO_HIDDEN
) /* hidden */
745 | !(ulAttr
& (SFGAO_FILESYSTEM
| SFGAO_FILESYSANCESTOR
))) /* special folder */
748 /* always include directorys and links */
749 if(ulAttr
& (SFGAO_FOLDER
| SFGAO_LINK
))
752 /* Check if there is a mask to apply if not */
753 if(!fodInfos
->ShellInfos
.lpstrCurrentFilter
|| !lstrlenW(fodInfos
->ShellInfos
.lpstrCurrentFilter
))
756 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos
->Shell
.FOIShellFolder
, pidl
, SHGDN_INFOLDER
| SHGDN_FORPARSING
, &str
)))
758 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW
, MAX_PATH
, &str
, pidl
)))
760 if (COMDLG32_PathMatchSpecW(szPathW
, fodInfos
->ShellInfos
.lpstrCurrentFilter
))
768 /**************************************************************************
769 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
771 HRESULT
IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser
*iface
, IShellView
*ppshv
)
773 FileOpenDlgInfos
*fodInfos
;
775 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl
,iface
);
777 fodInfos
= (FileOpenDlgInfos
*) GetPropA(This
->hwndOwner
,FileOpenDlgInfosStr
);
778 TRACE("(%p do=%p view=%p)\n", This
, fodInfos
->Shell
.FOIDataObject
, fodInfos
->Shell
.FOIShellView
);
780 /* release old selections */
781 if (fodInfos
->Shell
.FOIDataObject
)
782 IDataObject_Release(fodInfos
->Shell
.FOIDataObject
);
784 /* get a new DataObject from the ShellView */
785 if(FAILED(IShellView_GetItemObject(fodInfos
->Shell
.FOIShellView
, SVGIO_SELECTION
,
786 &IID_IDataObject
, (LPVOID
*)&fodInfos
->Shell
.FOIDataObject
)))
789 FILEDLG95_FILENAME_FillFromSelection(This
->hwndOwner
);
791 SendCustomDlgNotificationMessage(This
->hwndOwner
, CDN_SELCHANGE
);