xref: /reactos/dll/win32/browseui/shellbrowser.cpp (revision bb297bc3)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * ReactOS Explorer
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck  * License as published by the Free Software Foundation; either
9c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14c2c66affSColin Finck  * Lesser General Public License for more details.
15c2c66affSColin Finck  *
16c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19c2c66affSColin Finck  */
20c2c66affSColin Finck 
21c2c66affSColin Finck #include "precomp.h"
22c2c66affSColin Finck 
23c2c66affSColin Finck #include <shellapi.h>
24c2c66affSColin Finck #include <htiframe.h>
25c2c66affSColin Finck #include <strsafe.h>
26c2c66affSColin Finck 
27c2c66affSColin Finck extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
28c2c66affSColin Finck 
29c2c66affSColin Finck #include "newatlinterfaces.h"
30c2c66affSColin Finck 
31c2c66affSColin Finck /*
32c2c66affSColin Finck TODO:
33c2c66affSColin Finck   **Provide implementation of new and delete that use LocalAlloc
34c2c66affSColin Finck   **Persist history for shell view isn't working correctly, possibly because of the mismatch between traveling and updating the travel log. The
35c2c66affSColin Finck         view doesn't restore the selection correctly.
36c2c66affSColin Finck   **Build explorer.exe, browseui.dll, comctl32.dll, shdocvw.dll, shell32.dll, shlwapi.dll into a directory and run them for testing...
37c2c66affSColin Finck   **Add brand band bitmaps to shell32.dll
38c2c66affSColin Finck   **If Go button on address bar is clicked, each time a new duplicate entry is added to travel log
39c2c66affSColin Finck ****The current entry is updated in travel log before doing the travel, which means when traveling back the update of the
40c2c66affSColin Finck         current state overwrites the wrong entry's contents. This needs to be changed.
41c2c66affSColin Finck ****Fix close of browser window to release all objects
42c2c66affSColin Finck ****Given only a GUID in ShowBrowserBar, what is the correct way to determine if the bar is vertical or horizontal?
43c2c66affSColin Finck   **When a new bar is added to base bar site, how is base bar told so it can resize?
44c2c66affSColin Finck   **Does the base bar site have a classid?
45c2c66affSColin Finck   **What should refresh command send to views to make them refresh?
46c2c66affSColin Finck   **When new bar is created, what status notifications need to be fired?
47c2c66affSColin Finck   **How does keyboard filtering dispatch?
48c2c66affSColin Finck   **For deferred persist history load, how does the view connect up and get the state?
49c2c66affSColin Finck     How does context menu send open, cut, rename commands to its site (the shell view)?
50c2c66affSColin Finck   **Fix browser to implement IProfferService and hold onto brand band correctly - this will allow animations.
51c2c66affSColin Finck 
52c2c66affSColin Finck   **Route View->Toolbars commands to internet toolbar
53c2c66affSColin Finck   **Handle travel log items in View->Go
54c2c66affSColin Finck   **Fix ShowBrowserBar to pass correct size on when bar is shown
55c2c66affSColin Finck ****Fix SetBorderSpaceDW to cascade resize to subsequent bars
56c2c66affSColin Finck ****Make ShowToolbar check if bar is already created before creating it again
57c2c66affSColin Finck ****Shell should fill in the list of explorer bars in the View submenus
58c2c66affSColin Finck   **Add folder menu in the file menu
59c2c66affSColin Finck   **Fix CShellBrowser::GetBorderDW to compute available size correctly
60c2c66affSColin Finck   **When a new bar is shown, re-fire the navigate event. This makes the explorer band select the correct folder
61c2c66affSColin Finck   **Implement support for refresh. Forward refresh to explorer bar (refresh on toolbar and in menu is dispatched different)
62c2c66affSColin Finck     Make folders toolbar item update state appropriately
63c2c66affSColin Finck     Read list of bands from registry on launch
64c2c66affSColin Finck     Read list of bars from registry on launch
65c2c66affSColin Finck     If the folders or search bars don't exist, disable the toolbar buttons
66c2c66affSColin Finck     If the favorites or history bars don't exist, disable the toolbar butons
67c2c66affSColin Finck     Fix Apply to all Folders in Folder Options
68c2c66affSColin Finck     Implement close command
69c2c66affSColin Finck     Add explorer band context menu to file menu
70c2c66affSColin Finck     Add code to allow restore of internet toolbar from registry
71c2c66affSColin Finck     Fix code that calls FireNavigateComplete to pass the correct new path
72c2c66affSColin Finck 
73c2c66affSColin Finck     What are the other command ids for QueryStatus/FireCommandStateChange?
74c2c66affSColin Finck 
75c2c66affSColin Finck     Add handler for cabinet settings change
76c2c66affSColin Finck     Add handler for system metrics change (renegotiate border space?)
77c2c66affSColin Finck     Add handler for theme change and forward to contained windows
78c2c66affSColin Finck 
79c2c66affSColin Finck     When folders are shown, the status bar text should change
80c2c66affSColin Finck     Add code to save/restore shell view settings
81c2c66affSColin Finck     Implement tabbing between frames
82c2c66affSColin Finck     Fix handling of focus everywhere
83c2c66affSColin Finck     Most keyboard shortcuts don't work, such as F2 for rename, F5 for refresh (see list in "explorer keyboard shortcuts")
84c2c66affSColin Finck 
85c2c66affSColin Finck     The status bar doesn't show help text for items owned by frame during menu tracking
86c2c66affSColin Finck     Stub out frame command handlers
87c2c66affSColin Finck     "Arrange icons by" group is not checked properly
88c2c66affSColin Finck 
89c2c66affSColin Finck     When folders are hidden, icon is the same as the current shell object being displayed. When folders are shown,
90c2c66affSColin Finck         the icon is always an open folder with magnifying glass
91c2c66affSColin Finck     Fix bars to calculate height correctly
92c2c66affSColin Finck     Hookup policies for everything...
93c2c66affSColin Finck     Investigate toolbar message WM_USER+93
94c2c66affSColin Finck     Investigate toolbar message WM_USER+100 (Adds extra padding between parts of buttons with BTNS_DROPDOWN | BTNS_SHOWTEXT style
95c2c66affSColin Finck 
96c2c66affSColin Finck     Vertical Explorer Bar		CATID_InfoBand
97c2c66affSColin Finck     Horizontal Explorer Bar		CATID_CommBand
98c2c66affSColin Finck     Desk Band					CATID_DeskBand
99c2c66affSColin Finck 
100c2c66affSColin Finck     cache of bars
101c2c66affSColin Finck     HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}\Enum
102c2c66affSColin Finck     HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}\Enum
103c2c66affSColin Finck 
104c2c66affSColin Finck     create key here with CLSID of bar to register tool band
105c2c66affSColin Finck     HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Toolbar
106c2c66affSColin Finck 
107c2c66affSColin Finck */
108c2c66affSColin Finck 
109c2c66affSColin Finck #ifndef __GNUC__
110c2c66affSColin Finck #pragma comment(linker, \
111c2c66affSColin Finck     "\"/manifestdependency:type='Win32' "\
112c2c66affSColin Finck     "name='Microsoft.Windows.Common-Controls' "\
113c2c66affSColin Finck     "version='6.0.0.0' "\
114c2c66affSColin Finck     "processorArchitecture='*' "\
115c2c66affSColin Finck     "publicKeyToken='6595b64144ccf1df' "\
116c2c66affSColin Finck     "language='*'\"")
117c2c66affSColin Finck #endif // __GNUC__
118c2c66affSColin Finck 
119c2c66affSColin Finck static const unsigned int                   folderOptionsPageCountMax = 20;
120c2c66affSColin Finck static const long                           BTP_DONT_UPDATE_HISTORY = 0;
121c2c66affSColin Finck static const long                           BTP_UPDATE_CUR_HISTORY = 1;
122c2c66affSColin Finck static const long                           BTP_UPDATE_NEXT_HISTORY = 2;
123c2c66affSColin Finck 
124c2c66affSColin Finck BOOL                                        createNewStuff = false;
125c2c66affSColin Finck 
126c2c66affSColin Finck 
127c2c66affSColin Finck // this class is private to browseui.dll and is not registered externally?
128c2c66affSColin Finck //DEFINE_GUID(CLSID_ShellFldSetExt, 0x6D5313C0, 0x8C62, 0x11D1, 0xB2, 0xCD, 0x00, 0x60, 0x97, 0xDF, 0x8C, 0x11);
129c2c66affSColin Finck 
130c2c66affSColin Finck void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
131c2c66affSColin Finck {
132c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
133c2c66affSColin Finck     int                                     menuItemCount;
134c2c66affSColin Finck     int                                     curIndex;
135c2c66affSColin Finck 
136c2c66affSColin Finck     menuItemCount = GetMenuItemCount(theMenu);
137c2c66affSColin Finck     curIndex = 0;
138c2c66affSColin Finck     while (curIndex < menuItemCount)
139c2c66affSColin Finck     {
140c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
141c2c66affSColin Finck         menuItemInfo.fMask = MIIM_ID;
142c2c66affSColin Finck         if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
143c2c66affSColin Finck             menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
144c2c66affSColin Finck         {
145c2c66affSColin Finck             DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
146c2c66affSColin Finck             menuItemCount--;
147c2c66affSColin Finck         }
148c2c66affSColin Finck         else
149c2c66affSColin Finck             curIndex++;
150c2c66affSColin Finck     }
151c2c66affSColin Finck }
152c2c66affSColin Finck 
153c2c66affSColin Finck HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
154c2c66affSColin Finck {
155c2c66affSColin Finck     CComPtr<IShellFolder>                   desktop;
156c2c66affSColin Finck 
157c2c66affSColin Finck     HRESULT hr = ::SHGetDesktopFolder(&desktop);
158c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
159c2c66affSColin Finck         return E_FAIL;
160c2c66affSColin Finck     if (path == NULL || path->mkid.cb == 0)
161c2c66affSColin Finck     {
162c2c66affSColin Finck         *newFolder = desktop;
163c2c66affSColin Finck         desktop.p->AddRef ();
164c2c66affSColin Finck         return S_OK;
165c2c66affSColin Finck     }
166c2c66affSColin Finck     return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
167c2c66affSColin Finck }
168c2c66affSColin Finck 
169c2c66affSColin Finck static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClass");
1705cb06151SAmine Khaldi //static const TCHAR szExploreWndClass[] = TEXT("ExploreWClass");
171c2c66affSColin Finck 
172c2c66affSColin Finck class CDockManager;
173c2c66affSColin Finck class CShellBrowser;
174c2c66affSColin Finck 
175c2c66affSColin Finck class CToolbarProxy :
176c2c66affSColin Finck     public CWindowImpl<CToolbarProxy, CWindow, CControlWinTraits>
177c2c66affSColin Finck {
178c2c66affSColin Finck private:
179c2c66affSColin Finck     CComPtr<IExplorerToolbar>               fExplorerToolbar;
180c2c66affSColin Finck public:
181c2c66affSColin Finck     void Initialize(HWND parent, IUnknown *explorerToolbar);
182c2c66affSColin Finck     void Destroy();
183c2c66affSColin Finck private:
184c2c66affSColin Finck 
185c2c66affSColin Finck     // message handlers
186c2c66affSColin Finck     LRESULT OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
187c2c66affSColin Finck     LRESULT OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
188c2c66affSColin Finck 
189c2c66affSColin Finck     BEGIN_MSG_MAP(CToolbarProxy)
190c2c66affSColin Finck         MESSAGE_HANDLER(TB_ADDBITMAP, OnAddBitmap)
191c2c66affSColin Finck         MESSAGE_RANGE_HANDLER(WM_USER, 0x7fff, OnForwardMessage)
192c2c66affSColin Finck     END_MSG_MAP()
193c2c66affSColin Finck };
194c2c66affSColin Finck 
195c2c66affSColin Finck void CToolbarProxy::Initialize(HWND parent, IUnknown *explorerToolbar)
196c2c66affSColin Finck {
197c2c66affSColin Finck     HWND                                    myWindow;
198c2c66affSColin Finck     HRESULT                                 hResult;
199c2c66affSColin Finck 
200c2c66affSColin Finck     myWindow = SHCreateWorkerWindowW(0, parent, 0, WS_CHILD, NULL, 0);
201c2c66affSColin Finck     if (myWindow != NULL)
202c2c66affSColin Finck     {
203c2c66affSColin Finck         SubclassWindow(myWindow);
204c2c66affSColin Finck         SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
205c2c66affSColin Finck         hResult = explorerToolbar->QueryInterface(
206c2c66affSColin Finck             IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
207c2c66affSColin Finck     }
208c2c66affSColin Finck }
209c2c66affSColin Finck 
210c2c66affSColin Finck void CToolbarProxy::Destroy()
211c2c66affSColin Finck {
212c2c66affSColin Finck     DestroyWindow();
213c2c66affSColin Finck     fExplorerToolbar = NULL;
214c2c66affSColin Finck }
215c2c66affSColin Finck 
216c2c66affSColin Finck LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
217c2c66affSColin Finck {
218c2c66affSColin Finck     long int                                result;
219c2c66affSColin Finck     HRESULT                                 hResult;
220c2c66affSColin Finck 
221c2c66affSColin Finck     result = 0;
222c2c66affSColin Finck     if (fExplorerToolbar.p != NULL)
223c2c66affSColin Finck     {
224c2c66affSColin Finck         hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 1, (long)wParam,
225c2c66affSColin Finck             reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
226c2c66affSColin Finck         hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 2, (long)wParam,
227c2c66affSColin Finck             reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
228c2c66affSColin Finck     }
229c2c66affSColin Finck     return result;
230c2c66affSColin Finck }
231c2c66affSColin Finck 
232c2c66affSColin Finck LRESULT CToolbarProxy::OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
233c2c66affSColin Finck {
234c2c66affSColin Finck     LRESULT                                 result;
235c2c66affSColin Finck     HRESULT                                 hResult;
236c2c66affSColin Finck 
237c2c66affSColin Finck     result = 0;
238c2c66affSColin Finck     if (fExplorerToolbar.p != NULL)
239c2c66affSColin Finck         hResult = fExplorerToolbar->SendToolbarMsg(&CGID_ShellBrowser, uMsg, wParam, lParam, &result);
240c2c66affSColin Finck     return result;
241c2c66affSColin Finck }
242c2c66affSColin Finck 
243c2c66affSColin Finck /*
244c2c66affSColin Finck Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
245c2c66affSColin Finck     where vaIn will be a VT_UNKNOWN with the new bar. It also sends a RB_SHOWBAND to the
246c2c66affSColin Finck     rebar
247c2c66affSColin Finck */
248c2c66affSColin Finck 
249c2c66affSColin Finck struct MenuBandInfo {
250c2c66affSColin Finck     GUID barGuid;
251c2c66affSColin Finck     BOOL fVertical;
252c2c66affSColin Finck };
253c2c66affSColin Finck 
254c2c66affSColin Finck class CShellBrowser :
255c2c66affSColin Finck     public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
256c2c66affSColin Finck     public CComObjectRootEx<CComMultiThreadModelNoCS>,
257c2c66affSColin Finck     public IShellBrowser,
258c2c66affSColin Finck     public IDropTarget,
259c2c66affSColin Finck     public IServiceProvider,
260c2c66affSColin Finck     public IProfferServiceImpl<CShellBrowser>,
261c2c66affSColin Finck     public IShellBrowserService,
262c2c66affSColin Finck     public IWebBrowser2,
263c2c66affSColin Finck     public ITravelLogClient,
264c2c66affSColin Finck     public IPersistHistory,
265c2c66affSColin Finck     public IDockingWindowSite,
266c2c66affSColin Finck     public IOleCommandTarget,
267c2c66affSColin Finck     public IBrowserService2,
268c2c66affSColin Finck     public IConnectionPointContainerImpl<CShellBrowser>,
269c2c66affSColin Finck     public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>,
270c2c66affSColin Finck     public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>
271c2c66affSColin Finck {
272c2c66affSColin Finck private:
273c2c66affSColin Finck     class barInfo
274c2c66affSColin Finck     {
275c2c66affSColin Finck     public:
276e5f90298SMark Jansen         barInfo()
277e5f90298SMark Jansen         {
278e5f90298SMark Jansen             memset(&borderSpace, 0, sizeof(borderSpace));
279e5f90298SMark Jansen             hwnd = NULL;
280e5f90298SMark Jansen         }
281e5f90298SMark Jansen 
282c2c66affSColin Finck         RECT                                borderSpace;
283c2c66affSColin Finck         CComPtr<IUnknown>                   clientBar;
284c2c66affSColin Finck         HWND                                hwnd;
285c2c66affSColin Finck     };
286c2c66affSColin Finck     static const int                        BIInternetToolbar = 0;
287c2c66affSColin Finck     static const int                        BIVerticalBaseBar = 1;
288c2c66affSColin Finck     static const int                        BIHorizontalBaseBar = 2;
289c2c66affSColin Finck 
290c2c66affSColin Finck     HWND                                    fCurrentShellViewWindow;    // our currently hosted shell view window
291c2c66affSColin Finck     CComPtr<IShellFolder>                   fCurrentShellFolder;        //
292c2c66affSColin Finck     CComPtr<IShellView>                     fCurrentShellView;          //
293c2c66affSColin Finck     LPITEMIDLIST                            fCurrentDirectoryPIDL;      //
294c2c66affSColin Finck     HWND                                    fStatusBar;
295c2c66affSColin Finck     CToolbarProxy                           fToolbarProxy;
296c2c66affSColin Finck     barInfo                                 fClientBars[3];
297c2c66affSColin Finck     CComPtr<ITravelLog>                     fTravelLog;
298c2c66affSColin Finck     HMENU                                   fCurrentMenuBar;
299a0c5cafcSGiannis Adamopoulos     GUID                                    fCurrentVertBar;             //The guid of the built in vertical bar that is being shown
300c2c66affSColin Finck     // The next three fields support persisted history for shell views.
301c2c66affSColin Finck     // They do not need to be reference counted.
302c2c66affSColin Finck     IOleObject                              *fHistoryObject;
303c2c66affSColin Finck     IStream                                 *fHistoryStream;
304c2c66affSColin Finck     IBindCtx                                *fHistoryBindContext;
305c2c66affSColin Finck     HDSA menuDsa;
306c2c66affSColin Finck     HACCEL m_hAccel;
30743b3dc20SCarl J. Bialorucki     ShellSettings m_settings;
308c2c66affSColin Finck public:
309c2c66affSColin Finck #if 0
310c2c66affSColin Finck     ULONG InternalAddRef()
311c2c66affSColin Finck     {
312c2c66affSColin Finck         OutputDebugString(_T("AddRef\n"));
313c2c66affSColin Finck         return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalAddRef();
314c2c66affSColin Finck     }
315c2c66affSColin Finck     ULONG InternalRelease()
316c2c66affSColin Finck     {
317c2c66affSColin Finck         OutputDebugString(_T("Release\n"));
318c2c66affSColin Finck         return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalRelease();
319c2c66affSColin Finck     }
320c2c66affSColin Finck #endif
321c2c66affSColin Finck 
322c2c66affSColin Finck     CShellBrowser();
323c2c66affSColin Finck     ~CShellBrowser();
32462c33fbfSGiannis Adamopoulos     HRESULT Initialize();
325c2c66affSColin Finck public:
326c2c66affSColin Finck     HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
327c2c66affSColin Finck     HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
328c2c66affSColin Finck         FOLDERSETTINGS *folderSettings, long flags);
329c2c66affSColin Finck     HRESULT GetMenuBand(REFIID riid, void **shellMenu);
330c2c66affSColin Finck     HRESULT GetBaseBar(bool vertical, REFIID riid, void **theBaseBar);
33146ab3466SHermès Bélusca-Maïto     BOOL IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID);
332c2c66affSColin Finck     HRESULT ShowBand(const CLSID &classID, bool vertical);
333c2c66affSColin Finck     HRESULT NavigateToParent();
334c2c66affSColin Finck     HRESULT DoFolderOptions();
335c2c66affSColin Finck     static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
336c2c66affSColin Finck     void RepositionBars();
337c2c66affSColin Finck     HRESULT BuildExplorerBandMenu();
338c2c66affSColin Finck     HRESULT BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound);
339c2c66affSColin Finck     BOOL IsBuiltinBand(CLSID &bandID);
340c2c66affSColin Finck     virtual WNDPROC GetWindowProc()
341c2c66affSColin Finck     {
342c2c66affSColin Finck         return WindowProc;
343c2c66affSColin Finck     }
344c2c66affSColin Finck     HRESULT FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments);
345c2c66affSColin Finck     HRESULT FireNavigateComplete(const wchar_t *newDirectory);
346c2c66affSColin Finck     HRESULT FireCommandStateChange(bool newState, int commandID);
347c2c66affSColin Finck     HRESULT FireCommandStateChangeAll();
348c2c66affSColin Finck     HRESULT UpdateForwardBackState();
349c2c66affSColin Finck     HRESULT UpdateUpState();
350c2c66affSColin Finck     void UpdateGotoMenu(HMENU theMenu);
351c2c66affSColin Finck     void UpdateViewMenu(HMENU theMenu);
352f744bb29SCarl J. Bialorucki     void RefreshCabinetState();
353f744bb29SCarl J. Bialorucki     void UpdateWindowTitle();
354c2c66affSColin Finck 
355c2c66affSColin Finck /*    // *** IDockingWindowFrame methods ***
356*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(AddToolbar)(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags) override;
357*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RemoveToolbar)(IUnknown *punkSrc, DWORD dwRemoveFlags) override;
358*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(FindToolbar)(LPCWSTR pwszItem, REFIID riid, void **ppv) override;
359c2c66affSColin Finck     */
360c2c66affSColin Finck 
361c2c66affSColin Finck     // *** IDockingWindowSite methods ***
362*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBorderDW)(IUnknown* punkObj, LPRECT prcBorder) override;
363*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RequestBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
364*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
365c2c66affSColin Finck 
366c2c66affSColin Finck     // *** IOleCommandTarget methods ***
367*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds,
368*bb297bc3SKatayama Hirofumi MZ         OLECMD prgCmds[  ], OLECMDTEXT *pCmdText) override;
369*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID,
370*bb297bc3SKatayama Hirofumi MZ         DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
371c2c66affSColin Finck 
372c2c66affSColin Finck     // *** IOleWindow methods ***
373*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetWindow)(HWND *lphwnd) override;
374*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
375c2c66affSColin Finck 
376c2c66affSColin Finck     // *** IShellBrowser methods ***
377*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InsertMenusSB)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) override;
378*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetMenuSB)(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) override;
379*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RemoveMenusSB)(HMENU hmenuShared) override;
380*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetStatusTextSB)(LPCOLESTR pszStatusText) override;
381*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(EnableModelessSB)(BOOL fEnable) override;
382*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(TranslateAcceleratorSB)(MSG *pmsg, WORD wID) override;
383*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(BrowseObject)(LPCITEMIDLIST pidl, UINT wFlags) override;
384*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream **ppStrm) override;
385*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetControlWindow)(UINT id, HWND *lphwnd) override;
386*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SendControlMsg)(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) override;
387*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryActiveShellView)(IShellView **ppshv) override;
388*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnViewWindowActive)(IShellView *ppshv) override;
389*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetToolbarItems)(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) override;
390c2c66affSColin Finck 
391c2c66affSColin Finck     // *** IDropTarget methods ***
392*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragEnter)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
393*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
394*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragLeave)() override;
395*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Drop)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
396c2c66affSColin Finck 
397c2c66affSColin Finck     // *** IServiceProvider methods ***
398*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppvObject) override;
399c2c66affSColin Finck 
400c2c66affSColin Finck     // *** IShellBowserService methods ***
401*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPropertyBag)(long flags, REFIID riid, void **ppvObject) override;
402c2c66affSColin Finck 
403c2c66affSColin Finck     // *** IDispatch methods ***
404*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) override;
405*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
406*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetIDsOfNames)(
407*bb297bc3SKatayama Hirofumi MZ         REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override;
408*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
409*bb297bc3SKatayama Hirofumi MZ         DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
410c2c66affSColin Finck 
411c2c66affSColin Finck     // *** IBrowserService methods ***
412*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetParentSite)(IOleInPlaceSite **ppipsite) override;
413*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetTitle)(IShellView *psv, LPCWSTR pszName) override;
414*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTitle)(IShellView *psv, LPWSTR pszName, DWORD cchName) override;
415*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetOleObject)(IOleObject **ppobjv) override;
416*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTravelLog)(ITravelLog **pptl) override;
417*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ShowControlWindow)(UINT id, BOOL fShow) override;
418*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IsControlWindowShown)(UINT id, BOOL *pfShown) override;
419*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IEGetDisplayName)(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags) override;
420*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IEParseDisplayName)(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut) override;
421*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DisplayParseError)(HRESULT hres, LPCWSTR pwszPath) override;
422*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF) override;
423*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetNavigateState)(BNSTATE bnstate) override;
424*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetNavigateState)(BNSTATE *pbnstate) override;
425*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(NotifyRedirect)(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse) override;
426*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateWindowList)() override;
427*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateBackForwardState)() override;
428*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetFlags)(DWORD dwFlags, DWORD dwFlagMask) override;
429*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetFlags)(DWORD *pdwFlags) override;
430*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CanNavigateNow)( void) override;
431*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPidl)(LPITEMIDLIST *ppidl) override;
432*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetReferrer)(LPCITEMIDLIST pidl) override;
433*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(DWORD, GetBrowserIndex)() override;
434*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBrowserByIndex)(DWORD dwID, IUnknown **ppunk) override;
435*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetHistoryObject)(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc) override;
436*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetHistoryObject)(IOleObject *pole, BOOL fIsLocalAnchor) override;
437*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CacheOLEServer)(IOleObject *pole) override;
438*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetSetCodePage)(VARIANT *pvarIn, VARIANT *pvarOut) override;
439*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnHttpEquiv)(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut) override;
440*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPalette)(HPALETTE *hpal) override;
441*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RegisterWindow)(BOOL fForceRegister, int swc) override;
442c2c66affSColin Finck 
443c2c66affSColin Finck     // *** IBrowserService2 methods ***
444*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, WndProcBS)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
445*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetAsDefFolderSettings)() override;
446*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewRect)(RECT *prc) override;
447*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnSize)(WPARAM wParam) override;
448*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnCreate)(struct tagCREATESTRUCTW *pcs) override;
449*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, OnCommand)(WPARAM wParam, LPARAM lParam) override;
450*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnDestroy)() override;
451*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, OnNotify)(struct tagNMHDR *pnm) override;
452*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnSetFocus)() override;
453*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnFrameWindowActivateBS)(BOOL fActive) override;
454*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ReleaseShellView)() override;
455*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ActivatePendingView)() override;
456*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CreateViewWindow)(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd) override;
457*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CreateBrowserPropSheetExt)(REFIID riid, void **ppv) override;
458*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewWindow)(HWND *phwndView) override;
459*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBaseBrowserData)(LPCBASEBROWSERDATA *pbbd) override;
460*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LPBASEBROWSERDATA, PutBaseBrowserData)(void) override;
461*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeTravelLog)(ITravelLog *ptl, DWORD dw) override;
462*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetTopBrowser)() override;
463*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Offline)(int iCmd) override;
464*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(AllowViewResize)(BOOL f) override;
465*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetActivateState)(UINT u) override;
466*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateSecureLockIcon)(int eSecureLock) override;
467*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeDownloadManager)() override;
468*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeTransitionSite)() override;
469*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_Initialize)(HWND hwnd, IUnknown *pauto) override;
470*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CancelPendingNavigationAsync)( void) override;
471*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CancelPendingView)() override;
472*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_MaySaveChanges)() override;
473*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_PauseOrResumeView)(BOOL fPaused) override;
474*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_DisableModeless)() override;
475*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags) override;
476*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_TryShell2Rename)(IShellView *psv, LPCITEMIDLIST pidlNew) override;
477*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SwitchActivationNow)() override;
478*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ExecChildren)(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup,
479*bb297bc3SKatayama Hirofumi MZ         DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut) override;
480*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SendChildren)(
481*bb297bc3SKatayama Hirofumi MZ         HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
482*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetFolderSetData)(struct tagFolderSetData *pfsd) override;
483*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_OnFocusChange)(UINT itb) override;
484*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_ShowHideChildWindows)(BOOL fChildOnly) override;
485*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(UINT, _get_itbLastFocus)() override;
486*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_put_itbLastFocus)(UINT itbLastFocus) override;
487*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_UIActivateView)(UINT uState) override;
488*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetViewBorderRect)(RECT *prc) override;
489*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_UpdateViewRectSize)() override;
490*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeNextBorder)(UINT itb) override;
491*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeView)() override;
492*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetEffectiveClientArea)(LPRECT lprectBorder, HMONITOR hmon) override;
493*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(IStream *, v_GetViewStream)(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName) override;
494*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, ForwardViewMsg)(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
495*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetAcceleratorMenu)(HACCEL hacc) override;
496*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(int, _GetToolbarCount)() override;
497*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LPTOOLBARITEM, _GetToolbarItem)(int itb) override;
498*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SaveToolbars)(IStream *pstm) override;
499*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_LoadToolbars)(IStream *pstm) override;
500*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CloseAndReleaseToolbars)(BOOL fClose) override;
501*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_MayGetNextToolbarFocus)(LPMSG lpMsg, UINT itbNext,
502*bb297bc3SKatayama Hirofumi MZ         int citb, LPTOOLBARITEM *pptbi, HWND *phwnd) override;
503*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeNextBorderHelper)(UINT itb, BOOL bUseHmonitor) override;
504*bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(UINT, _FindTBar)(IUnknown *punkSrc) override;
505*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SetFocus)(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg) override;
506*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_MayTranslateAccelerator)(MSG *pmsg) override;
507*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetBorderDWHelper)(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor) override;
508*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_CheckZoneCrossing)(LPCITEMIDLIST pidl) override;
509c2c66affSColin Finck 
510c2c66affSColin Finck     // *** IWebBrowser methods ***
511*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoBack)() override;
512*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoForward)() override;
513*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoHome)() override;
514*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoSearch)() override;
515*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Navigate)(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName,
516*bb297bc3SKatayama Hirofumi MZ         VARIANT *PostData, VARIANT *Headers) override;
517*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Refresh)() override;
518*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Refresh2)(VARIANT *Level) override;
519*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Stop)() override;
520*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Application)(IDispatch **ppDisp) override;
521*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Parent)(IDispatch **ppDisp) override;
522*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Container)(IDispatch **ppDisp) override;
523*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Document)(IDispatch **ppDisp) override;
524*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_TopLevelContainer)(VARIANT_BOOL *pBool) override;
525*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Type)(BSTR *Type) override;
526*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Left)(long *pl) override;
527*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Left)(long Left) override;
528*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Top)(long *pl) override;
529*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Top)(long Top) override;
530*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Width)(long *pl) override;
531*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Width)(long Width) override;
532*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Height)(long *pl) override;
533*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Height)(long Height) override;
534*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_LocationName)(BSTR *LocationName) override;
535*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_LocationURL)(BSTR *LocationURL) override;
536*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Busy)(VARIANT_BOOL *pBool) override;
537c2c66affSColin Finck 
538c2c66affSColin Finck     // *** IWebBrowserApp methods ***
539*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Quit)() override;
540*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ClientToWindow)(int *pcx, int *pcy) override;
541*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(PutProperty)(BSTR Property, VARIANT vtValue) override;
542*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetProperty)(BSTR Property, VARIANT *pvtValue) override;
543*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Name)(BSTR *Name) override;
544*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_HWND)(SHANDLE_PTR *pHWND) override;
545*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_FullName)(BSTR *FullName) override;
546*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Path)(BSTR *Path) override;
547*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Visible)(VARIANT_BOOL *pBool) override;
548*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Visible)(VARIANT_BOOL Value) override;
549*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_StatusBar)(VARIANT_BOOL *pBool) override;
550*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_StatusBar)(VARIANT_BOOL Value) override;
551*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_StatusText)(BSTR *StatusText) override;
552*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_StatusText)(BSTR StatusText) override;
553*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_ToolBar)(int *Value) override;
554*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_ToolBar)(int Value) override;
555*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_MenuBar)(VARIANT_BOOL *Value) override;
556*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_MenuBar)(VARIANT_BOOL Value) override;
557*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_FullScreen)(VARIANT_BOOL *pbFullScreen) override;
558*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_FullScreen)(VARIANT_BOOL bFullScreen) override;
559c2c66affSColin Finck 
560c2c66affSColin Finck     // *** IWebBrowser2 methods ***
561*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Navigate2)(VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName,
562*bb297bc3SKatayama Hirofumi MZ         VARIANT *PostData, VARIANT *Headers) override;
563*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryStatusWB)(OLECMDID cmdID, OLECMDF *pcmdf) override;
564*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ExecWB)(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
565*bb297bc3SKatayama Hirofumi MZ         VARIANT *pvaIn, VARIANT *pvaOut) override;
566*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ShowBrowserBar)(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize) override;
567*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_ReadyState)(READYSTATE *plReadyState) override;
568*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Offline)(VARIANT_BOOL *pbOffline) override;
569*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Offline)(VARIANT_BOOL bOffline) override;
570*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Silent)(VARIANT_BOOL *pbSilent) override;
571*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Silent)(VARIANT_BOOL bSilent) override;
572*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_RegisterAsBrowser)(VARIANT_BOOL *pbRegister) override;
573*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_RegisterAsBrowser)(VARIANT_BOOL bRegister) override;
574*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_RegisterAsDropTarget)(VARIANT_BOOL *pbRegister) override;
575*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_RegisterAsDropTarget)(VARIANT_BOOL bRegister) override;
576*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_TheaterMode)(VARIANT_BOOL *pbRegister) override;
577*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_TheaterMode)(VARIANT_BOOL bRegister) override;
578*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_AddressBar)(VARIANT_BOOL *Value) override;
579*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_AddressBar)(VARIANT_BOOL Value) override;
580*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Resizable)(VARIANT_BOOL *Value) override;
581*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Resizable)(VARIANT_BOOL Value) override;
582c2c66affSColin Finck 
583c2c66affSColin Finck     // *** ITravelLogClient methods ***
584*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(FindWindowByIndex)(DWORD dwID, IUnknown **ppunk) override;
585*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetWindowData)(IStream *pStream, LPWINDOWDATA pWinData) override;
586*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(LoadHistoryPosition)(LPWSTR pszUrlLocation, DWORD dwPosition) override;
587c2c66affSColin Finck 
588c2c66affSColin Finck     // *** IPersist methods ***
589*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetClassID)(CLSID *pClassID) override;
590c2c66affSColin Finck 
591c2c66affSColin Finck     // *** IPersistHistory methods ***
592*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(LoadHistory)(IStream *pStream, IBindCtx *pbc) override;
593*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SaveHistory)(IStream *pStream) override;
594*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetPositionCookie)(DWORD dwPositioncookie) override;
595*bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPositionCookie)(DWORD *pdwPositioncookie) override;
596c2c66affSColin Finck 
597c2c66affSColin Finck     // message handlers
598c2c66affSColin Finck     LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
599c2c66affSColin Finck     LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
600c2c66affSColin Finck     LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
601c2c66affSColin Finck     LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
602c2c66affSColin Finck     LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
603c2c66affSColin Finck     LRESULT RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
604a882ec7aSKatayama Hirofumi MZ     LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
605c2c66affSColin Finck     LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
606c2c66affSColin Finck     LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
607c2c66affSColin Finck     LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
608c2c66affSColin Finck     LRESULT OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
609c2c66affSColin Finck     LRESULT OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
610c2c66affSColin Finck     LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
611c2c66affSColin Finck     LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
612c2c66affSColin Finck     LRESULT OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
613c2c66affSColin Finck     LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
614c2c66affSColin Finck     LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
615281f7c4eSKatayama Hirofumi MZ     LRESULT OnAddToFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
616c2c66affSColin Finck     LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
617c2c66affSColin Finck     LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
618c2c66affSColin Finck     LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
619c2c66affSColin Finck     LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
620c2c66affSColin Finck     LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
621c2c66affSColin Finck     LRESULT OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
622c2c66affSColin Finck     LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
623c2c66affSColin Finck     LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
624c2c66affSColin Finck     LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
625c2c66affSColin Finck     LRESULT OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
626c2c66affSColin Finck     LRESULT OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
627c2c66affSColin Finck     LRESULT RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
62843b3dc20SCarl J. Bialorucki     LRESULT OnSettingsChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
62943b3dc20SCarl J. Bialorucki     LRESULT OnGetSettingsPtr(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
630ff63d064SKatayama Hirofumi MZ     LRESULT OnAppCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
631c2c66affSColin Finck     HRESULT OnSearch();
632c2c66affSColin Finck 
633c2c66affSColin Finck     static ATL::CWndClassInfo& GetWndClassInfo()
634c2c66affSColin Finck     {
635c2c66affSColin Finck         static ATL::CWndClassInfo wc =
636c2c66affSColin Finck         {
637c2c66affSColin Finck             { sizeof(WNDCLASSEX), CS_DBLCLKS, StartWindowProc,
638c2c66affSColin Finck               0, 0, NULL, LoadIcon(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_CABINET)),
639c2c66affSColin Finck               LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW + 1), NULL, szCabinetWndClass, NULL },
640c2c66affSColin Finck             NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
641c2c66affSColin Finck         };
642c2c66affSColin Finck         return wc;
643c2c66affSColin Finck     }
644c2c66affSColin Finck 
645c2c66affSColin Finck     BEGIN_MSG_MAP(CShellBrowser)
646c2c66affSColin Finck         MESSAGE_HANDLER(WM_CREATE, OnCreate)
647c2c66affSColin Finck         MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
648c2c66affSColin Finck         MESSAGE_HANDLER(WM_SIZE, OnSize)
649c2c66affSColin Finck         MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup)
650c2c66affSColin Finck         MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
651c2c66affSColin Finck         MESSAGE_HANDLER(WM_MEASUREITEM, RelayMsgToShellView)
652c2c66affSColin Finck         MESSAGE_HANDLER(WM_DRAWITEM, RelayMsgToShellView)
653c2c66affSColin Finck         MESSAGE_HANDLER(WM_MENUSELECT, RelayMsgToShellView)
654a882ec7aSKatayama Hirofumi MZ         MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
655c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_FILE_CLOSE, OnClose)
656c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_FOLDEROPTIONS, OnFolderOptions)
657c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_MAPNETWORKDRIVE, OnMapNetworkDrive)
658c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_DISCONNECTNETWORKDRIVE, OnDisconnectNetworkDrive)
659c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_HELP_ABOUT, OnAboutReactOS)
660c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_BACK, OnGoBack)
661c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_FORWARD, OnGoForward)
662c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_UPONELEVEL, OnGoUpLevel)
663c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_HOMEPAGE, OnGoHome)
664281f7c4eSKatayama Hirofumi MZ         COMMAND_ID_HANDLER(IDM_FAVORITES_ADDTOFAVORITES, OnAddToFavorites)
665c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_FAVORITES_ORGANIZEFAVORITES, OnOrganizeFavorites)
666c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_VIEW_STATUSBAR, OnToggleStatusBarVisible)
667c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_VIEW_REFRESH, OnRefresh)
668c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_LOCKTOOLBARS, OnToggleToolbarLock)
669c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_STANDARDBUTTONS, OnToggleToolbarBandVisible)
670c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_ADDRESSBAR, OnToggleAddressBandVisible)
671c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_LINKSBAR, OnToggleLinksBandVisible)
672c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_TEXTLABELS, OnToggleTextLabels)
673c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_CUSTOMIZE, OnToolbarCustomize)
674c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_SEARCH, OnExplorerBar)
675c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FOLDERS, OnExplorerBar)
676c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_HISTORY, OnExplorerBar)
677c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FAVORITES, OnExplorerBar)
678c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_BACKSPACE, OnBackspace)
679c2c66affSColin Finck         COMMAND_RANGE_HANDLER(IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, OnGoTravel)
680c2c66affSColin Finck         COMMAND_RANGE_HANDLER(IDM_EXPLORERBAND_BEGINCUSTOM, IDM_EXPLORERBAND_ENDCUSTOM, OnExplorerBar)
681c2c66affSColin Finck         MESSAGE_HANDLER(WM_COMMAND, RelayCommands)
68243b3dc20SCarl J. Bialorucki         MESSAGE_HANDLER(BWM_SETTINGCHANGE, OnSettingsChange)
68343b3dc20SCarl J. Bialorucki         MESSAGE_HANDLER(BWM_GETSETTINGSPTR, OnGetSettingsPtr)
684ff63d064SKatayama Hirofumi MZ         MESSAGE_HANDLER(WM_APPCOMMAND, OnAppCommand)
685c2c66affSColin Finck     END_MSG_MAP()
686c2c66affSColin Finck 
687c2c66affSColin Finck     BEGIN_CONNECTION_POINT_MAP(CShellBrowser)
688c2c66affSColin Finck         CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
689c2c66affSColin Finck         CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
690c2c66affSColin Finck     END_CONNECTION_POINT_MAP()
691c2c66affSColin Finck 
692c2c66affSColin Finck     BEGIN_COM_MAP(CShellBrowser)
693c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
694c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
695c2c66affSColin Finck         COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
696c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
697c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
698c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
699c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IProfferService, IProfferService)
700c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
701c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
702c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IConnectionPointContainer, IConnectionPointContainer)
703c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser)
704c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowserApp)
705c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowser2, IWebBrowser2)
706c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_ITravelLogClient, ITravelLogClient)
707c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
708c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersistHistory, IPersistHistory)
709c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
710c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
711c2c66affSColin Finck     END_COM_MAP()
712c2c66affSColin Finck };
713c2c66affSColin Finck 
714c2c66affSColin Finck extern HRESULT CreateProgressDialog(REFIID riid, void **ppv);
715c2c66affSColin Finck 
716c2c66affSColin Finck CShellBrowser::CShellBrowser()
717c2c66affSColin Finck {
718c2c66affSColin Finck     fCurrentShellViewWindow = NULL;
719c2c66affSColin Finck     fCurrentDirectoryPIDL = NULL;
720c2c66affSColin Finck     fStatusBar = NULL;
721c2c66affSColin Finck     fCurrentMenuBar = NULL;
722c2c66affSColin Finck     fHistoryObject = NULL;
723c2c66affSColin Finck     fHistoryStream = NULL;
724c2c66affSColin Finck     fHistoryBindContext = NULL;
72543b3dc20SCarl J. Bialorucki     m_settings.Load();
726f744bb29SCarl J. Bialorucki     gCabinetState.Load();
727c2c66affSColin Finck }
728c2c66affSColin Finck 
729c2c66affSColin Finck CShellBrowser::~CShellBrowser()
730c2c66affSColin Finck {
731c2c66affSColin Finck     if (menuDsa)
732c2c66affSColin Finck         DSA_Destroy(menuDsa);
733c2c66affSColin Finck }
734c2c66affSColin Finck 
73562c33fbfSGiannis Adamopoulos HRESULT CShellBrowser::Initialize()
736c2c66affSColin Finck {
737c2c66affSColin Finck     CComPtr<IPersistStreamInit>             persistStreamInit;
738c2c66affSColin Finck     HRESULT                                 hResult;
739c2c66affSColin Finck     CComPtr<IUnknown> clientBar;
740c2c66affSColin Finck 
741c2c66affSColin Finck     _AtlInitialConstruct();
742c2c66affSColin Finck 
743c2c66affSColin Finck     menuDsa = DSA_Create(sizeof(MenuBandInfo), 5);
744c2c66affSColin Finck     if (!menuDsa)
745c2c66affSColin Finck         return E_OUTOFMEMORY;
746c2c66affSColin Finck 
747c2c66affSColin Finck     // create window
748c2c66affSColin Finck     Create(HWND_DESKTOP);
749c2c66affSColin Finck     if (m_hWnd == NULL)
750c2c66affSColin Finck         return E_FAIL;
751c2c66affSColin Finck 
752c2c66affSColin Finck     hResult = CInternetToolbar_CreateInstance(IID_PPV_ARG(IUnknown, &clientBar));
753c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
754c2c66affSColin Finck         return hResult;
755c2c66affSColin Finck 
756c2c66affSColin Finck     fClientBars[BIInternetToolbar].clientBar = clientBar;
757c2c66affSColin Finck 
758c2c66affSColin Finck     // create interfaces
759c2c66affSColin Finck     hResult = clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
760c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
761c2c66affSColin Finck         return hResult;
762c2c66affSColin Finck 
763c2c66affSColin Finck     hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
764c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
765c2c66affSColin Finck         return hResult;
766c2c66affSColin Finck 
767c2c66affSColin Finck     hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
768c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
769c2c66affSColin Finck         return hResult;
770c2c66affSColin Finck 
771c2c66affSColin Finck     // TODO: create settingsStream from registry entry
772c2c66affSColin Finck     //if (settingsStream.p)
773c2c66affSColin Finck     //{
774c2c66affSColin Finck     //    hResult = persistStreamInit->Load(settingsStream);
775c2c66affSColin Finck     //    if (FAILED_UNEXPECTEDLY(hResult))
776c2c66affSColin Finck     //        return hResult;
777c2c66affSColin Finck     //}
778c2c66affSColin Finck     //else
779c2c66affSColin Finck     {
780c2c66affSColin Finck         hResult = persistStreamInit->InitNew();
781c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
782c2c66affSColin Finck             return hResult;
783c2c66affSColin Finck     }
784c2c66affSColin Finck 
785c2c66affSColin Finck     hResult = IUnknown_ShowDW(clientBar, TRUE);
786c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
787c2c66affSColin Finck         return hResult;
788c2c66affSColin Finck 
789c2c66affSColin Finck     fToolbarProxy.Initialize(m_hWnd, clientBar);
790c2c66affSColin Finck 
791c2c66affSColin Finck     // create status bar
792bfadb22dSCarl J. Bialorucki     DWORD dwStatusStyle = WS_CHILD | WS_CLIPSIBLINGS | SBARS_SIZEGRIP | SBARS_TOOLTIPS;
79343b3dc20SCarl J. Bialorucki     if (m_settings.fStatusBarVisible)
794bfadb22dSCarl J. Bialorucki         dwStatusStyle |= WS_VISIBLE;
795bfadb22dSCarl J. Bialorucki     fStatusBar = ::CreateWindowExW(0, STATUSCLASSNAMEW, NULL, dwStatusStyle,
796bfadb22dSCarl J. Bialorucki                                    0, 0, 500, 20, m_hWnd, (HMENU)IDC_STATUSBAR,
797c2c66affSColin Finck                                    _AtlBaseModule.GetModuleInstance(), 0);
798c2c66affSColin Finck 
799c2c66affSColin Finck     ShowWindow(SW_SHOWNORMAL);
80062c33fbfSGiannis Adamopoulos     UpdateWindow();
801c2c66affSColin Finck 
802c2c66affSColin Finck     return S_OK;
803c2c66affSColin Finck }
804c2c66affSColin Finck 
805c2c66affSColin Finck HRESULT CShellBrowser::BrowseToPIDL(LPCITEMIDLIST pidl, long flags)
806c2c66affSColin Finck {
807c2c66affSColin Finck     CComPtr<IShellFolder>                   newFolder;
808c2c66affSColin Finck     FOLDERSETTINGS                          newFolderSettings;
809c2c66affSColin Finck     HRESULT                                 hResult;
810d70e7989SCarl J. Bialorucki     CLSID                                   clsid;
811d70e7989SCarl J. Bialorucki     BOOL                                    HasIconViewType;
812c2c66affSColin Finck 
813c2c66affSColin Finck     // called by shell view to browse to new folder
814c2c66affSColin Finck     // also called by explorer band to navigate to new folder
815c2c66affSColin Finck     hResult = SHBindToFolder(pidl, &newFolder);
816c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
817c2c66affSColin Finck         return hResult;
818d70e7989SCarl J. Bialorucki     // HACK & FIXME: Get view mode from shellbag when fully implemented.
819d70e7989SCarl J. Bialorucki     IUnknown_GetClassID(newFolder, &clsid);
820d70e7989SCarl J. Bialorucki     HasIconViewType = clsid == CLSID_MyComputer || clsid == CLSID_ControlPanel ||
821d70e7989SCarl J. Bialorucki                       clsid == CLSID_ShellDesktop;
822c2c66affSColin Finck 
823d70e7989SCarl J. Bialorucki     if (HasIconViewType)
824c2c66affSColin Finck         newFolderSettings.ViewMode = FVM_ICON;
825d70e7989SCarl J. Bialorucki     else
826d70e7989SCarl J. Bialorucki         newFolderSettings.ViewMode = FVM_DETAILS;
827c2c66affSColin Finck     newFolderSettings.fFlags = 0;
828c2c66affSColin Finck     hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
829c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
830c2c66affSColin Finck         return hResult;
831c2c66affSColin Finck     return S_OK;
832c2c66affSColin Finck }
833c2c66affSColin Finck 
834c2c66affSColin Finck BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
835c2c66affSColin Finck {
836c2c66affSColin Finck     LPCITEMIDLIST                           pidlnext;
837c2c66affSColin Finck     WORD                                    length;
838c2c66affSColin Finck     BOOL                                    ret;
839c2c66affSColin Finck 
840c2c66affSColin Finck     ret = TRUE;
841c2c66affSColin Finck     if (! _ILIsDesktop(pidl))
842c2c66affSColin Finck     {
843c2c66affSColin Finck         length = pidl->mkid.cb;
844c2c66affSColin Finck         pidlnext =
845c2c66affSColin Finck             reinterpret_cast<LPCITEMIDLIST>(
846c2c66affSColin Finck                 reinterpret_cast<const BYTE *>(pidl) + length);
847c2c66affSColin Finck         if (pidlnext->mkid.cb != 0)
848c2c66affSColin Finck             ret = FALSE;
849c2c66affSColin Finck     }
850c2c66affSColin Finck     return ret;
851c2c66affSColin Finck }
852c2c66affSColin Finck 
853c2c66affSColin Finck HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *unused, LPCITEMIDLIST pidl,
854c2c66affSColin Finck     const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
855c2c66affSColin Finck {
856c2c66affSColin Finck     CComPtr<IShellFolder>                   psf;
857c2c66affSColin Finck     LPITEMIDLIST                            pidlChild;
858c2c66affSColin Finck     LPITEMIDLIST                            pidlParent;
859c2c66affSColin Finck     HRESULT                                 hResult;
860c2c66affSColin Finck 
861c2c66affSColin Finck     hResult = E_FAIL;
862c2c66affSColin Finck     if (ppv == NULL)
863c2c66affSColin Finck         return E_POINTER;
864c2c66affSColin Finck     *ppv = NULL;
865c2c66affSColin Finck     if (ppidlLast != NULL)
866c2c66affSColin Finck         *ppidlLast = NULL;
867c2c66affSColin Finck     if (_ILIsPidlSimple(pidl))
868c2c66affSColin Finck     {
869c2c66affSColin Finck         if (ppidlLast != NULL)
870c2c66affSColin Finck             *ppidlLast = ILClone(pidl);
871c2c66affSColin Finck         hResult = SHGetDesktopFolder((IShellFolder **)ppv);
872c2c66affSColin Finck     }
873c2c66affSColin Finck     else
874c2c66affSColin Finck     {
875c2c66affSColin Finck         pidlChild = ILClone(ILFindLastID(pidl));
876c2c66affSColin Finck         pidlParent = ILClone(pidl);
877c2c66affSColin Finck         ILRemoveLastID(pidlParent);
878c2c66affSColin Finck         hResult = SHGetDesktopFolder(&psf);
879c2c66affSColin Finck         if (SUCCEEDED(hResult))
880c2c66affSColin Finck             hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
881c2c66affSColin Finck         if (SUCCEEDED(hResult) && ppidlLast != NULL)
882c2c66affSColin Finck             *ppidlLast = pidlChild;
883c2c66affSColin Finck         else
884c2c66affSColin Finck             ILFree(pidlChild);
885c2c66affSColin Finck         ILFree(pidlParent);
886c2c66affSColin Finck     }
887c2c66affSColin Finck     return hResult;
888c2c66affSColin Finck }
889c2c66affSColin Finck 
890c2c66affSColin Finck HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10,
891c2c66affSColin Finck     LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
892c2c66affSColin Finck {
893c2c66affSColin Finck     CComPtr<IShellFolder>                   parentFolder;
894c2c66affSColin Finck     LPITEMIDLIST                            childPIDL = NULL;
895c2c66affSColin Finck     STRRET                                  L108;
896c2c66affSColin Finck     HRESULT                                 hResult;
897c2c66affSColin Finck 
898c2c66affSColin Finck     hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
899c2c66affSColin Finck     if (FAILED(hResult))
900c2c66affSColin Finck         goto cleanup;
901c2c66affSColin Finck 
902c2c66affSColin Finck     hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
903c2c66affSColin Finck     if (FAILED(hResult))
904c2c66affSColin Finck         goto cleanup;
905c2c66affSColin Finck 
906c2c66affSColin Finck     StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
907c2c66affSColin Finck     if (rgfInOut)
908c2c66affSColin Finck     {
909c2c66affSColin Finck         hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
910c2c66affSColin Finck         if (FAILED(hResult))
911c2c66affSColin Finck             goto cleanup;
912c2c66affSColin Finck     }
913c2c66affSColin Finck 
914c2c66affSColin Finck     hResult = S_OK;
915c2c66affSColin Finck 
916c2c66affSColin Finck cleanup:
917c2c66affSColin Finck     if (childPIDL)
918c2c66affSColin Finck         ILFree(childPIDL);
919c2c66affSColin Finck     return hResult;
920c2c66affSColin Finck }
921c2c66affSColin Finck 
922f744bb29SCarl J. Bialorucki HRESULT IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
923c2c66affSColin Finck {
924c2c66affSColin Finck     return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
925c2c66affSColin Finck }
926c2c66affSColin Finck 
927c2c66affSColin Finck HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
928c2c66affSColin Finck     LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
929c2c66affSColin Finck {
930c2c66affSColin Finck     CComPtr<IShellFolder>                   saveCurrentShellFolder;
931c2c66affSColin Finck     CComPtr<IShellView>                     saveCurrentShellView;
932c2c66affSColin Finck     CComPtr<IShellView>                     newShellView;
933c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
934c2c66affSColin Finck     HWND                                    newShellViewWindow;
935c2c66affSColin Finck     BOOL                                    windowUpdateIsLocked;
936c2c66affSColin Finck     RECT                                    shellViewWindowBounds;
937c2c66affSColin Finck     HWND                                    previousView;
938c2c66affSColin Finck     HCURSOR                                 saveCursor;
939c2c66affSColin Finck     wchar_t                                 newTitle[MAX_PATH];
940c2c66affSColin Finck     SHGDNF                                  nameFlags;
941c2c66affSColin Finck     HRESULT                                 hResult;
942c2c66affSColin Finck 
943c2c66affSColin Finck     if (newShellFolder == NULL)
944c2c66affSColin Finck         return E_INVALIDARG;
945c2c66affSColin Finck 
946c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
947c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
948c2c66affSColin Finck         return hResult;
949c2c66affSColin Finck 
950c2c66affSColin Finck     // update history
951c2c66affSColin Finck     if (flags & BTP_UPDATE_CUR_HISTORY)
952c2c66affSColin Finck     {
953c2c66affSColin Finck         if (travelLog->CountEntries(static_cast<IDropTarget *>(this)) > 0)
954c2c66affSColin Finck             hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
955c2c66affSColin Finck         // what to do with error? Do we want to halt browse because state save failed?
956c2c66affSColin Finck     }
957c2c66affSColin Finck 
958c2c66affSColin Finck     if (fCurrentShellView)
959c2c66affSColin Finck     {
960c2c66affSColin Finck         fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
961c2c66affSColin Finck     }
962c2c66affSColin Finck 
963c2c66affSColin Finck     // create view object
964c2c66affSColin Finck     hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
965c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
966c2c66affSColin Finck         return hResult;
967c2c66affSColin Finck     previousView = fCurrentShellViewWindow;
968c2c66affSColin Finck 
969c2c66affSColin Finck     // enter updating section
970c2c66affSColin Finck     saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
971c2c66affSColin Finck     windowUpdateIsLocked = LockWindowUpdate(TRUE);
972c2c66affSColin Finck     if (fCurrentShellView != NULL)
973c2c66affSColin Finck         ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0);
974c2c66affSColin Finck 
975c2c66affSColin Finck     // set site
976c2c66affSColin Finck     hResult = IUnknown_SetSite(newShellView, static_cast<IDropTarget *>(this));
977c2c66affSColin Finck 
978c2c66affSColin Finck     // update folder and view
979c2c66affSColin Finck     saveCurrentShellFolder = fCurrentShellFolder;
980c2c66affSColin Finck     saveCurrentShellView = fCurrentShellView;
981c2c66affSColin Finck     fCurrentShellFolder = newShellFolder;
982c2c66affSColin Finck     fCurrentShellView = newShellView;
983c2c66affSColin Finck 
984c2c66affSColin Finck     // get boundary
985c2c66affSColin Finck     if (previousView != NULL)
986c2c66affSColin Finck         ::GetWindowRect(previousView, &shellViewWindowBounds);
987c2c66affSColin Finck     else
988c2c66affSColin Finck         ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
989c2c66affSColin Finck     ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
990c2c66affSColin Finck 
991ca087b6aSMark Jansen     // update current pidl
992ca087b6aSMark Jansen     ILFree(fCurrentDirectoryPIDL);
993ca087b6aSMark Jansen     fCurrentDirectoryPIDL = ILClone(absolutePIDL);
994ca087b6aSMark Jansen 
995c2c66affSColin Finck     // create view window
996c2c66affSColin Finck     hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
997c2c66affSColin Finck         this, &shellViewWindowBounds, &newShellViewWindow);
998c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult) || newShellViewWindow == NULL)
999c2c66affSColin Finck     {
1000c2c66affSColin Finck         fCurrentShellView = saveCurrentShellView;
1001c2c66affSColin Finck         fCurrentShellFolder = saveCurrentShellFolder;
1002c2c66affSColin Finck         ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 1, 0);
1003c2c66affSColin Finck         if (windowUpdateIsLocked)
1004c2c66affSColin Finck             LockWindowUpdate(FALSE);
1005c2c66affSColin Finck         SetCursor(saveCursor);
1006c2c66affSColin Finck         return hResult;
1007c2c66affSColin Finck     }
1008c2c66affSColin Finck 
1009c2c66affSColin Finck     // update view window
1010c2c66affSColin Finck     if (saveCurrentShellView != NULL)
1011c2c66affSColin Finck         saveCurrentShellView->DestroyViewWindow();
1012c2c66affSColin Finck     fCurrentShellViewWindow = newShellViewWindow;
1013c2c66affSColin Finck 
101462c33fbfSGiannis Adamopoulos     if (previousView == NULL)
101562c33fbfSGiannis Adamopoulos     {
101662c33fbfSGiannis Adamopoulos         RepositionBars();
101762c33fbfSGiannis Adamopoulos     }
101862c33fbfSGiannis Adamopoulos 
1019c2c66affSColin Finck     // no use
1020c2c66affSColin Finck     saveCurrentShellView.Release();
1021c2c66affSColin Finck     saveCurrentShellFolder.Release();
1022c2c66affSColin Finck 
1023c2c66affSColin Finck     hResult = newShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
1024c2c66affSColin Finck 
1025c2c66affSColin Finck     // leave updating section
1026c2c66affSColin Finck     if (windowUpdateIsLocked)
1027c2c66affSColin Finck         LockWindowUpdate(FALSE);
1028c2c66affSColin Finck     SetCursor(saveCursor);
1029c2c66affSColin Finck 
1030c2c66affSColin Finck     // update history
1031c2c66affSColin Finck     if (flags & BTP_UPDATE_NEXT_HISTORY)
1032c2c66affSColin Finck     {
1033c2c66affSColin Finck         hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1034c2c66affSColin Finck         hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1035c2c66affSColin Finck     }
1036c2c66affSColin Finck 
1037c2c66affSColin Finck     // completed
1038c2c66affSColin Finck     nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1039c2c66affSColin Finck     hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1040c2c66affSColin Finck         sizeof(newTitle) / sizeof(wchar_t), NULL);
1041c2c66affSColin Finck     if (SUCCEEDED(hResult))
1042c2c66affSColin Finck     {
1043c2c66affSColin Finck         FireNavigateComplete(newTitle);
1044c2c66affSColin Finck     }
1045c2c66affSColin Finck     else
1046c2c66affSColin Finck     {
1047c2c66affSColin Finck         FireNavigateComplete(L"ERROR");
1048c2c66affSColin Finck     }
1049c2c66affSColin Finck 
1050f744bb29SCarl J. Bialorucki     UpdateWindowTitle();
1051c2c66affSColin Finck 
1052c2c66affSColin Finck     LPCITEMIDLIST pidlChild;
1053c2c66affSColin Finck     INT index, indexOpen;
1054c2c66affSColin Finck     HIMAGELIST himlSmall, himlLarge;
1055c2c66affSColin Finck 
1056c2c66affSColin Finck     CComPtr<IShellFolder> sf;
1057c2c66affSColin Finck     hResult = SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1058c2c66affSColin Finck     if (SUCCEEDED(hResult))
1059c2c66affSColin Finck     {
1060c2c66affSColin Finck         index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1061c2c66affSColin Finck 
1062c2c66affSColin Finck         Shell_GetImageLists(&himlLarge, &himlSmall);
1063c2c66affSColin Finck 
1064c2c66affSColin Finck         HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1065c2c66affSColin Finck         HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1066c2c66affSColin Finck 
1067c2c66affSColin Finck         /* Hack to make it possible to release the old icons */
1068c2c66affSColin Finck         /* Something seems to go wrong with WM_SETICON */
1069c2c66affSColin Finck         HICON oldSmall = (HICON)SendMessage(WM_GETICON, ICON_SMALL, 0);
1070c2c66affSColin Finck         HICON oldLarge = (HICON)SendMessage(WM_GETICON, ICON_BIG,   0);
1071c2c66affSColin Finck 
1072c2c66affSColin Finck         SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1073c2c66affSColin Finck         SendMessage(WM_SETICON, ICON_BIG,   reinterpret_cast<LPARAM>(icLarge));
1074c2c66affSColin Finck 
1075c2c66affSColin Finck         DestroyIcon(oldSmall);
1076c2c66affSColin Finck         DestroyIcon(oldLarge);
1077c2c66affSColin Finck     }
1078c2c66affSColin Finck 
1079c2c66affSColin Finck     FireCommandStateChangeAll();
1080c2c66affSColin Finck     hResult = UpdateForwardBackState();
1081c2c66affSColin Finck     hResult = UpdateUpState();
1082c2c66affSColin Finck     return S_OK;
1083c2c66affSColin Finck }
1084c2c66affSColin Finck 
1085c2c66affSColin Finck HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
1086c2c66affSColin Finck {
1087c2c66affSColin Finck     CComPtr<IBandSite>                      bandSite;
1088c2c66affSColin Finck     CComPtr<IDeskBand>                      deskBand;
1089c2c66affSColin Finck     HRESULT                                 hResult;
1090c2c66affSColin Finck 
1091c2c66affSColin Finck     if (!fClientBars[BIInternetToolbar].clientBar)
1092c2c66affSColin Finck         return E_FAIL;
1093c2c66affSColin Finck 
1094c2c66affSColin Finck     hResult = IUnknown_QueryService(fClientBars[BIInternetToolbar].clientBar, SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
1095c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1096c2c66affSColin Finck         return hResult;
1097c2c66affSColin Finck 
1098c2c66affSColin Finck     hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1099c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1100c2c66affSColin Finck         return hResult;
1101c2c66affSColin Finck 
1102c2c66affSColin Finck     return deskBand->QueryInterface(riid, shellMenu);
1103c2c66affSColin Finck }
1104c2c66affSColin Finck 
1105c2c66affSColin Finck HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
1106c2c66affSColin Finck {
1107c2c66affSColin Finck     CComPtr<IUnknown>                       newBaseBar;
1108c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1109c2c66affSColin Finck     CComPtr<IUnknown>                       newBaseBarSite;
1110c2c66affSColin Finck     CComPtr<IDeskBarClient>                 deskBarClient;
1111c2c66affSColin Finck     IUnknown                                **cache;
1112c2c66affSColin Finck     HRESULT                                 hResult;
1113c2c66affSColin Finck 
1114c2c66affSColin Finck     if (vertical)
1115c2c66affSColin Finck         cache = &fClientBars[BIVerticalBaseBar].clientBar.p;
1116c2c66affSColin Finck     else
1117c2c66affSColin Finck         cache = &fClientBars[BIHorizontalBaseBar].clientBar.p;
1118c2c66affSColin Finck     if (*cache == NULL)
1119c2c66affSColin Finck     {
1120c2c66affSColin Finck         hResult = CBaseBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBar), vertical);
1121c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1122c2c66affSColin Finck             return hResult;
1123c2c66affSColin Finck         hResult = CBaseBarSite_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBarSite), vertical);
1124c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1125c2c66affSColin Finck             return hResult;
1126c2c66affSColin Finck 
1127c2c66affSColin Finck         // we have to store our basebar into cache now
1128c2c66affSColin Finck         *cache = newBaseBar;
1129cd2d2841SMark Jansen         (*cache)->AddRef();
1130c2c66affSColin Finck 
1131c2c66affSColin Finck         // tell the new base bar about the shell browser
1132c2c66affSColin Finck         hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
1133c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1134c2c66affSColin Finck             return hResult;
1135c2c66affSColin Finck 
1136c2c66affSColin Finck         // tell the new base bar about the new base bar site
1137c2c66affSColin Finck         hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1138c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1139c2c66affSColin Finck             return hResult;
1140c2c66affSColin Finck         hResult = deskBar->SetClient(newBaseBarSite);
1141c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1142c2c66affSColin Finck             return hResult;
1143c2c66affSColin Finck 
1144c2c66affSColin Finck         // tell the new base bar site about the new base bar
1145c2c66affSColin Finck         hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1146c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1147c2c66affSColin Finck             return hResult;
1148c2c66affSColin Finck         hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1149c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1150c2c66affSColin Finck             return hResult;
1151c2c66affSColin Finck 
1152c2c66affSColin Finck     }
1153c2c66affSColin Finck     return (*cache)->QueryInterface(riid, theBaseBar);
1154c2c66affSColin Finck }
1155c2c66affSColin Finck 
1156c2c66affSColin Finck BOOL CShellBrowser::IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID)
1157c2c66affSColin Finck {
1158c2c66affSColin Finck     HRESULT                                 hResult;
1159c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1160c2c66affSColin Finck     CComPtr<IUnknown>                       baseBarSite;
1161c2c66affSColin Finck     CComPtr<IBandSite>                      bandSite;
1162c2c66affSColin Finck     CLSID                                   clsidTmp;
1163c2c66affSColin Finck     DWORD                                   numBands;
1164c2c66affSColin Finck     DWORD                                   dwBandID;
1165c2c66affSColin Finck     DWORD                                   i;
1166c2c66affSColin Finck 
1167c2c66affSColin Finck     /* Get our basebarsite to be able to enumerate bands */
1168c2c66affSColin Finck     hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1169c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1170c2c66affSColin Finck         return FALSE;
1171c2c66affSColin Finck     hResult = deskBar->GetClient(&baseBarSite);
1172c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1173c2c66affSColin Finck         return FALSE;
1174c2c66affSColin Finck     hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &bandSite));
1175c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1176c2c66affSColin Finck         return FALSE;
1177c2c66affSColin Finck 
1178c2c66affSColin Finck     hResult = bandSite->EnumBands(-1, &numBands);
1179c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1180c2c66affSColin Finck         return FALSE;
1181c2c66affSColin Finck 
1182c2c66affSColin Finck     for(i = 0; i < numBands; i++)
1183c2c66affSColin Finck     {
1184c2c66affSColin Finck         CComPtr<IPersist> bandPersist;
1185c2c66affSColin Finck 
1186c2c66affSColin Finck         hResult = bandSite->EnumBands(i, &dwBandID);
1187c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1188c2c66affSColin Finck             return FALSE;
1189c2c66affSColin Finck 
1190c2c66affSColin Finck         hResult = bandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &bandPersist));
1191c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1192c2c66affSColin Finck             return FALSE;
1193c2c66affSColin Finck         hResult = bandPersist->GetClassID(&clsidTmp);
1194c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1195c2c66affSColin Finck             return FALSE;
1196c2c66affSColin Finck         if (IsEqualGUID(clsidBand, clsidTmp))
1197c2c66affSColin Finck         {
1198c2c66affSColin Finck             if (pdwBandID) *pdwBandID = dwBandID;
1199c2c66affSColin Finck             return TRUE;
1200c2c66affSColin Finck         }
1201c2c66affSColin Finck     }
1202c2c66affSColin Finck     return FALSE;
1203c2c66affSColin Finck }
1204c2c66affSColin Finck 
1205c2c66affSColin Finck HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1206c2c66affSColin Finck {
1207c2c66affSColin Finck     CComPtr<IDockingWindow>                 dockingWindow;
1208c2c66affSColin Finck     CComPtr<IUnknown>                       baseBarSite;
1209c2c66affSColin Finck     CComPtr<IUnknown>                       newBand;
1210c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1211c2c66affSColin Finck     VARIANT                                 vaIn;
1212c2c66affSColin Finck     HRESULT                                 hResult;
1213c2c66affSColin Finck     DWORD                                   dwBandID;
1214c2c66affSColin Finck 
1215c2c66affSColin Finck     hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1216c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1217c2c66affSColin Finck         return hResult;
1218c2c66affSColin Finck 
1219c2c66affSColin Finck     hResult = deskBar->GetClient(&baseBarSite);
1220c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1221c2c66affSColin Finck         return hResult;
1222c2c66affSColin Finck 
1223c2c66affSColin Finck     hResult = deskBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1224c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1225c2c66affSColin Finck         return hResult;
1226c2c66affSColin Finck 
1227c2c66affSColin Finck     if (!IsBandLoaded(classID, vertical, &dwBandID))
1228c2c66affSColin Finck     {
1229c2c66affSColin Finck         TRACE("ShowBand called for CLSID %s, vertical=%d...\n", wine_dbgstr_guid(&classID), vertical);
1230c2c66affSColin Finck         if (IsEqualCLSID(CLSID_ExplorerBand, classID))
1231c2c66affSColin Finck         {
1232c2c66affSColin Finck             TRACE("CLSID_ExplorerBand requested, building internal band.\n");
1233c2c66affSColin Finck             hResult = CExplorerBand_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
1234c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hResult))
1235c2c66affSColin Finck                 return hResult;
1236c2c66affSColin Finck         }
12374212f4b1SBrock Mammen         else if (IsEqualCLSID(classID, CLSID_FileSearchBand))
12384212f4b1SBrock Mammen         {
12394212f4b1SBrock Mammen             TRACE("CLSID_FileSearchBand requested, building internal band.\n");
12404212f4b1SBrock Mammen             hResult = CSearchBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
12414212f4b1SBrock Mammen             if (FAILED_UNEXPECTEDLY(hResult))
12424212f4b1SBrock Mammen                 return hResult;
12434212f4b1SBrock Mammen         }
1244c2c66affSColin Finck         else
1245c2c66affSColin Finck         {
1246c2c66affSColin Finck             TRACE("A different CLSID requested, using CoCreateInstance.\n");
1247c2c66affSColin Finck             hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1248c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hResult))
1249c2c66affSColin Finck                 return hResult;
1250c2c66affSColin Finck         }
1251c2c66affSColin Finck     }
1252c2c66affSColin Finck     else
1253c2c66affSColin Finck     {
1254c2c66affSColin Finck         CComPtr<IBandSite>                  pBandSite;
1255c2c66affSColin Finck 
1256c2c66affSColin Finck         hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
1257c2c66affSColin Finck         if (!SUCCEEDED(hResult))
1258c2c66affSColin Finck         {
1259c2c66affSColin Finck             ERR("Can't get IBandSite interface\n");
1260c2c66affSColin Finck             return E_FAIL;
1261c2c66affSColin Finck         }
1262c2c66affSColin Finck         hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
1263c2c66affSColin Finck         if (!SUCCEEDED(hResult))
1264c2c66affSColin Finck         {
1265c2c66affSColin Finck             ERR("Can't find band object\n");
1266c2c66affSColin Finck             return E_FAIL;
1267c2c66affSColin Finck         }
1268c2c66affSColin Finck 
1269c2c66affSColin Finck         // It's hackish, but we should be able to show the wanted band until we
1270c2c66affSColin Finck         // find the proper way to do this (but it seems to work to add a new band)
1271c2c66affSColin Finck         // Here we'll just re-add the existing band to the site, causing it to display.
1272c2c66affSColin Finck     }
1273c2c66affSColin Finck     V_VT(&vaIn) = VT_UNKNOWN;
1274c2c66affSColin Finck     V_UNKNOWN(&vaIn) = newBand.p;
1275c2c66affSColin Finck     hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
1276c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1277c2c66affSColin Finck     {
1278c2c66affSColin Finck         return hResult;
1279c2c66affSColin Finck     }
1280c2c66affSColin Finck 
1281c2c66affSColin Finck     hResult = dockingWindow->ShowDW(TRUE);
1282c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1283c2c66affSColin Finck         return hResult;
1284c2c66affSColin Finck 
1285a0c5cafcSGiannis Adamopoulos     if (vertical)
1286a0c5cafcSGiannis Adamopoulos     {
1287a0c5cafcSGiannis Adamopoulos         fCurrentVertBar = classID;
1288a0c5cafcSGiannis Adamopoulos         FireCommandStateChangeAll();
1289a0c5cafcSGiannis Adamopoulos     }
1290a0c5cafcSGiannis Adamopoulos 
1291c2c66affSColin Finck     return S_OK;
1292c2c66affSColin Finck }
1293c2c66affSColin Finck 
1294c2c66affSColin Finck HRESULT CShellBrowser::NavigateToParent()
1295c2c66affSColin Finck {
1296c2c66affSColin Finck     LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL);
1297c2c66affSColin Finck     if (newDirectory == NULL)
1298c2c66affSColin Finck         return E_OUTOFMEMORY;
1299c2c66affSColin Finck     if (_ILIsDesktop(newDirectory))
1300c2c66affSColin Finck     {
1301c2c66affSColin Finck         ILFree(newDirectory);
1302c2c66affSColin Finck         return E_INVALIDARG;
1303c2c66affSColin Finck     }
1304c2c66affSColin Finck     ILRemoveLastID(newDirectory);
1305c2c66affSColin Finck     HRESULT hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1306c2c66affSColin Finck     ILFree(newDirectory);
1307c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1308c2c66affSColin Finck         return hResult;
1309c2c66affSColin Finck     return S_OK;
1310c2c66affSColin Finck }
1311c2c66affSColin Finck 
1312c2c66affSColin Finck BOOL CALLBACK AddFolderOptionsPage(HPROPSHEETPAGE thePage, LPARAM lParam)
1313c2c66affSColin Finck {
1314c2c66affSColin Finck     PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1315c2c66affSColin Finck     if (sheetInfo->nPages >= folderOptionsPageCountMax)
1316c2c66affSColin Finck         return FALSE;
1317c2c66affSColin Finck     sheetInfo->phpage[sheetInfo->nPages] = thePage;
1318c2c66affSColin Finck     sheetInfo->nPages++;
1319c2c66affSColin Finck     return TRUE;
1320c2c66affSColin Finck }
1321c2c66affSColin Finck 
1322c2c66affSColin Finck HRESULT CShellBrowser::DoFolderOptions()
1323c2c66affSColin Finck {
1324c2c66affSColin Finck     CComPtr<IShellPropSheetExt>             folderOptionsSheet;
1325c2c66affSColin Finck     PROPSHEETHEADER                         m_PropSheet;
1326c2c66affSColin Finck     HPROPSHEETPAGE                          m_psp[folderOptionsPageCountMax];
1327c2c66affSColin Finck //    CComPtr<IGlobalFolderSettings>          globalSettings;
1328c2c66affSColin Finck //    SHELLSTATE2                             shellState;
1329c2c66affSColin Finck     HRESULT                                 hResult;
1330c2c66affSColin Finck 
1331c2c66affSColin Finck     memset(m_psp, 0, sizeof(m_psp));
1332c2c66affSColin Finck     memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1333c2c66affSColin Finck 
1334c2c66affSColin Finck     // create sheet object
1335c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1336c2c66affSColin Finck         IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1337c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1338c2c66affSColin Finck         return E_FAIL;
1339c2c66affSColin Finck 
1340c2c66affSColin Finck     // must set site in order for Apply to all Folders on Advanced page to be enabled
1341c2c66affSColin Finck     hResult = IUnknown_SetSite(folderOptionsSheet, static_cast<IDispatch *>(this));
1342c2c66affSColin Finck     m_PropSheet.phpage = m_psp;
1343c2c66affSColin Finck 
1344c2c66affSColin Finck #if 0
1345c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1346c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1347c2c66affSColin Finck         return E_FAIL;
1348c2c66affSColin Finck     hResult = globalSettings->Get(&shellState, sizeof(shellState));
1349c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1350c2c66affSColin Finck         return E_FAIL;
1351c2c66affSColin Finck #endif
1352c2c66affSColin Finck 
1353c2c66affSColin Finck     // add pages
1354c2c66affSColin Finck     hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1355c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1356c2c66affSColin Finck         return E_FAIL;
1357c2c66affSColin Finck 
1358c2c66affSColin Finck // CORE-11140 : Disabled this bit, because it prevents the folder options from showing.
1359c2c66affSColin Finck //              It returns 'E_NOTIMPL'
1360c2c66affSColin Finck #if 0
1361c2c66affSColin Finck     if (fCurrentShellView != NULL)
1362c2c66affSColin Finck     {
1363c2c66affSColin Finck         hResult = fCurrentShellView->AddPropertySheetPages(
1364c2c66affSColin Finck             0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1365c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1366c2c66affSColin Finck             return E_FAIL;
1367c2c66affSColin Finck     }
1368c2c66affSColin Finck #endif
1369c2c66affSColin Finck 
1370c2c66affSColin Finck     // show sheet
1371f222e89dSKatayama Hirofumi MZ     CStringW strFolderOptions(MAKEINTRESOURCEW(IDS_FOLDER_OPTIONS));
1372c2c66affSColin Finck     m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1373c2c66affSColin Finck     m_PropSheet.dwFlags = 0;
1374c2c66affSColin Finck     m_PropSheet.hwndParent = m_hWnd;
1375c2c66affSColin Finck     m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1376f222e89dSKatayama Hirofumi MZ     m_PropSheet.pszCaption = strFolderOptions;
1377c2c66affSColin Finck     m_PropSheet.nStartPage = 0;
1378c2c66affSColin Finck     PropertySheet(&m_PropSheet);
1379c2c66affSColin Finck     return S_OK;
1380c2c66affSColin Finck }
1381c2c66affSColin Finck 
1382c2c66affSColin Finck LRESULT CALLBACK CShellBrowser::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1383c2c66affSColin Finck {
1384c2c66affSColin Finck     CShellBrowser                           *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1385c2c66affSColin Finck     _ATL_MSG                                msg(pThis->m_hWnd, uMsg, wParam, lParam);
1386c2c66affSColin Finck     LRESULT                                 lResult;
1387c2c66affSColin Finck     const _ATL_MSG                          *previousMessage;
1388c2c66affSColin Finck     BOOL                                    handled;
1389c2c66affSColin Finck     WNDPROC                                 saveWindowProc;
1390c2c66affSColin Finck     HRESULT                                 hResult;
1391c2c66affSColin Finck 
1392c2c66affSColin Finck     hWnd = pThis->m_hWnd;
1393c2c66affSColin Finck     previousMessage = pThis->m_pCurrentMsg;
1394c2c66affSColin Finck     pThis->m_pCurrentMsg = &msg;
1395c2c66affSColin Finck 
1396c2c66affSColin Finck     /* If the shell browser is initialized, let the menu band preprocess the messages */
1397c2c66affSColin Finck     if (pThis->fCurrentDirectoryPIDL)
1398c2c66affSColin Finck     {
1399c2c66affSColin Finck         CComPtr<IMenuBand> menuBand;
1400c2c66affSColin Finck         hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1401c2c66affSColin Finck         if (SUCCEEDED(hResult) && menuBand.p != NULL)
1402c2c66affSColin Finck         {
1403c2c66affSColin Finck             hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1404c2c66affSColin Finck             if (hResult == S_OK)
1405c2c66affSColin Finck                 return lResult;
1406c2c66affSColin Finck             uMsg = msg.message;
1407c2c66affSColin Finck             wParam = msg.wParam;
1408c2c66affSColin Finck             lParam = msg.lParam;
1409c2c66affSColin Finck         }
1410c2c66affSColin Finck         menuBand.Release();
1411c2c66affSColin Finck     }
1412c2c66affSColin Finck 
1413c2c66affSColin Finck     handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1414c2c66affSColin Finck     ATLASSERT(pThis->m_pCurrentMsg == &msg);
1415c2c66affSColin Finck     if (handled == FALSE)
1416c2c66affSColin Finck     {
1417c2c66affSColin Finck         if (uMsg == WM_NCDESTROY)
1418c2c66affSColin Finck         {
1419d281d14fSTimo Kreuzer             saveWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
1420c2c66affSColin Finck             lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1421d281d14fSTimo Kreuzer             if (saveWindowProc == reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)))
1422d281d14fSTimo Kreuzer                 ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc);
1423c2c66affSColin Finck             pThis->m_dwState |= WINSTATE_DESTROYED;
1424c2c66affSColin Finck         }
1425c2c66affSColin Finck         else
1426c2c66affSColin Finck             lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1427c2c66affSColin Finck     }
1428c2c66affSColin Finck     pThis->m_pCurrentMsg = previousMessage;
1429c2c66affSColin Finck     if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1430c2c66affSColin Finck     {
1431c2c66affSColin Finck         pThis->m_dwState &= ~WINSTATE_DESTROYED;
1432c2c66affSColin Finck         pThis->m_hWnd = NULL;
1433c2c66affSColin Finck         pThis->OnFinalMessage(hWnd);
1434c2c66affSColin Finck     }
1435c2c66affSColin Finck     return lResult;
1436c2c66affSColin Finck }
1437c2c66affSColin Finck 
1438c2c66affSColin Finck void CShellBrowser::RepositionBars()
1439c2c66affSColin Finck {
1440c2c66affSColin Finck     RECT                                    clientRect;
1441c2c66affSColin Finck     RECT                                    statusRect;
1442c2c66affSColin Finck     int                                     x;
1443c2c66affSColin Finck 
1444c2c66affSColin Finck     GetClientRect(&clientRect);
1445c2c66affSColin Finck 
144643b3dc20SCarl J. Bialorucki     if (m_settings.fStatusBarVisible && fStatusBar)
1447c2c66affSColin Finck     {
1448c2c66affSColin Finck         ::GetWindowRect(fStatusBar, &statusRect);
1449c2c66affSColin Finck         ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1450c2c66affSColin Finck                             clientRect.right - clientRect.left,
1451c2c66affSColin Finck                             statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1452c2c66affSColin Finck         clientRect.bottom -= statusRect.bottom - statusRect.top;
1453c2c66affSColin Finck     }
1454c2c66affSColin Finck 
1455c2c66affSColin Finck     for (x = 0; x < 3; x++)
1456c2c66affSColin Finck     {
1457c2c66affSColin Finck         HWND hwnd = fClientBars[x].hwnd;
1458c2c66affSColin Finck         RECT borderSpace = fClientBars[x].borderSpace;
1459c2c66affSColin Finck         if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1460c2c66affSColin Finck         {
1461c2c66affSColin Finck             IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1462c2c66affSColin Finck             fClientBars[x].hwnd = hwnd;
1463c2c66affSColin Finck         }
1464c2c66affSColin Finck         if (hwnd != NULL)
1465c2c66affSColin Finck         {
1466c2c66affSColin Finck             RECT toolbarRect = clientRect;
1467c2c66affSColin Finck             if (borderSpace.top != 0)
1468c2c66affSColin Finck             {
1469c2c66affSColin Finck                 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1470c2c66affSColin Finck             }
1471c2c66affSColin Finck             else if (borderSpace.bottom != 0)
1472c2c66affSColin Finck             {
1473c2c66affSColin Finck                 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1474c2c66affSColin Finck             }
1475c2c66affSColin Finck             else if (borderSpace.left != 0)
1476c2c66affSColin Finck             {
1477c2c66affSColin Finck                 toolbarRect.right = toolbarRect.left + borderSpace.left;
1478c2c66affSColin Finck             }
1479c2c66affSColin Finck             else if (borderSpace.right != 0)
1480c2c66affSColin Finck             {
1481c2c66affSColin Finck                 toolbarRect.left = toolbarRect.right - borderSpace.right;
1482c2c66affSColin Finck             }
1483c2c66affSColin Finck 
1484c2c66affSColin Finck             ::SetWindowPos(hwnd, NULL,
1485c2c66affSColin Finck                 toolbarRect.left,
1486c2c66affSColin Finck                 toolbarRect.top,
1487c2c66affSColin Finck                 toolbarRect.right - toolbarRect.left,
1488c2c66affSColin Finck                 toolbarRect.bottom - toolbarRect.top,
1489c2c66affSColin Finck                 SWP_NOOWNERZORDER | SWP_NOZORDER);
1490c2c66affSColin Finck 
1491c2c66affSColin Finck             if (borderSpace.top != 0)
1492c2c66affSColin Finck             {
1493c2c66affSColin Finck                 clientRect.top = toolbarRect.bottom;
1494c2c66affSColin Finck             }
1495c2c66affSColin Finck             else if (borderSpace.bottom != 0)
1496c2c66affSColin Finck             {
1497c2c66affSColin Finck                 clientRect.bottom = toolbarRect.top;
1498c2c66affSColin Finck             }
1499c2c66affSColin Finck             else if (borderSpace.left != 0)
1500c2c66affSColin Finck             {
1501c2c66affSColin Finck                 clientRect.left = toolbarRect.right;
1502c2c66affSColin Finck             }
1503c2c66affSColin Finck             else if (borderSpace.right != 0)
1504c2c66affSColin Finck             {
1505c2c66affSColin Finck                 clientRect.right = toolbarRect.left;
1506c2c66affSColin Finck             }
1507c2c66affSColin Finck         }
1508c2c66affSColin Finck     }
1509c2c66affSColin Finck     ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1510c2c66affSColin Finck                         clientRect.right - clientRect.left,
1511c2c66affSColin Finck                         clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1512c2c66affSColin Finck }
1513c2c66affSColin Finck 
1514c2c66affSColin Finck HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1515c2c66affSColin Finck {
1516c2c66affSColin Finck     DISPPARAMS                          params;
1517c2c66affSColin Finck     CComDynamicUnkArray                 &vec = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>::m_vec;
1518c2c66affSColin Finck     CComDynamicUnkArray                 &vec2 = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>::m_vec;
1519c2c66affSColin Finck     HRESULT                             hResult;
1520c2c66affSColin Finck 
1521c2c66affSColin Finck     params.rgvarg = arguments;
1522c2c66affSColin Finck     params.rgdispidNamedArgs = NULL;
1523c2c66affSColin Finck     params.cArgs = argCount;
1524c2c66affSColin Finck     params.cNamedArgs = 0;
1525c2c66affSColin Finck     IUnknown** pp = vec.begin();
1526c2c66affSColin Finck     while (pp < vec.end())
1527c2c66affSColin Finck     {
1528c2c66affSColin Finck         if (*pp != NULL)
1529c2c66affSColin Finck         {
1530c2c66affSColin Finck             CComPtr<IDispatch>          theDispatch;
1531c2c66affSColin Finck 
1532c2c66affSColin Finck             hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1533c2c66affSColin Finck             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1534c2c66affSColin Finck         }
1535c2c66affSColin Finck         pp++;
1536c2c66affSColin Finck     }
1537c2c66affSColin Finck     pp = vec2.begin();
1538c2c66affSColin Finck     while (pp < vec2.end())
1539c2c66affSColin Finck     {
1540c2c66affSColin Finck         if (*pp != NULL)
1541c2c66affSColin Finck         {
1542c2c66affSColin Finck             CComPtr<IDispatch>          theDispatch;
1543c2c66affSColin Finck 
1544c2c66affSColin Finck             hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1545c2c66affSColin Finck             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1546c2c66affSColin Finck         }
1547c2c66affSColin Finck         pp++;
1548c2c66affSColin Finck     }
1549c2c66affSColin Finck     return S_OK;
1550c2c66affSColin Finck }
1551c2c66affSColin Finck 
1552c2c66affSColin Finck HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1553c2c66affSColin Finck {
1554c2c66affSColin Finck     // these two variants intentionally to do use CComVariant because it would double free/release
1555c2c66affSColin Finck     // or does not need to dispose at all
1556c2c66affSColin Finck     VARIANT                             varArg[2];
1557c2c66affSColin Finck     VARIANT                             varArgs;
1558c2c66affSColin Finck     CComBSTR                            tempString(newDirectory);
1559c2c66affSColin Finck 
1560c2c66affSColin Finck     V_VT(&varArgs) = VT_BSTR;
1561c2c66affSColin Finck     V_BSTR(&varArgs) = tempString.m_str;
1562c2c66affSColin Finck 
1563c2c66affSColin Finck     V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1564c2c66affSColin Finck     V_VARIANTREF(&varArg[0]) = &varArgs;
1565c2c66affSColin Finck     V_VT(&varArg[1]) = VT_DISPATCH;
1566c2c66affSColin Finck     V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1567c2c66affSColin Finck 
1568c2c66affSColin Finck     return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1569c2c66affSColin Finck }
1570c2c66affSColin Finck 
1571c2c66affSColin Finck HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1572c2c66affSColin Finck {
1573c2c66affSColin Finck     VARIANT                             varArg[2];
1574c2c66affSColin Finck 
1575c2c66affSColin Finck     V_VT(&varArg[0]) = VT_BOOL;
1576c2c66affSColin Finck     V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1577c2c66affSColin Finck     V_VT(&varArg[1]) = VT_I4;
1578c2c66affSColin Finck     V_I4(&varArg[1]) = commandID;
1579c2c66affSColin Finck 
1580c2c66affSColin Finck     return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1581c2c66affSColin Finck }
1582c2c66affSColin Finck 
1583c2c66affSColin Finck HRESULT CShellBrowser::FireCommandStateChangeAll()
1584c2c66affSColin Finck {
1585c2c66affSColin Finck     return FireCommandStateChange(false, -1);
1586c2c66affSColin Finck }
1587c2c66affSColin Finck 
1588c2c66affSColin Finck HRESULT CShellBrowser::UpdateForwardBackState()
1589c2c66affSColin Finck {
1590c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1591c2c66affSColin Finck     CComPtr<ITravelEntry>                   unusedEntry;
1592c2c66affSColin Finck     bool                                    canGoBack;
1593c2c66affSColin Finck     bool                                    canGoForward;
1594c2c66affSColin Finck     HRESULT                                 hResult;
1595c2c66affSColin Finck 
1596c2c66affSColin Finck     canGoBack = false;
1597c2c66affSColin Finck     canGoForward = false;
1598c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
1599c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1600c2c66affSColin Finck         return hResult;
1601c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1602c2c66affSColin Finck     if (SUCCEEDED(hResult))
1603c2c66affSColin Finck     {
1604c2c66affSColin Finck         canGoBack = true;
1605c2c66affSColin Finck         unusedEntry.Release();
1606c2c66affSColin Finck     }
1607c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1608c2c66affSColin Finck     if (SUCCEEDED(hResult))
1609c2c66affSColin Finck     {
1610c2c66affSColin Finck         canGoForward = true;
1611c2c66affSColin Finck         unusedEntry.Release();
1612c2c66affSColin Finck     }
1613c2c66affSColin Finck     hResult = FireCommandStateChange(canGoBack, 2);
1614c2c66affSColin Finck     hResult = FireCommandStateChange(canGoForward, 1);
1615c2c66affSColin Finck     return S_OK;
1616c2c66affSColin Finck }
1617c2c66affSColin Finck 
1618c2c66affSColin Finck HRESULT CShellBrowser::UpdateUpState()
1619c2c66affSColin Finck {
1620c2c66affSColin Finck     bool canGoUp;
1621c2c66affSColin Finck     HRESULT hResult;
1622c2c66affSColin Finck 
1623c2c66affSColin Finck     canGoUp = true;
1624c2c66affSColin Finck     if (_ILIsDesktop(fCurrentDirectoryPIDL))
1625c2c66affSColin Finck         canGoUp = false;
1626c2c66affSColin Finck     hResult = FireCommandStateChange(canGoUp, 3);
1627c2c66affSColin Finck     return S_OK;
1628c2c66affSColin Finck }
1629c2c66affSColin Finck 
1630c2c66affSColin Finck void CShellBrowser::UpdateGotoMenu(HMENU theMenu)
1631c2c66affSColin Finck {
1632c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1633c2c66affSColin Finck     CComPtr<ITravelEntry>                   unusedEntry;
1634c2c66affSColin Finck     int                                     position;
1635c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
1636c2c66affSColin Finck     HRESULT                                 hResult;
1637c2c66affSColin Finck 
1638c2c66affSColin Finck     DeleteMenuItems(theMenu, IDM_GOTO_TRAVEL_FIRST, IDM_GOTO_TRAVEL_LAST);
1639c2c66affSColin Finck 
1640c2c66affSColin Finck     position = GetMenuItemCount(theMenu);
1641c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
1642c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1643c2c66affSColin Finck         return;
1644c2c66affSColin Finck 
1645c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1646c2c66affSColin Finck                                         TLOG_BACK,
1647c2c66affSColin Finck                                         &unusedEntry);
1648c2c66affSColin Finck 
1649c2c66affSColin Finck     if (SUCCEEDED(hResult))
1650c2c66affSColin Finck     {
1651c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_BACK, TRUE);
1652c2c66affSColin Finck         unusedEntry.Release();
1653c2c66affSColin Finck     }
1654c2c66affSColin Finck     else
1655c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_BACK, FALSE);
1656c2c66affSColin Finck 
1657c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1658c2c66affSColin Finck                                         TLOG_FORE,
1659c2c66affSColin Finck                                         &unusedEntry);
1660c2c66affSColin Finck 
1661c2c66affSColin Finck     if (SUCCEEDED(hResult))
1662c2c66affSColin Finck     {
1663c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_FORWARD, TRUE);
1664c2c66affSColin Finck         unusedEntry.Release();
1665c2c66affSColin Finck     }
1666c2c66affSColin Finck     else
1667c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_FORWARD, FALSE);
1668c2c66affSColin Finck 
1669c2c66affSColin Finck     SHEnableMenuItem(theMenu,
1670c2c66affSColin Finck                      IDM_GOTO_UPONELEVEL,
1671c2c66affSColin Finck                      !_ILIsDesktop(fCurrentDirectoryPIDL));
1672c2c66affSColin Finck 
1673c2c66affSColin Finck     hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1674c2c66affSColin Finck         IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, TLMENUF_BACKANDFORTH | TLMENUF_CHECKCURRENT);
1675c2c66affSColin Finck     if (SUCCEEDED(hResult))
1676c2c66affSColin Finck     {
1677c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1678c2c66affSColin Finck         menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1679c2c66affSColin Finck         menuItemInfo.fType = MF_SEPARATOR;
1680c2c66affSColin Finck         menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1681c2c66affSColin Finck         InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1682c2c66affSColin Finck     }
1683c2c66affSColin Finck }
1684c2c66affSColin Finck 
1685c2c66affSColin Finck void CShellBrowser::UpdateViewMenu(HMENU theMenu)
1686c2c66affSColin Finck {
1687c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1688c2c66affSColin Finck     HMENU                                   gotoMenu;
1689c2c66affSColin Finck     OLECMD                                  commandList[5];
1690c2c66affSColin Finck     HMENU                                   toolbarMenuBar;
1691c2c66affSColin Finck     HMENU                                   toolbarMenu;
1692c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
1693c2c66affSColin Finck     HRESULT                                 hResult;
1694c2c66affSColin Finck 
1695c2c66affSColin Finck     gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1696c2c66affSColin Finck     if (gotoMenu != NULL)
1697c2c66affSColin Finck         UpdateGotoMenu(gotoMenu);
1698c2c66affSColin Finck 
1699c2c66affSColin Finck     commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1700c2c66affSColin Finck     commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1701c2c66affSColin Finck     commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1702c2c66affSColin Finck     commandList[3].cmdID = ITID_TOOLBARLOCKED;
1703c2c66affSColin Finck     commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1704c2c66affSColin Finck 
1705c2c66affSColin Finck     hResult = IUnknown_QueryStatus(fClientBars[BIInternetToolbar].clientBar,
1706c2c66affSColin Finck                                    CGID_PrivCITCommands, 5, commandList, NULL);
1707c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1708c2c66affSColin Finck         DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND);
1709c2c66affSColin Finck     else
1710c2c66affSColin Finck     {
1711c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1712c2c66affSColin Finck         menuItemInfo.fMask = MIIM_SUBMENU;
1713c2c66affSColin Finck         GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1714c2c66affSColin Finck         DestroyMenu(menuItemInfo.hSubMenu);
1715c2c66affSColin Finck 
1716c2c66affSColin Finck         toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1717c2c66affSColin Finck         toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1718c2c66affSColin Finck         RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION);
1719c2c66affSColin Finck         DestroyMenu(toolbarMenuBar);
1720c2c66affSColin Finck 
1721c2c66affSColin Finck         // TODO: Implement
1722c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_ENABLED);
1723c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1724c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1725c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, commandList[4].cmdf & OLECMDF_ENABLED);
1726c2c66affSColin Finck 
1727c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_LATCHED);
1728c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_LATCHED);
1729c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_LATCHED);
1730c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_LATCHED);
1731c2c66affSColin Finck         if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1732c2c66affSColin Finck             DeleteMenu(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
1733c2c66affSColin Finck         DeleteMenu(toolbarMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
1734c2c66affSColin Finck         DeleteMenu(toolbarMenu, IDM_TOOLBARS_GOBUTTON, MF_BYCOMMAND);
1735c2c66affSColin Finck 
1736c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1737c2c66affSColin Finck         menuItemInfo.fMask = MIIM_SUBMENU;
1738c2c66affSColin Finck         menuItemInfo.hSubMenu = toolbarMenu;
1739c2c66affSColin Finck         SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1740c2c66affSColin Finck     }
174143b3dc20SCarl J. Bialorucki     SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, m_settings.fStatusBarVisible ? TRUE : FALSE);
1742c2c66affSColin Finck }
1743c2c66affSColin Finck 
1744c2c66affSColin Finck HRESULT CShellBrowser::BuildExplorerBandMenu()
1745c2c66affSColin Finck {
1746c2c66affSColin Finck     HMENU                                   hBandsMenu;
1747c2c66affSColin Finck     UINT                                    nbFound;
1748c2c66affSColin Finck 
1749c2c66affSColin Finck     hBandsMenu = SHGetMenuFromID(fCurrentMenuBar, IDM_VIEW_EXPLORERBAR);
1750c2c66affSColin Finck     if (!hBandsMenu)
1751c2c66affSColin Finck     {
1752c2c66affSColin Finck         OutputDebugString(L"No menu !\n");
1753c2c66affSColin Finck         return E_FAIL;
1754c2c66affSColin Finck     }
1755c2c66affSColin Finck     DSA_DeleteAllItems(menuDsa);
1756c2c66affSColin Finck     BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
1757c2c66affSColin Finck     BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
1758c2c66affSColin Finck     if (!nbFound)
1759c2c66affSColin Finck     {
1760c2c66affSColin Finck         // Remove separator
1761c2c66affSColin Finck         DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_SEPARATOR, MF_BYCOMMAND);
1762c2c66affSColin Finck     }
1763c2c66affSColin Finck     // Remove media menu since XP does it (according to API Monitor)
1764c2c66affSColin Finck     DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_MEDIA, MF_BYCOMMAND);
1765c2c66affSColin Finck     return S_OK;
1766c2c66affSColin Finck }
1767c2c66affSColin Finck 
1768c2c66affSColin Finck HRESULT CShellBrowser::BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound)
1769c2c66affSColin Finck {
1770c2c66affSColin Finck     HRESULT                                 hr;
1771c2c66affSColin Finck     CComPtr<IEnumGUID>                      pEnumGUID;
1772c2c66affSColin Finck     WCHAR                                   wszBandName[MAX_PATH];
1773c2c66affSColin Finck     WCHAR                                   wszBandGUID[MAX_PATH];
1774c2c66affSColin Finck     WCHAR                                   wRegKey[MAX_PATH];
1775c2c66affSColin Finck     UINT                                    cBands;
1776c2c66affSColin Finck     DWORD                                   dwRead;
1777c2c66affSColin Finck     DWORD                                   dwDataSize;
1778c2c66affSColin Finck     GUID                                    iter;
1779c2c66affSColin Finck     MenuBandInfo                            mbi;
1780c2c66affSColin Finck 
1781c2c66affSColin Finck     mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
1782c2c66affSColin Finck     cBands = 0;
1783c2c66affSColin Finck     hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
1784c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
1785c2c66affSColin Finck     {
1786c2c66affSColin Finck         return hr;
1787c2c66affSColin Finck     }
1788c2c66affSColin Finck     do
1789c2c66affSColin Finck     {
1790c2c66affSColin Finck         pEnumGUID->Next(1, &iter, &dwRead);
1791c2c66affSColin Finck         if (dwRead)
1792c2c66affSColin Finck         {
1793c2c66affSColin Finck             // Get the band name
1794c2c66affSColin Finck             if (IsBuiltinBand(iter))
1795c2c66affSColin Finck                 continue;
1796c2c66affSColin Finck             if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
1797c2c66affSColin Finck                 continue;
1798c2c66affSColin Finck             StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
1799c2c66affSColin Finck             dwDataSize = MAX_PATH;
1800c2c66affSColin Finck             SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
1801c2c66affSColin Finck 
1802c2c66affSColin Finck             mbi.barGuid = iter;
1803c2c66affSColin Finck             InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
1804c2c66affSColin Finck             DSA_AppendItem(menuDsa, &mbi);
1805c2c66affSColin Finck             cBands++;
1806c2c66affSColin Finck         }
1807c2c66affSColin Finck     }
1808c2c66affSColin Finck     while (dwRead > 0);
1809c2c66affSColin Finck     if (nbFound)
1810c2c66affSColin Finck         *nbFound = cBands;
1811c2c66affSColin Finck     return S_OK;
1812c2c66affSColin Finck }
1813c2c66affSColin Finck 
1814c2c66affSColin Finck BOOL CShellBrowser::IsBuiltinBand(CLSID &bandID)
1815c2c66affSColin Finck {
1816c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
1817c2c66affSColin Finck         return TRUE;
1818c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
1819c2c66affSColin Finck         return TRUE;
1820c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
1821c2c66affSColin Finck         return TRUE;
1822c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
1823c2c66affSColin Finck         return TRUE;
1824c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
1825c2c66affSColin Finck         return TRUE;
1826c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
1827c2c66affSColin Finck         return TRUE;
1828c2c66affSColin Finck     return FALSE;
1829c2c66affSColin Finck }
1830c2c66affSColin Finck 
1831c2c66affSColin Finck HRESULT CShellBrowser::OnSearch()
1832c2c66affSColin Finck {
1833c2c66affSColin Finck     CComPtr<IObjectWithSite>                objectWithSite;
1834c2c66affSColin Finck     CComPtr<IContextMenu>                   contextMenu;
1835c2c66affSColin Finck     CMINVOKECOMMANDINFO                     commandInfo;
1836c2c66affSColin Finck     const char                              *searchGUID = "{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
1837c2c66affSColin Finck     HRESULT                                 hResult;
1838c2c66affSColin Finck 
1839c2c66affSColin Finck     // TODO: Query shell if this command is enabled first
1840c2c66affSColin Finck 
1841c2c66affSColin Finck     memset(&commandInfo, 0, sizeof(commandInfo));
1842c2c66affSColin Finck     commandInfo.cbSize = sizeof(commandInfo);
1843c2c66affSColin Finck     commandInfo.hwnd = m_hWnd;
1844c2c66affSColin Finck     commandInfo.lpParameters = searchGUID;
1845c2c66affSColin Finck     commandInfo.nShow = SW_SHOWNORMAL;
1846c2c66affSColin Finck 
1847c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
1848c2c66affSColin Finck         IID_PPV_ARG(IContextMenu, &contextMenu));
1849c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1850c2c66affSColin Finck         return 0;
1851c2c66affSColin Finck     hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1852c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1853c2c66affSColin Finck         return 0;
1854c2c66affSColin Finck     hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
1855c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1856c2c66affSColin Finck         return 0;
1857c2c66affSColin Finck     hResult = contextMenu->InvokeCommand(&commandInfo);
1858c2c66affSColin Finck     hResult = objectWithSite->SetSite(NULL);
1859c2c66affSColin Finck     return hResult;
1860c2c66affSColin Finck }
1861c2c66affSColin Finck 
1862c2c66affSColin Finck bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
1863c2c66affSColin Finck {
1864c2c66affSColin Finck     CComPtr<IUnknown>                       int1Retry;
1865c2c66affSColin Finck     CComPtr<IUnknown>                       int2Retry;
1866c2c66affSColin Finck     HRESULT                                 hResult;
1867c2c66affSColin Finck 
1868c2c66affSColin Finck     if (int1 == int2)
1869c2c66affSColin Finck         return true;
1870c2c66affSColin Finck     if (int1 == NULL || int2 == NULL)
1871c2c66affSColin Finck         return false;
1872c2c66affSColin Finck     hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1873c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1874c2c66affSColin Finck         return false;
1875c2c66affSColin Finck     hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1876c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1877c2c66affSColin Finck         return false;
1878c2c66affSColin Finck     if (int1Retry == int2Retry)
1879c2c66affSColin Finck         return true;
1880c2c66affSColin Finck     return false;
1881c2c66affSColin Finck }
1882c2c66affSColin Finck 
1883c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
1884c2c66affSColin Finck {
1885bfadb22dSCarl J. Bialorucki     static const INT excludeItems[] = { 1, 1, 1, IDC_STATUSBAR, 0, 0 };
1886c2c66affSColin Finck 
1887c2c66affSColin Finck     RECT availableBounds;
1888c2c66affSColin Finck 
1889c2c66affSColin Finck     GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1890c2c66affSColin Finck     for (INT x = 0; x < 3; x++)
1891c2c66affSColin Finck     {
1892c2c66affSColin Finck         if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1893c2c66affSColin Finck         {
1894c2c66affSColin Finck             availableBounds.top += fClientBars[x].borderSpace.top;
1895c2c66affSColin Finck             availableBounds.left += fClientBars[x].borderSpace.left;
1896c2c66affSColin Finck             availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1897c2c66affSColin Finck             availableBounds.right -= fClientBars[x].borderSpace.right;
1898c2c66affSColin Finck         }
1899c2c66affSColin Finck     }
1900c2c66affSColin Finck     *prcBorder = availableBounds;
1901c2c66affSColin Finck     return S_OK;
1902c2c66affSColin Finck }
1903c2c66affSColin Finck 
1904c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1905c2c66affSColin Finck {
1906c2c66affSColin Finck     return S_OK;
1907c2c66affSColin Finck }
1908c2c66affSColin Finck 
1909c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1910c2c66affSColin Finck {
1911c2c66affSColin Finck     for (INT x = 0; x < 3; x++)
1912c2c66affSColin Finck     {
1913c2c66affSColin Finck         if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1914c2c66affSColin Finck         {
1915c2c66affSColin Finck             fClientBars[x].borderSpace = *pbw;
1916c2c66affSColin Finck             // if this bar changed size, it cascades and forces all subsequent bars to resize
1917c2c66affSColin Finck             RepositionBars();
1918c2c66affSColin Finck             return S_OK;
1919c2c66affSColin Finck         }
1920c2c66affSColin Finck     }
1921c2c66affSColin Finck     return E_INVALIDARG;
1922c2c66affSColin Finck }
1923c2c66affSColin Finck 
1924c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
1925c2c66affSColin Finck     ULONG cCmds, OLECMD prgCmds[  ], OLECMDTEXT *pCmdText)
1926c2c66affSColin Finck {
1927c2c66affSColin Finck     CComPtr<IOleCommandTarget>              commandTarget;
1928c2c66affSColin Finck     HRESULT                                 hResult;
1929c2c66affSColin Finck 
1930c2c66affSColin Finck     if (prgCmds == NULL)
1931c2c66affSColin Finck         return E_INVALIDARG;
1932c2c66affSColin Finck     if (pguidCmdGroup == NULL)
1933c2c66affSColin Finck     {
1934c2c66affSColin Finck         if (fCurrentShellView.p != NULL)
1935c2c66affSColin Finck         {
1936c2c66affSColin Finck             hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
1937c2c66affSColin Finck             if (SUCCEEDED(hResult) && commandTarget.p != NULL)
1938c2c66affSColin Finck                 return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
1939c2c66affSColin Finck         }
1940c2c66affSColin Finck         while (cCmds != 0)
1941c2c66affSColin Finck         {
1942c2c66affSColin Finck             prgCmds->cmdf = 0;
1943c2c66affSColin Finck             prgCmds++;
1944c2c66affSColin Finck             cCmds--;
1945c2c66affSColin Finck         }
1946c2c66affSColin Finck     }
1947c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1948c2c66affSColin Finck     {
1949c2c66affSColin Finck         while (cCmds != 0)
1950c2c66affSColin Finck         {
1951c2c66affSColin Finck             switch (prgCmds->cmdID)
1952c2c66affSColin Finck             {
1953c2c66affSColin Finck                 case 0x1c:  // search
1954c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1955a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
1956a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
1957a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
1958a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
1959a0c5cafcSGiannis Adamopoulos                     {
1960a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
1961a0c5cafcSGiannis Adamopoulos                     }
1962c2c66affSColin Finck                     break;
1963c2c66affSColin Finck                 case 0x1d:  // history
1964c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1965a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
1966a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
1967c2c66affSColin Finck                     break;
1968c2c66affSColin Finck                 case 0x1e:  // favorites
1969c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1970a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
1971a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
1972c2c66affSColin Finck                     break;
1973c2c66affSColin Finck                 case 0x23:  // folders
1974a0c5cafcSGiannis Adamopoulos                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1975a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
1976a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
1977c2c66affSColin Finck                     break;
1978c2c66affSColin Finck                 default:
1979c2c66affSColin Finck                     prgCmds->cmdf = 0;
1980c2c66affSColin Finck                     break;
1981c2c66affSColin Finck             }
1982c2c66affSColin Finck             prgCmds++;
1983c2c66affSColin Finck             cCmds--;
1984c2c66affSColin Finck         }
1985c2c66affSColin Finck     }
1986c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1987c2c66affSColin Finck     {
1988c2c66affSColin Finck         while (cCmds != 0)
1989c2c66affSColin Finck         {
1990c2c66affSColin Finck             switch (prgCmds->cmdID)
1991c2c66affSColin Finck             {
1992bfadb22dSCarl J. Bialorucki                 case IDM_GOTO_UPONELEVEL:
1993c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED;
1994c2c66affSColin Finck                     if (fCurrentDirectoryPIDL->mkid.cb != 0)
1995c2c66affSColin Finck                         prgCmds->cmdf |= OLECMDF_ENABLED;
1996c2c66affSColin Finck                     break;
1997c2c66affSColin Finck             }
1998c2c66affSColin Finck             prgCmds++;
1999c2c66affSColin Finck             cCmds--;
2000c2c66affSColin Finck         }
2001c2c66affSColin Finck     }
2002c2c66affSColin Finck     return S_OK;
2003c2c66affSColin Finck }
2004c2c66affSColin Finck 
2005c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
2006c2c66affSColin Finck     DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2007c2c66affSColin Finck {
2008c2c66affSColin Finck     HRESULT                                 hResult;
2009c2c66affSColin Finck 
2010c2c66affSColin Finck     if (!pguidCmdGroup)
2011c2c66affSColin Finck     {
2012c2c66affSColin Finck         TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
2013c2c66affSColin Finck         return E_NOTIMPL;
2014c2c66affSColin Finck     }
2015c2c66affSColin Finck     if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2016c2c66affSColin Finck     {
2017c2c66affSColin Finck         switch (nCmdID)
2018c2c66affSColin Finck         {
2019a0c5cafcSGiannis Adamopoulos             case 0x1c: //Toggle Search
2020a0c5cafcSGiannis Adamopoulos             case 0x1d: //Toggle History
2021a0c5cafcSGiannis Adamopoulos             case 0x1e: //Toggle Favorites
2022a0c5cafcSGiannis Adamopoulos             case 0x23: //Toggle Folders
2023a0c5cafcSGiannis Adamopoulos                 const GUID* pclsid;
20244212f4b1SBrock Mammen                 if (nCmdID == 0x1c) pclsid = &CLSID_FileSearchBand;
20254212f4b1SBrock Mammen                 else if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
2026a0c5cafcSGiannis Adamopoulos                 else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
2027a0c5cafcSGiannis Adamopoulos                 else pclsid = &CLSID_ExplorerBand;
2028a0c5cafcSGiannis Adamopoulos 
2029a0c5cafcSGiannis Adamopoulos                 if (IsEqualCLSID(*pclsid, fCurrentVertBar))
2030a0c5cafcSGiannis Adamopoulos                 {
2031a0c5cafcSGiannis Adamopoulos                     hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2032a0c5cafcSGiannis Adamopoulos                     memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2033a0c5cafcSGiannis Adamopoulos                     FireCommandStateChangeAll();
2034a0c5cafcSGiannis Adamopoulos                 }
2035a0c5cafcSGiannis Adamopoulos                 else
2036a0c5cafcSGiannis Adamopoulos                 {
2037a0c5cafcSGiannis Adamopoulos                     hResult = ShowBand(*pclsid, true);
2038a0c5cafcSGiannis Adamopoulos                 }
2039a0c5cafcSGiannis Adamopoulos                 return S_OK;
2040a0c5cafcSGiannis Adamopoulos             case 0x22:
2041a0c5cafcSGiannis Adamopoulos                 //Sent when a band closes
2042a0c5cafcSGiannis Adamopoulos                 if (V_VT(pvaIn) != VT_UNKNOWN)
2043a0c5cafcSGiannis Adamopoulos                     return E_INVALIDARG;
2044a0c5cafcSGiannis Adamopoulos 
2045a0c5cafcSGiannis Adamopoulos                 if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
2046a0c5cafcSGiannis Adamopoulos                 {
2047a0c5cafcSGiannis Adamopoulos                     memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2048a0c5cafcSGiannis Adamopoulos                     FireCommandStateChangeAll();
2049a0c5cafcSGiannis Adamopoulos                 }
2050c2c66affSColin Finck                 return S_OK;
2051c2c66affSColin Finck             case 0x27:
2052c2c66affSColin Finck                 if (nCmdexecopt == 1)
2053c2c66affSColin Finck                 {
2054c2c66affSColin Finck                     // pvaIn is a VT_UNKNOWN with a band that is being hidden
2055c2c66affSColin Finck                 }
2056c2c66affSColin Finck                 else
2057c2c66affSColin Finck                 {
2058c2c66affSColin Finck                     // update zones part of the status bar
2059c2c66affSColin Finck                 }
2060c2c66affSColin Finck                 return S_OK;
2061c2c66affSColin Finck             case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
2062c2c66affSColin Finck                 V_VT(pvaOut) = VT_INT_PTR;
2063c2c66affSColin Finck                 V_INTREF(pvaOut) = reinterpret_cast<INT *>(
2064c2c66affSColin Finck                     LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
2065c2c66affSColin Finck                 return S_OK;
2066c2c66affSColin Finck             case 0x38:
2067c2c66affSColin Finck                 // indicate if this cabinet was opened as a browser
2068c2c66affSColin Finck                 return S_FALSE;
2069c2c66affSColin Finck             default:
2070c2c66affSColin Finck                 return E_NOTIMPL;
2071c2c66affSColin Finck         }
2072c2c66affSColin Finck     }
2073c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
2074c2c66affSColin Finck     {
2075c2c66affSColin Finck         switch (nCmdID)
2076c2c66affSColin Finck         {
2077c2c66affSColin Finck             case 0x23:
2078c2c66affSColin Finck                 // placeholder
2079c2c66affSColin Finck                 return S_OK;
2080c2c66affSColin Finck         }
2081c2c66affSColin Finck     }
2082c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
2083c2c66affSColin Finck     {
2084c2c66affSColin Finck         switch (nCmdID)
2085c2c66affSColin Finck         {
2086c2c66affSColin Finck             case 6:
2087c2c66affSColin Finck                 // what is theater mode and why do we receive this?
2088c2c66affSColin Finck                 return E_NOTIMPL;
2089c2c66affSColin Finck         }
2090c2c66affSColin Finck     }
2091c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
2092c2c66affSColin Finck     {
2093c2c66affSColin Finck         switch (nCmdID)
2094c2c66affSColin Finck         {
2095c2c66affSColin Finck             case 14:
2096c2c66affSColin Finck                 // initialize favorites menu
2097c2c66affSColin Finck                 return S_OK;
2098c2c66affSColin Finck         }
2099c2c66affSColin Finck     }
2100c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
2101c2c66affSColin Finck     {
2102c2c66affSColin Finck         switch (nCmdID)
2103c2c66affSColin Finck         {
2104c2c66affSColin Finck             case 0x12:
2105c2c66affSColin Finck                 // refresh on toolbar clicked
2106c2c66affSColin Finck                 return S_OK;
2107c2c66affSColin Finck             case 0x26:
2108c2c66affSColin Finck                 // called for unknown bands ?
2109c2c66affSColin Finck                 return S_OK;
2110c2c66affSColin Finck             case 0x4d:
2111c2c66affSColin Finck                 // tell the view if it should hide the task pane or not
2112c2c66affSColin Finck                 return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
2113c2c66affSColin Finck         }
2114c2c66affSColin Finck     }
2115c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2116c2c66affSColin Finck     {
2117c2c66affSColin Finck         switch (nCmdID)
2118c2c66affSColin Finck         {
2119c2c66affSColin Finck             case 40994:
2120c2c66affSColin Finck                 return NavigateToParent();
2121c2c66affSColin Finck         }
2122c2c66affSColin Finck     }
2123c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
2124c2c66affSColin Finck     {
2125c2c66affSColin Finck         switch (nCmdID)
2126c2c66affSColin Finck         {
2127c2c66affSColin Finck             case 0x7063:
2128c2c66affSColin Finck                 return DoFolderOptions();
2129c2c66affSColin Finck         }
2130c2c66affSColin Finck     }
2131c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
2132c2c66affSColin Finck     {
2133c2c66affSColin Finck         switch (nCmdID)
2134c2c66affSColin Finck         {
2135c2c66affSColin Finck             case 1:
2136c2c66affSColin Finck                 // Reset All Folders option in Folder Options
2137c2c66affSColin Finck                 break;
2138c2c66affSColin Finck         }
2139c2c66affSColin Finck     }
2140c2c66affSColin Finck     else
2141c2c66affSColin Finck     {
2142c2c66affSColin Finck         return E_NOTIMPL;
2143c2c66affSColin Finck     }
2144c2c66affSColin Finck     return E_NOTIMPL;
2145c2c66affSColin Finck }
2146c2c66affSColin Finck 
2147c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindow(HWND *lphwnd)
2148c2c66affSColin Finck {
2149c2c66affSColin Finck     if (lphwnd == NULL)
2150c2c66affSColin Finck         return E_POINTER;
2151c2c66affSColin Finck     *lphwnd = m_hWnd;
2152c2c66affSColin Finck     return S_OK;
2153c2c66affSColin Finck }
2154c2c66affSColin Finck 
2155c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ContextSensitiveHelp(BOOL fEnterMode)
2156c2c66affSColin Finck {
2157c2c66affSColin Finck     return E_NOTIMPL;
2158c2c66affSColin Finck }
2159c2c66affSColin Finck 
2160c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
2161c2c66affSColin Finck {
2162c2c66affSColin Finck     HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2163c2c66affSColin Finck 
2164c2c66affSColin Finck     Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
2165c2c66affSColin Finck 
2166c2c66affSColin Finck     int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
2167c2c66affSColin Finck     Unused(itemCount3);
2168c2c66affSColin Finck 
2169c2c66affSColin Finck     DestroyMenu(mainMenu);
2170c2c66affSColin Finck 
2171c2c66affSColin Finck     lpMenuWidths->width[0] = 2;
2172c2c66affSColin Finck     lpMenuWidths->width[2] = 3;
2173c2c66affSColin Finck     lpMenuWidths->width[4] = 1;
2174c2c66affSColin Finck     return S_OK;
2175c2c66affSColin Finck }
2176c2c66affSColin Finck 
2177c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
2178c2c66affSColin Finck {
2179c2c66affSColin Finck     CComPtr<IShellMenu>                     shellMenu;
2180c2c66affSColin Finck     HRESULT                                 hResult;
2181c2c66affSColin Finck 
2182c2c66affSColin Finck     if (hmenuShared && IsMenu(hmenuShared) == FALSE)
2183c2c66affSColin Finck         return E_FAIL;
2184c2c66affSColin Finck     hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
2185c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2186c2c66affSColin Finck         return hResult;
2187c2c66affSColin Finck 
2188c2c66affSColin Finck     if (!hmenuShared)
2189c2c66affSColin Finck     {
2190c2c66affSColin Finck         hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2191c2c66affSColin Finck     }
2192c2c66affSColin Finck     // FIXME: Figure out the proper way to do this.
2193c2c66affSColin Finck     HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
2194c2c66affSColin Finck     if (hMenuFavs)
2195c2c66affSColin Finck     {
2196c2c66affSColin Finck         DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
2197c2c66affSColin Finck     }
2198c2c66affSColin Finck 
2199c2c66affSColin Finck     hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
2200c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2201c2c66affSColin Finck         return hResult;
2202c2c66affSColin Finck     fCurrentMenuBar = hmenuShared;
2203c2c66affSColin Finck     BuildExplorerBandMenu();
2204c2c66affSColin Finck     return S_OK;
2205c2c66affSColin Finck }
2206c2c66affSColin Finck 
2207c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
2208c2c66affSColin Finck {
2209c2c66affSColin Finck     if (hmenuShared == fCurrentMenuBar)
2210c2c66affSColin Finck     {
2211c2c66affSColin Finck         //DestroyMenu(fCurrentMenuBar);
2212c2c66affSColin Finck         SetMenuSB(NULL, NULL, NULL);
2213c2c66affSColin Finck     }
2214c2c66affSColin Finck     return S_OK;
2215c2c66affSColin Finck }
2216c2c66affSColin Finck 
2217c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
2218c2c66affSColin Finck {
2219c2c66affSColin Finck     //
2220c2c66affSColin Finck     if (pszStatusText)
2221c2c66affSColin Finck     {
2222c2c66affSColin Finck         ::SetWindowText(fStatusBar, pszStatusText);
2223c2c66affSColin Finck     }
2224c2c66affSColin Finck     else
2225c2c66affSColin Finck     {
2226c2c66affSColin Finck 
2227c2c66affSColin Finck     }
2228c2c66affSColin Finck     return S_OK;
2229c2c66affSColin Finck }
2230c2c66affSColin Finck 
2231c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
2232c2c66affSColin Finck {
2233c2c66affSColin Finck     return E_NOTIMPL;
2234c2c66affSColin Finck }
2235c2c66affSColin Finck 
2236c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::TranslateAcceleratorSB(MSG *pmsg, WORD wID)
2237c2c66affSColin Finck {
2238c2c66affSColin Finck     if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
2239c2c66affSColin Finck         return S_FALSE;
2240c2c66affSColin Finck     return S_OK;
2241c2c66affSColin Finck }
2242c2c66affSColin Finck 
2243c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
2244c2c66affSColin Finck {
2245c2c66affSColin Finck     if ((wFlags & SBSP_EXPLOREMODE) != NULL)
2246c2c66affSColin Finck         ShowBand(CLSID_ExplorerBand, true);
2247c2c66affSColin Finck 
224862c33fbfSGiannis Adamopoulos     long flags = BTP_UPDATE_NEXT_HISTORY;
224962c33fbfSGiannis Adamopoulos     if (fTravelLog)
225062c33fbfSGiannis Adamopoulos         flags |= BTP_UPDATE_CUR_HISTORY;
225162c33fbfSGiannis Adamopoulos     return BrowseToPIDL(pidl, flags);
2252c2c66affSColin Finck }
2253c2c66affSColin Finck 
2254c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
2255c2c66affSColin Finck {
2256c2c66affSColin Finck     return E_NOTIMPL;
2257c2c66affSColin Finck }
2258c2c66affSColin Finck 
2259c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetControlWindow(UINT id, HWND *lphwnd)
2260c2c66affSColin Finck {
2261c2c66affSColin Finck     if (lphwnd == NULL)
2262c2c66affSColin Finck         return E_POINTER;
2263c2c66affSColin Finck     *lphwnd = NULL;
2264c2c66affSColin Finck     switch (id)
2265c2c66affSColin Finck     {
2266c2c66affSColin Finck         case FCW_TOOLBAR:
2267c2c66affSColin Finck             *lphwnd = fToolbarProxy.m_hWnd;
2268c2c66affSColin Finck             return S_OK;
2269c2c66affSColin Finck         case FCW_STATUS:
2270c2c66affSColin Finck             *lphwnd = fStatusBar;
2271c2c66affSColin Finck             return S_OK;
2272c2c66affSColin Finck         case FCW_TREE:
2273c2c66affSColin Finck             // find the directory browser and return it
2274c2c66affSColin Finck             // this should be used only to determine if a tree is present
2275c2c66affSColin Finck             return S_OK;
2276c2c66affSColin Finck         case FCW_PROGRESS:
2277c2c66affSColin Finck             // is this a progress dialog?
2278c2c66affSColin Finck             return S_OK;
2279c2c66affSColin Finck     }
2280c2c66affSColin Finck     return S_OK;
2281c2c66affSColin Finck }
2282c2c66affSColin Finck 
2283c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SendControlMsg(
2284c2c66affSColin Finck     UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
2285c2c66affSColin Finck {
2286c2c66affSColin Finck     LPARAM                                  result;
2287c2c66affSColin Finck 
2288c2c66affSColin Finck     if (pret != NULL)
2289c2c66affSColin Finck         *pret = 0;
2290c2c66affSColin Finck     switch (id)
2291c2c66affSColin Finck     {
2292c2c66affSColin Finck         case FCW_TOOLBAR:
2293c2c66affSColin Finck             result = fToolbarProxy.SendMessage(uMsg, wParam, lParam);
2294c2c66affSColin Finck             if (pret != NULL)
2295c2c66affSColin Finck                 *pret = result;
2296c2c66affSColin Finck             break;
2297c2c66affSColin Finck         case FCW_STATUS:
2298c2c66affSColin Finck             result = SendMessage(fStatusBar, uMsg, wParam, lParam);
2299c2c66affSColin Finck             if (pret != NULL)
2300c2c66affSColin Finck                 *pret = result;
2301c2c66affSColin Finck             break;
2302c2c66affSColin Finck     }
2303c2c66affSColin Finck     return S_OK;
2304c2c66affSColin Finck }
2305c2c66affSColin Finck 
2306c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryActiveShellView(IShellView **ppshv)
2307c2c66affSColin Finck {
2308c2c66affSColin Finck     if (ppshv == NULL)
2309c2c66affSColin Finck         return E_POINTER;
2310c2c66affSColin Finck     *ppshv = fCurrentShellView;
2311c2c66affSColin Finck     if (fCurrentShellView.p != NULL)
2312c2c66affSColin Finck         fCurrentShellView.p->AddRef();
2313c2c66affSColin Finck     return S_OK;
2314c2c66affSColin Finck }
2315c2c66affSColin Finck 
2316c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnViewWindowActive(IShellView *ppshv)
2317c2c66affSColin Finck {
2318c2c66affSColin Finck     return E_NOTIMPL;
2319c2c66affSColin Finck }
2320c2c66affSColin Finck 
2321c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
2322c2c66affSColin Finck {
2323c2c66affSColin Finck     return E_NOTIMPL;
2324c2c66affSColin Finck }
2325c2c66affSColin Finck 
2326c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragEnter(
2327c2c66affSColin Finck     IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2328c2c66affSColin Finck {
2329c2c66affSColin Finck     return E_NOTIMPL;
2330c2c66affSColin Finck }
2331c2c66affSColin Finck 
2332c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2333c2c66affSColin Finck {
2334c2c66affSColin Finck     return E_NOTIMPL;
2335c2c66affSColin Finck }
2336c2c66affSColin Finck 
2337c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragLeave()
2338c2c66affSColin Finck {
2339c2c66affSColin Finck     return E_NOTIMPL;
2340c2c66affSColin Finck }
2341c2c66affSColin Finck 
2342c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Drop(
2343c2c66affSColin Finck     IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2344c2c66affSColin Finck {
2345c2c66affSColin Finck     return E_NOTIMPL;
2346c2c66affSColin Finck }
2347c2c66affSColin Finck 
2348c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
2349c2c66affSColin Finck {
2350c2c66affSColin Finck     // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2351c2c66affSColin Finck     // the returned interface has a method GetPropertyBag on it
2352c2c66affSColin Finck     if (IsEqualIID(guidService, SID_STopLevelBrowser))
2353c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2354c2c66affSColin Finck     if (IsEqualIID(guidService, SID_SShellBrowser))
2355c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2356c2c66affSColin Finck     if (IsEqualIID(guidService, SID_ITargetFrame2))
2357c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2358c2c66affSColin Finck     if (IsEqualIID(guidService, SID_IWebBrowserApp))        // without this, the internet toolbar won't reflect notifications
2359c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2360c2c66affSColin Finck     if (IsEqualIID(guidService, SID_SProxyBrowser))
2361c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2362c2c66affSColin Finck     if (IsEqualIID(guidService, SID_IExplorerToolbar))
2363c2c66affSColin Finck         return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2364c2c66affSColin Finck     if (IsEqualIID(riid, IID_IShellBrowser))
2365c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2366c2c66affSColin Finck     return E_NOINTERFACE;
2367c2c66affSColin Finck }
2368c2c66affSColin Finck 
23694814dfeaSKatayama Hirofumi MZ static BOOL _ILIsNetworkPlace(LPCITEMIDLIST pidl)
23704814dfeaSKatayama Hirofumi MZ {
23714814dfeaSKatayama Hirofumi MZ     WCHAR szPath[MAX_PATH];
23724814dfeaSKatayama Hirofumi MZ     return SHGetPathFromIDListWrapW(pidl, szPath) && PathIsUNCW(szPath);
23734814dfeaSKatayama Hirofumi MZ }
23744814dfeaSKatayama Hirofumi MZ 
2375c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPropertyBag(long flags, REFIID riid, void **ppvObject)
2376c2c66affSColin Finck {
2377c2c66affSColin Finck     if (ppvObject == NULL)
2378c2c66affSColin Finck         return E_POINTER;
23794814dfeaSKatayama Hirofumi MZ 
2380c2c66affSColin Finck     *ppvObject = NULL;
23814814dfeaSKatayama Hirofumi MZ 
23824814dfeaSKatayama Hirofumi MZ     LPITEMIDLIST pidl;
23834814dfeaSKatayama Hirofumi MZ     HRESULT hr = GetPidl(&pidl);
23844814dfeaSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
23854814dfeaSKatayama Hirofumi MZ         return E_FAIL;
23864814dfeaSKatayama Hirofumi MZ 
23874814dfeaSKatayama Hirofumi MZ     // FIXME: pidl for Internet etc.
23884814dfeaSKatayama Hirofumi MZ 
23894814dfeaSKatayama Hirofumi MZ     if (_ILIsNetworkPlace(pidl))
23904814dfeaSKatayama Hirofumi MZ         flags |= SHGVSPB_ROAM;
23914814dfeaSKatayama Hirofumi MZ 
23924814dfeaSKatayama Hirofumi MZ     hr = SHGetViewStatePropertyBag(pidl, L"Shell", flags, riid, ppvObject);
23934814dfeaSKatayama Hirofumi MZ 
23944814dfeaSKatayama Hirofumi MZ     ILFree(pidl);
23954814dfeaSKatayama Hirofumi MZ     return hr;
2396c2c66affSColin Finck }
2397c2c66affSColin Finck 
2398c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfoCount(UINT *pctinfo)
2399c2c66affSColin Finck {
2400c2c66affSColin Finck     return E_NOTIMPL;
2401c2c66affSColin Finck }
2402c2c66affSColin Finck 
2403c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
2404c2c66affSColin Finck {
2405c2c66affSColin Finck     return E_NOTIMPL;
2406c2c66affSColin Finck }
2407c2c66affSColin Finck 
2408c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
2409c2c66affSColin Finck     UINT cNames, LCID lcid, DISPID *rgDispId)
2410c2c66affSColin Finck {
2411c2c66affSColin Finck     return E_NOTIMPL;
2412c2c66affSColin Finck }
2413c2c66affSColin Finck 
2414c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
2415c2c66affSColin Finck     WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2416c2c66affSColin Finck {
2417c2c66affSColin Finck     return E_NOTIMPL;
2418c2c66affSColin Finck }
2419c2c66affSColin Finck 
2420c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetParentSite(IOleInPlaceSite **ppipsite)
2421c2c66affSColin Finck {
2422c2c66affSColin Finck     return E_NOTIMPL;
2423c2c66affSColin Finck }
2424c2c66affSColin Finck 
2425c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetTitle(IShellView *psv, LPCWSTR pszName)
2426c2c66affSColin Finck {
2427c2c66affSColin Finck     return E_NOTIMPL;
2428c2c66affSColin Finck }
2429c2c66affSColin Finck 
2430c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName)
2431c2c66affSColin Finck {
2432c2c66affSColin Finck     return E_NOTIMPL;
2433c2c66affSColin Finck }
2434c2c66affSColin Finck 
2435c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetOleObject(IOleObject **ppobjv)
2436c2c66affSColin Finck {
2437c2c66affSColin Finck     return E_NOTIMPL;
2438c2c66affSColin Finck }
2439c2c66affSColin Finck 
2440c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
2441c2c66affSColin Finck {
2442c2c66affSColin Finck     HRESULT                                 hResult;
2443c2c66affSColin Finck 
2444c2c66affSColin Finck     // called by toolbar when displaying tooltips
2445c2c66affSColin Finck     if (pptl == NULL)
2446c2c66affSColin Finck         return E_FAIL;
2447c2c66affSColin Finck 
2448c2c66affSColin Finck     *pptl = NULL;
2449c2c66affSColin Finck     if (fTravelLog.p == NULL)
2450c2c66affSColin Finck     {
2451c2c66affSColin Finck         hResult = CTravelLog_CreateInstance(IID_PPV_ARG(ITravelLog, &fTravelLog));
2452c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
2453c2c66affSColin Finck             return hResult;
2454c2c66affSColin Finck     }
2455c2c66affSColin Finck     *pptl = fTravelLog.p;
2456c2c66affSColin Finck     fTravelLog.p->AddRef();
2457c2c66affSColin Finck     return S_OK;
2458c2c66affSColin Finck }
2459c2c66affSColin Finck 
2460c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ShowControlWindow(UINT id, BOOL fShow)
2461c2c66affSColin Finck {
2462c2c66affSColin Finck     return E_NOTIMPL;
2463c2c66affSColin Finck }
2464c2c66affSColin Finck 
2465c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IsControlWindowShown(UINT id, BOOL *pfShown)
2466c2c66affSColin Finck {
2467c2c66affSColin Finck     return E_NOTIMPL;
2468c2c66affSColin Finck }
2469c2c66affSColin Finck 
2470c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
2471c2c66affSColin Finck {
2472c2c66affSColin Finck     return E_NOTIMPL;
2473c2c66affSColin Finck }
2474c2c66affSColin Finck 
2475c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut)
2476c2c66affSColin Finck {
2477c2c66affSColin Finck     return E_NOTIMPL;
2478c2c66affSColin Finck }
2479c2c66affSColin Finck 
2480c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DisplayParseError(HRESULT hres, LPCWSTR pwszPath)
2481c2c66affSColin Finck {
2482c2c66affSColin Finck     return E_NOTIMPL;
2483c2c66affSColin Finck }
2484c2c66affSColin Finck 
2485c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF)
2486c2c66affSColin Finck {
2487c2c66affSColin Finck     return E_NOTIMPL;
2488c2c66affSColin Finck }
2489c2c66affSColin Finck 
2490c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetNavigateState(BNSTATE bnstate)
2491c2c66affSColin Finck {
2492c2c66affSColin Finck     return E_NOTIMPL;
2493c2c66affSColin Finck }
2494c2c66affSColin Finck 
2495c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetNavigateState(BNSTATE *pbnstate)
2496c2c66affSColin Finck {
2497c2c66affSColin Finck     return E_NOTIMPL;
2498c2c66affSColin Finck }
2499c2c66affSColin Finck 
2500c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse)
2501c2c66affSColin Finck {
2502c2c66affSColin Finck     return E_NOTIMPL;
2503c2c66affSColin Finck }
2504c2c66affSColin Finck 
2505c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateWindowList()
2506c2c66affSColin Finck {
2507c2c66affSColin Finck     return E_NOTIMPL;
2508c2c66affSColin Finck }
2509c2c66affSColin Finck 
2510c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateBackForwardState()
2511c2c66affSColin Finck {
2512c2c66affSColin Finck     return E_NOTIMPL;
2513c2c66affSColin Finck }
2514c2c66affSColin Finck 
2515c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetFlags(DWORD dwFlags, DWORD dwFlagMask)
2516c2c66affSColin Finck {
2517c2c66affSColin Finck     return E_NOTIMPL;
2518c2c66affSColin Finck }
2519c2c66affSColin Finck 
2520c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetFlags(DWORD *pdwFlags)
2521c2c66affSColin Finck {
2522c2c66affSColin Finck     return E_NOTIMPL;
2523c2c66affSColin Finck }
2524c2c66affSColin Finck 
2525c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CanNavigateNow()
2526c2c66affSColin Finck {
2527c2c66affSColin Finck     return E_NOTIMPL;
2528c2c66affSColin Finck }
2529c2c66affSColin Finck 
2530c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPidl(LPITEMIDLIST *ppidl)
2531c2c66affSColin Finck {
2532c2c66affSColin Finck     // called by explorer bar to get current pidl
2533c2c66affSColin Finck     if (ppidl == NULL)
2534c2c66affSColin Finck         return E_POINTER;
2535c2c66affSColin Finck     *ppidl = ILClone(fCurrentDirectoryPIDL);
2536c2c66affSColin Finck     return S_OK;
2537c2c66affSColin Finck }
2538c2c66affSColin Finck 
2539c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetReferrer(LPCITEMIDLIST pidl)
2540c2c66affSColin Finck {
2541c2c66affSColin Finck     return E_NOTIMPL;
2542c2c66affSColin Finck }
2543c2c66affSColin Finck 
2544c2c66affSColin Finck DWORD STDMETHODCALLTYPE CShellBrowser::GetBrowserIndex()
2545c2c66affSColin Finck {
2546c2c66affSColin Finck     return -1;
2547c2c66affSColin Finck }
2548c2c66affSColin Finck 
2549c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
2550c2c66affSColin Finck {
2551c2c66affSColin Finck     return E_NOTIMPL;
2552c2c66affSColin Finck }
2553c2c66affSColin Finck 
2554c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc)
2555c2c66affSColin Finck {
2556c2c66affSColin Finck     if (ppole == NULL || pstm == NULL || ppbc == NULL)
2557c2c66affSColin Finck         return E_INVALIDARG;
2558c2c66affSColin Finck     *ppole = fHistoryObject;
2559c2c66affSColin Finck     if (fHistoryObject != NULL)
2560c2c66affSColin Finck         fHistoryObject->AddRef();
2561c2c66affSColin Finck     *pstm = fHistoryStream;
2562c2c66affSColin Finck     if (fHistoryStream != NULL)
2563c2c66affSColin Finck         fHistoryStream->AddRef();
2564c2c66affSColin Finck     *ppbc = fHistoryBindContext;
2565c2c66affSColin Finck     if (fHistoryBindContext != NULL)
2566c2c66affSColin Finck         fHistoryBindContext->AddRef();
2567c2c66affSColin Finck     fHistoryObject = NULL;
2568c2c66affSColin Finck     fHistoryStream = NULL;
2569c2c66affSColin Finck     fHistoryBindContext = NULL;
2570c2c66affSColin Finck     if (*ppole == NULL)
2571c2c66affSColin Finck         return E_FAIL;
2572c2c66affSColin Finck     return S_OK;
2573c2c66affSColin Finck }
2574c2c66affSColin Finck 
2575c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor)
2576c2c66affSColin Finck {
2577c2c66affSColin Finck     return E_NOTIMPL;
2578c2c66affSColin Finck }
2579c2c66affSColin Finck 
2580c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CacheOLEServer(IOleObject *pole)
2581c2c66affSColin Finck {
2582c2c66affSColin Finck     return E_NOTIMPL;
2583c2c66affSColin Finck }
2584c2c66affSColin Finck 
2585c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut)
2586c2c66affSColin Finck {
2587c2c66affSColin Finck     return E_NOTIMPL;
2588c2c66affSColin Finck }
2589c2c66affSColin Finck 
2590c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnHttpEquiv(
2591c2c66affSColin Finck     IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2592c2c66affSColin Finck {
2593c2c66affSColin Finck     return E_NOTIMPL;
2594c2c66affSColin Finck }
2595c2c66affSColin Finck 
2596c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPalette(HPALETTE *hpal)
2597c2c66affSColin Finck {
2598c2c66affSColin Finck     return E_NOTIMPL;
2599c2c66affSColin Finck }
2600c2c66affSColin Finck 
2601c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RegisterWindow(BOOL fForceRegister, int swc)
2602c2c66affSColin Finck {
2603c2c66affSColin Finck     return E_NOTIMPL;
2604c2c66affSColin Finck }
2605c2c66affSColin Finck 
2606c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2607c2c66affSColin Finck {
2608c2c66affSColin Finck     return E_NOTIMPL;
2609c2c66affSColin Finck }
2610c2c66affSColin Finck 
2611c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetAsDefFolderSettings()
2612c2c66affSColin Finck {
2613c2c66affSColin Finck     return E_NOTIMPL;
2614c2c66affSColin Finck }
2615c2c66affSColin Finck 
2616c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewRect(RECT *prc)
2617c2c66affSColin Finck {
2618c2c66affSColin Finck     return E_NOTIMPL;
2619c2c66affSColin Finck }
2620c2c66affSColin Finck 
2621c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnSize(WPARAM wParam)
2622c2c66affSColin Finck {
2623c2c66affSColin Finck     return E_NOTIMPL;
2624c2c66affSColin Finck }
2625c2c66affSColin Finck 
2626c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnCreate(struct tagCREATESTRUCTW *pcs)
2627c2c66affSColin Finck {
2628c2c66affSColin Finck     m_hAccel = LoadAcceleratorsW(GetModuleHandle(L"browseui.dll"), MAKEINTRESOURCEW(256));
2629c2c66affSColin Finck     return S_OK;
2630c2c66affSColin Finck }
2631c2c66affSColin Finck 
2632c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::OnCommand(WPARAM wParam, LPARAM lParam)
2633c2c66affSColin Finck {
2634c2c66affSColin Finck     return 0;
2635c2c66affSColin Finck }
2636c2c66affSColin Finck 
2637c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnDestroy()
2638c2c66affSColin Finck {
2639c2c66affSColin Finck     return E_NOTIMPL;
2640c2c66affSColin Finck }
2641c2c66affSColin Finck 
2642c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::OnNotify(struct tagNMHDR *pnm)
2643c2c66affSColin Finck {
2644c2c66affSColin Finck     return 0;
2645c2c66affSColin Finck }
2646c2c66affSColin Finck 
2647c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnSetFocus()
2648c2c66affSColin Finck {
2649c2c66affSColin Finck     return E_NOTIMPL;
2650c2c66affSColin Finck }
2651c2c66affSColin Finck 
2652c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnFrameWindowActivateBS(BOOL fActive)
2653c2c66affSColin Finck {
2654c2c66affSColin Finck     return E_NOTIMPL;
2655c2c66affSColin Finck }
2656c2c66affSColin Finck 
2657c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ReleaseShellView()
2658c2c66affSColin Finck {
2659c2c66affSColin Finck     return E_NOTIMPL;
2660c2c66affSColin Finck }
2661c2c66affSColin Finck 
2662c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ActivatePendingView()
2663c2c66affSColin Finck {
2664c2c66affSColin Finck     return E_NOTIMPL;
2665c2c66affSColin Finck }
2666c2c66affSColin Finck 
2667c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CreateViewWindow(
2668c2c66affSColin Finck     IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2669c2c66affSColin Finck {
2670c2c66affSColin Finck     return E_NOTIMPL;
2671c2c66affSColin Finck }
2672c2c66affSColin Finck 
2673c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CreateBrowserPropSheetExt(REFIID riid, void **ppv)
2674c2c66affSColin Finck {
2675c2c66affSColin Finck     return E_NOTIMPL;
2676c2c66affSColin Finck }
2677c2c66affSColin Finck 
2678c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewWindow(HWND *phwndView)
2679c2c66affSColin Finck {
2680c2c66affSColin Finck     return E_NOTIMPL;
2681c2c66affSColin Finck }
2682c2c66affSColin Finck 
2683c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd)
2684c2c66affSColin Finck {
2685c2c66affSColin Finck     return E_NOTIMPL;
2686c2c66affSColin Finck }
2687c2c66affSColin Finck 
2688c2c66affSColin Finck LPBASEBROWSERDATA STDMETHODCALLTYPE CShellBrowser::PutBaseBrowserData()
2689c2c66affSColin Finck {
2690c2c66affSColin Finck     return NULL;
2691c2c66affSColin Finck }
2692c2c66affSColin Finck 
2693c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTravelLog(ITravelLog *ptl, DWORD dw)
2694c2c66affSColin Finck {
2695c2c66affSColin Finck     return E_NOTIMPL;
2696c2c66affSColin Finck }
2697c2c66affSColin Finck 
2698c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetTopBrowser()
2699c2c66affSColin Finck {
2700c2c66affSColin Finck     return E_NOTIMPL;
2701c2c66affSColin Finck }
2702c2c66affSColin Finck 
2703c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Offline(int iCmd)
2704c2c66affSColin Finck {
2705c2c66affSColin Finck     return E_NOTIMPL;
2706c2c66affSColin Finck }
2707c2c66affSColin Finck 
2708c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::AllowViewResize(BOOL f)
2709c2c66affSColin Finck {
2710c2c66affSColin Finck     return E_NOTIMPL;
2711c2c66affSColin Finck }
2712c2c66affSColin Finck 
2713c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetActivateState(UINT u)
2714c2c66affSColin Finck {
2715c2c66affSColin Finck     return E_NOTIMPL;
2716c2c66affSColin Finck }
2717c2c66affSColin Finck 
2718c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateSecureLockIcon(int eSecureLock)
2719c2c66affSColin Finck {
2720c2c66affSColin Finck     return E_NOTIMPL;
2721c2c66affSColin Finck }
2722c2c66affSColin Finck 
2723c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeDownloadManager()
2724c2c66affSColin Finck {
2725c2c66affSColin Finck     return E_NOTIMPL;
2726c2c66affSColin Finck }
2727c2c66affSColin Finck 
2728c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTransitionSite()
2729c2c66affSColin Finck {
2730c2c66affSColin Finck     return E_NOTIMPL;
2731c2c66affSColin Finck }
2732c2c66affSColin Finck 
2733c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_Initialize(HWND hwnd, IUnknown *pauto)
2734c2c66affSColin Finck {
2735c2c66affSColin Finck     return E_NOTIMPL;
2736c2c66affSColin Finck }
2737c2c66affSColin Finck 
2738c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingNavigationAsync()
2739c2c66affSColin Finck {
2740c2c66affSColin Finck     return E_NOTIMPL;
2741c2c66affSColin Finck }
2742c2c66affSColin Finck 
2743c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingView()
2744c2c66affSColin Finck {
2745c2c66affSColin Finck     return E_NOTIMPL;
2746c2c66affSColin Finck }
2747c2c66affSColin Finck 
2748c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_MaySaveChanges()
2749c2c66affSColin Finck {
2750c2c66affSColin Finck     return E_NOTIMPL;
2751c2c66affSColin Finck }
2752c2c66affSColin Finck 
2753c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_PauseOrResumeView(BOOL fPaused)
2754c2c66affSColin Finck {
2755c2c66affSColin Finck     return E_NOTIMPL;
2756c2c66affSColin Finck }
2757c2c66affSColin Finck 
2758c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_DisableModeless()
2759c2c66affSColin Finck {
2760c2c66affSColin Finck     return E_NOTIMPL;
2761c2c66affSColin Finck }
2762c2c66affSColin Finck 
2763c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags)
2764c2c66affSColin Finck {
2765c2c66affSColin Finck     return E_NOTIMPL;
2766c2c66affSColin Finck }
2767c2c66affSColin Finck 
2768c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew)
2769c2c66affSColin Finck {
2770c2c66affSColin Finck     return E_NOTIMPL;
2771c2c66affSColin Finck }
2772c2c66affSColin Finck 
2773c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SwitchActivationNow()
2774c2c66affSColin Finck {
2775c2c66affSColin Finck     return E_NOTIMPL;
2776c2c66affSColin Finck }
2777c2c66affSColin Finck 
2778c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
2779c2c66affSColin Finck     const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2780c2c66affSColin Finck {
2781c2c66affSColin Finck     return E_NOTIMPL;
2782c2c66affSColin Finck }
2783c2c66affSColin Finck 
2784c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SendChildren(
2785c2c66affSColin Finck     HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2786c2c66affSColin Finck {
2787c2c66affSColin Finck     return E_NOTIMPL;
2788c2c66affSColin Finck }
2789c2c66affSColin Finck 
2790c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetFolderSetData(struct tagFolderSetData *pfsd)
2791c2c66affSColin Finck {
2792c2c66affSColin Finck     return E_NOTIMPL;
2793c2c66affSColin Finck }
2794c2c66affSColin Finck 
2795c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_OnFocusChange(UINT itb)
2796c2c66affSColin Finck {
2797c2c66affSColin Finck     return E_NOTIMPL;
2798c2c66affSColin Finck }
2799c2c66affSColin Finck 
2800c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_ShowHideChildWindows(BOOL fChildOnly)
2801c2c66affSColin Finck {
2802c2c66affSColin Finck     return E_NOTIMPL;
2803c2c66affSColin Finck }
2804c2c66affSColin Finck 
2805c2c66affSColin Finck UINT STDMETHODCALLTYPE CShellBrowser::_get_itbLastFocus()
2806c2c66affSColin Finck {
2807c2c66affSColin Finck     return 0;
2808c2c66affSColin Finck }
2809c2c66affSColin Finck 
2810c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_put_itbLastFocus(UINT itbLastFocus)
2811c2c66affSColin Finck {
2812c2c66affSColin Finck     return E_NOTIMPL;
2813c2c66affSColin Finck }
2814c2c66affSColin Finck 
2815c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_UIActivateView(UINT uState)
2816c2c66affSColin Finck {
2817c2c66affSColin Finck     return E_NOTIMPL;
2818c2c66affSColin Finck }
2819c2c66affSColin Finck 
2820c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetViewBorderRect(RECT *prc)
2821c2c66affSColin Finck {
2822c2c66affSColin Finck     return E_NOTIMPL;
2823c2c66affSColin Finck }
2824c2c66affSColin Finck 
2825c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_UpdateViewRectSize()
2826c2c66affSColin Finck {
2827c2c66affSColin Finck     return E_NOTIMPL;
2828c2c66affSColin Finck }
2829c2c66affSColin Finck 
2830c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorder(UINT itb)
2831c2c66affSColin Finck {
2832c2c66affSColin Finck     return E_NOTIMPL;
2833c2c66affSColin Finck }
2834c2c66affSColin Finck 
2835c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeView()
2836c2c66affSColin Finck {
2837c2c66affSColin Finck     return E_NOTIMPL;
2838c2c66affSColin Finck }
2839c2c66affSColin Finck 
2840c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon)
2841c2c66affSColin Finck {
2842c2c66affSColin Finck     return E_NOTIMPL;
2843c2c66affSColin Finck }
2844c2c66affSColin Finck 
2845c2c66affSColin Finck IStream *STDMETHODCALLTYPE CShellBrowser::v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName)
2846c2c66affSColin Finck {
2847c2c66affSColin Finck     return NULL;
2848c2c66affSColin Finck }
2849c2c66affSColin Finck 
2850c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
2851c2c66affSColin Finck {
2852c2c66affSColin Finck     return 0;
2853c2c66affSColin Finck }
2854c2c66affSColin Finck 
2855c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetAcceleratorMenu(HACCEL hacc)
2856c2c66affSColin Finck {
2857c2c66affSColin Finck     return E_NOTIMPL;
2858c2c66affSColin Finck }
2859c2c66affSColin Finck 
2860c2c66affSColin Finck int STDMETHODCALLTYPE CShellBrowser::_GetToolbarCount()
2861c2c66affSColin Finck {
2862c2c66affSColin Finck     return 0;
2863c2c66affSColin Finck }
2864c2c66affSColin Finck 
2865c2c66affSColin Finck LPTOOLBARITEM STDMETHODCALLTYPE CShellBrowser::_GetToolbarItem(int itb)
2866c2c66affSColin Finck {
2867c2c66affSColin Finck     return NULL;
2868c2c66affSColin Finck }
2869c2c66affSColin Finck 
2870c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SaveToolbars(IStream *pstm)
2871c2c66affSColin Finck {
2872c2c66affSColin Finck     return E_NOTIMPL;
2873c2c66affSColin Finck }
2874c2c66affSColin Finck 
2875c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_LoadToolbars(IStream *pstm)
2876c2c66affSColin Finck {
2877c2c66affSColin Finck     return E_NOTIMPL;
2878c2c66affSColin Finck }
2879c2c66affSColin Finck 
2880c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CloseAndReleaseToolbars(BOOL fClose)
2881c2c66affSColin Finck {
2882c2c66affSColin Finck     return E_NOTIMPL;
2883c2c66affSColin Finck }
2884c2c66affSColin Finck 
2885c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayGetNextToolbarFocus(
2886c2c66affSColin Finck     LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
2887c2c66affSColin Finck {
2888c2c66affSColin Finck     return E_NOTIMPL;
2889c2c66affSColin Finck }
2890c2c66affSColin Finck 
2891c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor)
2892c2c66affSColin Finck {
2893c2c66affSColin Finck     return E_NOTIMPL;
2894c2c66affSColin Finck }
2895c2c66affSColin Finck 
2896c2c66affSColin Finck UINT STDMETHODCALLTYPE CShellBrowser::_FindTBar(IUnknown *punkSrc)
2897c2c66affSColin Finck {
2898c2c66affSColin Finck     return 0;
2899c2c66affSColin Finck }
2900c2c66affSColin Finck 
2901c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
2902c2c66affSColin Finck {
2903c2c66affSColin Finck     return E_NOTIMPL;
2904c2c66affSColin Finck }
2905c2c66affSColin Finck 
2906c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg)
2907c2c66affSColin Finck {
2908c2c66affSColin Finck     for (int i = 0; i < 3; i++)
2909c2c66affSColin Finck     {
2910c2c66affSColin Finck         if (IUnknown_TranslateAcceleratorIO(fClientBars[i].clientBar, pmsg) == S_OK)
2911c2c66affSColin Finck             return S_OK;
2912c2c66affSColin Finck     }
2913c2c66affSColin Finck 
2914c2c66affSColin Finck     if (!fCurrentShellView)
2915c2c66affSColin Finck         return S_FALSE;
2916c2c66affSColin Finck 
2917c2c66affSColin Finck     return fCurrentShellView->TranslateAcceleratorW(pmsg);
2918c2c66affSColin Finck }
2919c2c66affSColin Finck 
2920c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor)
2921c2c66affSColin Finck {
2922c2c66affSColin Finck     return E_NOTIMPL;
2923c2c66affSColin Finck }
2924c2c66affSColin Finck 
2925c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
2926c2c66affSColin Finck {
2927c2c66affSColin Finck     return E_NOTIMPL;
2928c2c66affSColin Finck }
2929c2c66affSColin Finck 
2930c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoBack()
2931c2c66affSColin Finck {
2932c2c66affSColin Finck     CComPtr<ITravelLog> travelLog;
2933c2c66affSColin Finck     HRESULT hResult = GetTravelLog(&travelLog);
2934c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2935c2c66affSColin Finck         return hResult;
2936c2c66affSColin Finck     return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
2937c2c66affSColin Finck }
2938c2c66affSColin Finck 
2939c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoForward()
2940c2c66affSColin Finck {
2941c2c66affSColin Finck     CComPtr<ITravelLog> travelLog;
2942c2c66affSColin Finck     HRESULT hResult = GetTravelLog(&travelLog);
2943c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2944c2c66affSColin Finck         return hResult;
2945c2c66affSColin Finck     return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
2946c2c66affSColin Finck }
2947c2c66affSColin Finck 
2948c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoHome()
2949c2c66affSColin Finck {
2950c2c66affSColin Finck     return E_NOTIMPL;
2951c2c66affSColin Finck }
2952c2c66affSColin Finck 
2953c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoSearch()
2954c2c66affSColin Finck {
2955c2c66affSColin Finck     return E_NOTIMPL;
2956c2c66affSColin Finck }
2957c2c66affSColin Finck 
2958c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate(BSTR URL, VARIANT *Flags,
2959c2c66affSColin Finck     VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2960c2c66affSColin Finck {
2961c2c66affSColin Finck     CComHeapPtr<ITEMIDLIST> pidl;
2962c2c66affSColin Finck     HRESULT hResult;
2963c2c66affSColin Finck     CComPtr<IShellFolder> pDesktop;
2964c2c66affSColin Finck 
2965c2c66affSColin Finck     hResult = SHGetDesktopFolder(&pDesktop);
2966c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2967c2c66affSColin Finck         return hResult;
2968c2c66affSColin Finck     hResult = pDesktop->ParseDisplayName(NULL, NULL, URL, NULL, &pidl, NULL);
2969c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2970c2c66affSColin Finck         return hResult;
2971c2c66affSColin Finck     return BrowseObject(pidl, 1);
2972c2c66affSColin Finck }
2973c2c66affSColin Finck 
2974c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh()
2975c2c66affSColin Finck {
2976c2c66affSColin Finck     VARIANT                                 level;
2977c2c66affSColin Finck 
2978c2c66affSColin Finck     V_VT(&level) = VT_I4;
2979c2c66affSColin Finck     V_I4(&level) = 4;
2980c2c66affSColin Finck     return Refresh2(&level);
2981c2c66affSColin Finck }
2982c2c66affSColin Finck 
2983c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh2(VARIANT *Level)
2984c2c66affSColin Finck {
2985c2c66affSColin Finck     CComPtr<IOleCommandTarget>              oleCommandTarget;
2986c2c66affSColin Finck     HRESULT                                 hResult;
2987c2c66affSColin Finck 
2988c2c66affSColin Finck     hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
2989c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2990c2c66affSColin Finck         return hResult;
2991c2c66affSColin Finck     return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
2992c2c66affSColin Finck }
2993c2c66affSColin Finck 
2994c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Stop()
2995c2c66affSColin Finck {
2996c2c66affSColin Finck     return E_NOTIMPL;
2997c2c66affSColin Finck }
2998c2c66affSColin Finck 
2999c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Application(IDispatch **ppDisp)
3000c2c66affSColin Finck {
3001c2c66affSColin Finck     return E_NOTIMPL;
3002c2c66affSColin Finck }
3003c2c66affSColin Finck 
3004c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Parent(IDispatch **ppDisp)
3005c2c66affSColin Finck {
3006c2c66affSColin Finck     return E_NOTIMPL;
3007c2c66affSColin Finck }
3008c2c66affSColin Finck 
3009c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Container(IDispatch **ppDisp)
3010c2c66affSColin Finck {
3011c2c66affSColin Finck     return E_NOTIMPL;
3012c2c66affSColin Finck }
3013c2c66affSColin Finck 
3014c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Document(IDispatch **ppDisp)
3015c2c66affSColin Finck {
3016c2c66affSColin Finck     return E_NOTIMPL;
3017c2c66affSColin Finck }
3018c2c66affSColin Finck 
3019c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_TopLevelContainer(VARIANT_BOOL *pBool)
3020c2c66affSColin Finck {
3021c2c66affSColin Finck     return E_NOTIMPL;
3022c2c66affSColin Finck }
3023c2c66affSColin Finck 
3024c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Type(BSTR *Type)
3025c2c66affSColin Finck {
3026c2c66affSColin Finck     return E_NOTIMPL;
3027c2c66affSColin Finck }
3028c2c66affSColin Finck #ifdef __exdisp_h__
3029c2c66affSColin Finck #define long LONG
3030c2c66affSColin Finck #endif
3031c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(long *pl)
3032c2c66affSColin Finck {
3033c2c66affSColin Finck     return E_NOTIMPL;
3034c2c66affSColin Finck }
3035c2c66affSColin Finck 
3036c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(long Left)
3037c2c66affSColin Finck {
3038c2c66affSColin Finck     return E_NOTIMPL;
3039c2c66affSColin Finck }
3040c2c66affSColin Finck 
3041c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(long *pl)
3042c2c66affSColin Finck {
3043c2c66affSColin Finck     return E_NOTIMPL;
3044c2c66affSColin Finck }
3045c2c66affSColin Finck 
3046c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(long Top)
3047c2c66affSColin Finck {
3048c2c66affSColin Finck     return E_NOTIMPL;
3049c2c66affSColin Finck }
3050c2c66affSColin Finck 
3051c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(long *pl)
3052c2c66affSColin Finck {
3053c2c66affSColin Finck     return E_NOTIMPL;
3054c2c66affSColin Finck }
3055c2c66affSColin Finck 
3056c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(long Width)
3057c2c66affSColin Finck {
3058c2c66affSColin Finck     return E_NOTIMPL;
3059c2c66affSColin Finck }
3060c2c66affSColin Finck 
3061c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(long *pl)
3062c2c66affSColin Finck {
3063c2c66affSColin Finck     return E_NOTIMPL;
3064c2c66affSColin Finck }
3065c2c66affSColin Finck 
3066c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(long Height)
3067c2c66affSColin Finck {
3068c2c66affSColin Finck     return E_NOTIMPL;
3069c2c66affSColin Finck }
3070c2c66affSColin Finck #ifdef __exdisp_h__
3071c2c66affSColin Finck #undef long
3072c2c66affSColin Finck #endif
3073c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName)
3074c2c66affSColin Finck {
3075c2c66affSColin Finck     return E_NOTIMPL;
3076c2c66affSColin Finck }
3077c2c66affSColin Finck 
3078c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationURL(BSTR *LocationURL)
3079c2c66affSColin Finck {
3080c2c66affSColin Finck     return E_NOTIMPL;
3081c2c66affSColin Finck }
3082c2c66affSColin Finck 
3083c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Busy(VARIANT_BOOL *pBool)
3084c2c66affSColin Finck {
3085c2c66affSColin Finck     return E_NOTIMPL;
3086c2c66affSColin Finck }
3087c2c66affSColin Finck 
3088c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Quit()
3089c2c66affSColin Finck {
3090c2c66affSColin Finck     return E_NOTIMPL;
3091c2c66affSColin Finck }
3092c2c66affSColin Finck 
3093c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ClientToWindow(int *pcx, int *pcy)
3094c2c66affSColin Finck {
3095c2c66affSColin Finck     return E_NOTIMPL;
3096c2c66affSColin Finck }
3097c2c66affSColin Finck 
3098c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::PutProperty(BSTR Property, VARIANT vtValue)
3099c2c66affSColin Finck {
3100c2c66affSColin Finck     return E_NOTIMPL;
3101c2c66affSColin Finck }
3102c2c66affSColin Finck 
3103c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetProperty(BSTR Property, VARIANT *pvtValue)
3104c2c66affSColin Finck {
3105c2c66affSColin Finck     return E_NOTIMPL;
3106c2c66affSColin Finck }
3107c2c66affSColin Finck 
3108c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Name(BSTR *Name)
3109c2c66affSColin Finck {
3110c2c66affSColin Finck     return E_NOTIMPL;
3111c2c66affSColin Finck }
3112c2c66affSColin Finck 
3113c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_HWND(SHANDLE_PTR *pHWND)
3114c2c66affSColin Finck {
3115c2c66affSColin Finck     return E_NOTIMPL;
3116c2c66affSColin Finck }
3117c2c66affSColin Finck 
3118c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullName(BSTR *FullName)
3119c2c66affSColin Finck {
3120c2c66affSColin Finck     return E_NOTIMPL;
3121c2c66affSColin Finck }
3122c2c66affSColin Finck 
3123c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Path(BSTR *Path)
3124c2c66affSColin Finck {
3125c2c66affSColin Finck     return E_NOTIMPL;
3126c2c66affSColin Finck }
3127c2c66affSColin Finck 
3128c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Visible(VARIANT_BOOL *pBool)
3129c2c66affSColin Finck {
3130c2c66affSColin Finck     return E_NOTIMPL;
3131c2c66affSColin Finck }
3132c2c66affSColin Finck 
3133c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Visible(VARIANT_BOOL Value)
3134c2c66affSColin Finck {
3135c2c66affSColin Finck     return E_NOTIMPL;
3136c2c66affSColin Finck }
3137c2c66affSColin Finck 
3138c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusBar(VARIANT_BOOL *pBool)
3139c2c66affSColin Finck {
3140c2c66affSColin Finck     return E_NOTIMPL;
3141c2c66affSColin Finck }
3142c2c66affSColin Finck 
3143c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusBar(VARIANT_BOOL Value)
3144c2c66affSColin Finck {
3145c2c66affSColin Finck     return E_NOTIMPL;
3146c2c66affSColin Finck }
3147c2c66affSColin Finck 
3148c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusText(BSTR *StatusText)
3149c2c66affSColin Finck {
3150c2c66affSColin Finck     return E_NOTIMPL;
3151c2c66affSColin Finck }
3152c2c66affSColin Finck 
3153c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusText(BSTR StatusText)
3154c2c66affSColin Finck {
3155c2c66affSColin Finck     return E_NOTIMPL;
3156c2c66affSColin Finck }
3157c2c66affSColin Finck 
3158c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_ToolBar(int *Value)
3159c2c66affSColin Finck {
3160c2c66affSColin Finck     return E_NOTIMPL;
3161c2c66affSColin Finck }
3162c2c66affSColin Finck 
3163c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_ToolBar(int Value)
3164c2c66affSColin Finck {
3165c2c66affSColin Finck     return E_NOTIMPL;
3166c2c66affSColin Finck }
3167c2c66affSColin Finck 
3168c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_MenuBar(VARIANT_BOOL *Value)
3169c2c66affSColin Finck {
3170c2c66affSColin Finck     return E_NOTIMPL;
3171c2c66affSColin Finck }
3172c2c66affSColin Finck 
3173c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_MenuBar(VARIANT_BOOL Value)
3174c2c66affSColin Finck {
3175c2c66affSColin Finck     return E_NOTIMPL;
3176c2c66affSColin Finck }
3177c2c66affSColin Finck 
3178c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullScreen(VARIANT_BOOL *pbFullScreen)
3179c2c66affSColin Finck {
3180c2c66affSColin Finck     return E_NOTIMPL;
3181c2c66affSColin Finck }
3182c2c66affSColin Finck 
3183c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_FullScreen(VARIANT_BOOL bFullScreen)
3184c2c66affSColin Finck {
3185c2c66affSColin Finck     return E_NOTIMPL;
3186c2c66affSColin Finck }
3187c2c66affSColin Finck 
3188c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate2(VARIANT *URL, VARIANT *Flags,
3189c2c66affSColin Finck     VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3190c2c66affSColin Finck {
3191c2c66affSColin Finck     LPITEMIDLIST pidl = NULL;
3192c2c66affSColin Finck     HRESULT hResult;
3193c2c66affSColin Finck     // called from drive combo box to navigate to a directory
3194c2c66affSColin Finck     // Also called by search band to display shell results folder view
3195c2c66affSColin Finck 
3196c2c66affSColin Finck     if (V_VT(URL) == VT_BSTR)
3197c2c66affSColin Finck     {
3198c2c66affSColin Finck         return this->Navigate(V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
3199c2c66affSColin Finck     }
3200c2c66affSColin Finck     if (V_VT(URL) == (VT_ARRAY | VT_UI1))
3201c2c66affSColin Finck     {
3202c2c66affSColin Finck         if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
3203c2c66affSColin Finck             return E_INVALIDARG;
3204c2c66affSColin Finck 
3205c2c66affSColin Finck         pidl = static_cast<LPITEMIDLIST>(V_ARRAY(URL)->pvData);
3206c2c66affSColin Finck     }
3207c2c66affSColin Finck     hResult = BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
3208c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3209c2c66affSColin Finck         return hResult;
3210c2c66affSColin Finck     return S_OK;
3211c2c66affSColin Finck }
3212c2c66affSColin Finck 
3213c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf)
3214c2c66affSColin Finck {
3215c2c66affSColin Finck     return E_NOTIMPL;
3216c2c66affSColin Finck }
3217c2c66affSColin Finck 
3218c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
3219c2c66affSColin Finck     VARIANT *pvaIn, VARIANT *pvaOut)
3220c2c66affSColin Finck {
3221c2c66affSColin Finck     return E_NOTIMPL;
3222c2c66affSColin Finck }
3223c2c66affSColin Finck 
3224c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize)
3225c2c66affSColin Finck {
3226c2c66affSColin Finck     CLSID                                   classID;
3227c2c66affSColin Finck     bool                                    vertical;
3228c2c66affSColin Finck 
3229c2c66affSColin Finck     // called to show search bar
3230c2c66affSColin Finck     if (V_VT(pvaClsid) != VT_BSTR)
3231c2c66affSColin Finck         return E_INVALIDARG;
3232c2c66affSColin Finck     CLSIDFromString(V_BSTR(pvaClsid), &classID);
3233c2c66affSColin Finck     // TODO: properly compute the value of vertical
3234c2c66affSColin Finck     vertical = true;
3235c2c66affSColin Finck     return ShowBand(classID, vertical);
3236c2c66affSColin Finck }
3237c2c66affSColin Finck 
3238c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_ReadyState(READYSTATE *plReadyState)
3239c2c66affSColin Finck {
3240c2c66affSColin Finck     return E_NOTIMPL;
3241c2c66affSColin Finck }
3242c2c66affSColin Finck 
3243c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Offline(VARIANT_BOOL *pbOffline)
3244c2c66affSColin Finck {
3245c2c66affSColin Finck     return E_NOTIMPL;
3246c2c66affSColin Finck }
3247c2c66affSColin Finck 
3248c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Offline(VARIANT_BOOL bOffline)
3249c2c66affSColin Finck {
3250c2c66affSColin Finck     return E_NOTIMPL;
3251c2c66affSColin Finck }
3252c2c66affSColin Finck 
3253c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Silent(VARIANT_BOOL *pbSilent)
3254c2c66affSColin Finck {
3255c2c66affSColin Finck     return E_NOTIMPL;
3256c2c66affSColin Finck }
3257c2c66affSColin Finck 
3258c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Silent(VARIANT_BOOL bSilent)
3259c2c66affSColin Finck {
3260c2c66affSColin Finck     return E_NOTIMPL;
3261c2c66affSColin Finck }
3262c2c66affSColin Finck 
3263c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsBrowser(VARIANT_BOOL *pbRegister)
3264c2c66affSColin Finck {
3265c2c66affSColin Finck     return E_NOTIMPL;
3266c2c66affSColin Finck }
3267c2c66affSColin Finck 
3268c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsBrowser(VARIANT_BOOL bRegister)
3269c2c66affSColin Finck {
3270c2c66affSColin Finck     return E_NOTIMPL;
3271c2c66affSColin Finck }
3272c2c66affSColin Finck 
3273c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsDropTarget(VARIANT_BOOL *pbRegister)
3274c2c66affSColin Finck {
3275c2c66affSColin Finck     return E_NOTIMPL;
3276c2c66affSColin Finck }
3277c2c66affSColin Finck 
3278c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister)
3279c2c66affSColin Finck {
3280c2c66affSColin Finck     return E_NOTIMPL;
3281c2c66affSColin Finck }
3282c2c66affSColin Finck 
3283c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_TheaterMode(VARIANT_BOOL *pbRegister)
3284c2c66affSColin Finck {
3285c2c66affSColin Finck     return E_NOTIMPL;
3286c2c66affSColin Finck }
3287c2c66affSColin Finck 
3288c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_TheaterMode(VARIANT_BOOL bRegister)
3289c2c66affSColin Finck {
3290c2c66affSColin Finck     return E_NOTIMPL;
3291c2c66affSColin Finck }
3292c2c66affSColin Finck 
3293c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_AddressBar(VARIANT_BOOL *Value)
3294c2c66affSColin Finck {
3295c2c66affSColin Finck     return E_NOTIMPL;
3296c2c66affSColin Finck }
3297c2c66affSColin Finck 
3298c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_AddressBar(VARIANT_BOOL Value)
3299c2c66affSColin Finck {
3300c2c66affSColin Finck     return E_NOTIMPL;
3301c2c66affSColin Finck }
3302c2c66affSColin Finck 
3303c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Resizable(VARIANT_BOOL *Value)
3304c2c66affSColin Finck {
3305c2c66affSColin Finck     return E_NOTIMPL;
3306c2c66affSColin Finck }
3307c2c66affSColin Finck 
3308c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Resizable(VARIANT_BOOL Value)
3309c2c66affSColin Finck {
3310c2c66affSColin Finck     return E_NOTIMPL;
3311c2c66affSColin Finck }
3312c2c66affSColin Finck 
3313c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::FindWindowByIndex(DWORD dwID, IUnknown **ppunk)
3314c2c66affSColin Finck {
3315c2c66affSColin Finck     return E_NOTIMPL;
3316c2c66affSColin Finck }
3317c2c66affSColin Finck 
3318c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindowData(IStream *pStream, LPWINDOWDATA pWinData)
3319c2c66affSColin Finck {
3320c2c66affSColin Finck     if (pWinData == NULL)
3321c2c66affSColin Finck         return E_POINTER;
3322c2c66affSColin Finck 
3323c2c66affSColin Finck     pWinData->dwWindowID = -1;
3324c2c66affSColin Finck     pWinData->uiCP = 0;
3325c2c66affSColin Finck     pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
3326c2c66affSColin Finck     pWinData->lpszUrl = NULL;
3327c2c66affSColin Finck     pWinData->lpszUrlLocation = NULL;
3328c2c66affSColin Finck     pWinData->lpszTitle = NULL;
3329c2c66affSColin Finck     return S_OK;
3330c2c66affSColin Finck }
3331c2c66affSColin Finck 
3332c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition)
3333c2c66affSColin Finck {
3334c2c66affSColin Finck     return E_NOTIMPL;
3335c2c66affSColin Finck }
3336c2c66affSColin Finck 
3337c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetClassID(CLSID *pClassID)
3338c2c66affSColin Finck {
3339c2c66affSColin Finck     return E_NOTIMPL;
3340c2c66affSColin Finck }
3341c2c66affSColin Finck 
3342c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistory(IStream *pStream, IBindCtx *pbc)
3343c2c66affSColin Finck {
3344c2c66affSColin Finck     CComPtr<IPersistHistory>                viewPersistHistory;
3345c2c66affSColin Finck     CComPtr<IOleObject>                     viewHistoryObject;
3346c2c66affSColin Finck     persistState                            oldState;
3347c2c66affSColin Finck     ULONG                                   numRead;
3348c2c66affSColin Finck     LPITEMIDLIST                            pidl;
3349c2c66affSColin Finck     HRESULT                                 hResult;
3350c2c66affSColin Finck 
3351c2c66affSColin Finck     hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
3352c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3353c2c66affSColin Finck         return hResult;
3354c2c66affSColin Finck     if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
3355c2c66affSColin Finck         return E_FAIL;
3356c2c66affSColin Finck     if (oldState.browseType != 2)
3357c2c66affSColin Finck         return E_FAIL;
3358c2c66affSColin Finck     pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
3359c2c66affSColin Finck     if (pidl == NULL)
3360c2c66affSColin Finck         return E_OUTOFMEMORY;
3361c2c66affSColin Finck     hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
3362c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3363c2c66affSColin Finck     {
3364c2c66affSColin Finck         ILFree(pidl);
3365c2c66affSColin Finck         return hResult;
3366c2c66affSColin Finck     }
3367c2c66affSColin Finck     if (numRead != oldState.pidlSize)
3368c2c66affSColin Finck     {
3369c2c66affSColin Finck         ILFree(pidl);
3370c2c66affSColin Finck         return E_FAIL;
3371c2c66affSColin Finck     }
3372c2c66affSColin Finck     hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
3373c2c66affSColin Finck         IID_PPV_ARG(IOleObject, &viewHistoryObject));
3374c2c66affSColin Finck     fHistoryObject = viewHistoryObject;
3375c2c66affSColin Finck     fHistoryStream = pStream;
3376c2c66affSColin Finck     fHistoryBindContext = pbc;
3377c2c66affSColin Finck     hResult = BrowseToPIDL(pidl, BTP_DONT_UPDATE_HISTORY);
3378c2c66affSColin Finck     fHistoryObject = NULL;
3379c2c66affSColin Finck     fHistoryStream = NULL;
3380c2c66affSColin Finck     fHistoryBindContext = NULL;
3381c2c66affSColin Finck     ILFree(pidl);
3382c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3383c2c66affSColin Finck         return hResult;
3384c2c66affSColin Finck     return S_OK;
3385c2c66affSColin Finck }
3386c2c66affSColin Finck 
3387c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SaveHistory(IStream *pStream)
3388c2c66affSColin Finck {
3389c2c66affSColin Finck     CComPtr<IPersistHistory>                viewPersistHistory;
3390c2c66affSColin Finck     persistState                            newState;
3391c2c66affSColin Finck     HRESULT                                 hResult;
3392c2c66affSColin Finck 
3393c2c66affSColin Finck     hResult = fCurrentShellView->GetItemObject(
3394c2c66affSColin Finck         SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3395c2c66affSColin Finck     memset(&newState, 0, sizeof(newState));
3396c2c66affSColin Finck     newState.dwSize = sizeof(newState);
3397c2c66affSColin Finck     newState.browseType = 2;
3398c2c66affSColin Finck     newState.browserIndex = GetBrowserIndex();
3399c2c66affSColin Finck     if (viewPersistHistory.p != NULL)
3400c2c66affSColin Finck     {
3401c2c66affSColin Finck         hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3402c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
3403c2c66affSColin Finck             return hResult;
3404c2c66affSColin Finck     }
3405c2c66affSColin Finck     newState.pidlSize = ILGetSize(fCurrentDirectoryPIDL);
3406c2c66affSColin Finck     hResult = pStream->Write(&newState, sizeof(newState), NULL);
3407c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3408c2c66affSColin Finck         return hResult;
3409c2c66affSColin Finck     hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3410c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3411c2c66affSColin Finck         return hResult;
3412c2c66affSColin Finck     if (viewPersistHistory.p != NULL)
3413c2c66affSColin Finck     {
3414c2c66affSColin Finck         hResult = viewPersistHistory->SaveHistory(pStream);
3415c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
3416c2c66affSColin Finck             return hResult;
3417c2c66affSColin Finck     }
3418c2c66affSColin Finck     return S_OK;
3419c2c66affSColin Finck }
3420c2c66affSColin Finck 
3421c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetPositionCookie(DWORD dwPositioncookie)
3422c2c66affSColin Finck {
3423c2c66affSColin Finck     return E_NOTIMPL;
3424c2c66affSColin Finck }
3425c2c66affSColin Finck 
3426c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPositionCookie(DWORD *pdwPositioncookie)
3427c2c66affSColin Finck {
3428c2c66affSColin Finck     return E_NOTIMPL;
3429c2c66affSColin Finck }
3430c2c66affSColin Finck 
3431c2c66affSColin Finck LRESULT CShellBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3432c2c66affSColin Finck {
3433c2c66affSColin Finck     OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3434c2c66affSColin Finck     return 0;
3435c2c66affSColin Finck }
3436c2c66affSColin Finck 
3437c2c66affSColin Finck LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3438c2c66affSColin Finck {
3439c2c66affSColin Finck     HRESULT hr;
3440c2c66affSColin Finck 
3441c2c66affSColin Finck     /* The current thread is about to go down so render any IDataObject that may be left in the clipboard */
3442c2c66affSColin Finck     OleFlushClipboard();
3443c2c66affSColin Finck 
3444c2c66affSColin Finck     // TODO: rip down everything
3445c2c66affSColin Finck     {
3446c2c66affSColin Finck         fToolbarProxy.Destroy();
3447c2c66affSColin Finck 
3448c2c66affSColin Finck         fCurrentShellView->DestroyViewWindow();
3449c2c66affSColin Finck         fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
3450c2c66affSColin Finck 
3451c2c66affSColin Finck         for (int i = 0; i < 3; i++)
3452c2c66affSColin Finck         {
3453c2c66affSColin Finck             CComPtr<IDockingWindow> pdw;
3454c2c66affSColin Finck             CComPtr<IDeskBar> bar;
3455c2c66affSColin Finck             CComPtr<IUnknown> pBarSite;
3456c2c66affSColin Finck             CComPtr<IDeskBarClient> pClient;
3457c2c66affSColin Finck 
3458c2c66affSColin Finck             if (fClientBars[i].clientBar == NULL)
3459c2c66affSColin Finck                 continue;
3460c2c66affSColin Finck 
3461c2c66affSColin Finck             hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
3462c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hr))
3463c2c66affSColin Finck                 continue;
3464c2c66affSColin Finck 
3465c2c66affSColin Finck             /* We should destroy our basebarsite too */
3466c2c66affSColin Finck             hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
3467c2c66affSColin Finck             if (SUCCEEDED(hr))
3468c2c66affSColin Finck             {
3469c2c66affSColin Finck                 hr = bar->GetClient(&pBarSite);
3470c2c66affSColin Finck                 if (SUCCEEDED(hr) && pBarSite)
3471c2c66affSColin Finck                 {
3472c2c66affSColin Finck                     hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
3473c2c66affSColin Finck                     if (SUCCEEDED(hr))
3474c2c66affSColin Finck                         pClient->SetDeskBarSite(NULL);
3475c2c66affSColin Finck                 }
3476c2c66affSColin Finck             }
3477c2c66affSColin Finck             pdw->CloseDW(0);
3478c2c66affSColin Finck 
3479c2c66affSColin Finck             pClient = NULL;
3480c2c66affSColin Finck             pBarSite = NULL;
3481c2c66affSColin Finck             pdw = NULL;
3482c2c66affSColin Finck             bar = NULL;
3483c2c66affSColin Finck             ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
3484c2c66affSColin Finck         }
3485c2c66affSColin Finck         ReleaseCComPtrExpectZero(fCurrentShellView);
3486c2c66affSColin Finck         ReleaseCComPtrExpectZero(fTravelLog);
3487c2c66affSColin Finck 
3488c2c66affSColin Finck         fCurrentShellFolder.Release();
3489c2c66affSColin Finck         ILFree(fCurrentDirectoryPIDL);
3490c2c66affSColin Finck         ::DestroyWindow(fStatusBar);
3491c2c66affSColin Finck         DestroyMenu(fCurrentMenuBar);
3492c2c66affSColin Finck     }
3493c2c66affSColin Finck     PostQuitMessage(0);
3494c2c66affSColin Finck     return 0;
3495c2c66affSColin Finck }
3496c2c66affSColin Finck 
3497c2c66affSColin Finck LRESULT CShellBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3498c2c66affSColin Finck {
3499c2c66affSColin Finck     CComPtr<IDockingWindow>                 dockingWindow;
3500c2c66affSColin Finck     RECT                                    availableBounds;
3501bfadb22dSCarl J. Bialorucki     static const INT                        excludeItems[] = {1, 1, 1, IDC_STATUSBAR, 0, 0};
3502c2c66affSColin Finck     HRESULT                                 hResult;
3503c2c66affSColin Finck 
3504c2c66affSColin Finck     if (wParam != SIZE_MINIMIZED)
3505c2c66affSColin Finck     {
3506c2c66affSColin Finck         GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3507c2c66affSColin Finck         for (INT x = 0; x < 3; x++)
3508c2c66affSColin Finck         {
3509c2c66affSColin Finck             if (fClientBars[x].clientBar != NULL)
3510c2c66affSColin Finck             {
3511c2c66affSColin Finck                 hResult = fClientBars[x].clientBar->QueryInterface(
3512c2c66affSColin Finck                     IID_PPV_ARG(IDockingWindow, &dockingWindow));
3513c2c66affSColin Finck                 if (SUCCEEDED(hResult) && dockingWindow != NULL)
3514c2c66affSColin Finck                 {
3515c2c66affSColin Finck                     hResult = dockingWindow->ResizeBorderDW(
3516c2c66affSColin Finck                         &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3517c2c66affSColin Finck                     break;
3518c2c66affSColin Finck                 }
3519c2c66affSColin Finck             }
3520c2c66affSColin Finck         }
3521c2c66affSColin Finck         RepositionBars();
3522c2c66affSColin Finck     }
3523c2c66affSColin Finck     return 1;
3524c2c66affSColin Finck }
3525c2c66affSColin Finck 
3526c2c66affSColin Finck LRESULT CShellBrowser::OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3527c2c66affSColin Finck {
3528c2c66affSColin Finck     HMENU  theMenu;
3529c2c66affSColin Finck     LPARAM menuIndex = lParam;
3530c2c66affSColin Finck 
3531c2c66affSColin Finck     theMenu = reinterpret_cast<HMENU>(wParam);
3532c2c66affSColin Finck 
3533c2c66affSColin Finck     if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_FILE))
3534c2c66affSColin Finck     {
3535c2c66affSColin Finck         menuIndex = 0;
3536c2c66affSColin Finck     }
3537c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_EDIT))
3538c2c66affSColin Finck     {
3539c2c66affSColin Finck         menuIndex = 1;
3540c2c66affSColin Finck     }
3541c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3542c2c66affSColin Finck     {
3543c2c66affSColin Finck         UpdateViewMenu(theMenu);
3544c2c66affSColin Finck         menuIndex = 2;
3545c2c66affSColin Finck     }
3546c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_FAVORITES))
3547c2c66affSColin Finck     {
3548c2c66affSColin Finck         menuIndex = 3;
3549c2c66affSColin Finck     }
3550c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_TOOLS))
3551c2c66affSColin Finck     {
3552c2c66affSColin Finck         // FIXME: Remove once implemented
3553c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_TOOLS_MAPNETWORKDRIVE, FALSE);
3554c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_TOOLS_SYNCHRONIZE, FALSE);
3555c2c66affSColin Finck         menuIndex = 4;
3556c2c66affSColin Finck     }
3557c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP))
3558c2c66affSColin Finck     {
3559c2c66affSColin Finck         menuIndex = 5;
3560c2c66affSColin Finck     }
3561c2c66affSColin Finck 
3562c2c66affSColin Finck     LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
3563c2c66affSColin Finck 
3564c2c66affSColin Finck     return ret;
3565c2c66affSColin Finck }
3566c2c66affSColin Finck 
3567c2c66affSColin Finck LRESULT CShellBrowser::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3568c2c66affSColin Finck {
3569c2c66affSColin Finck     ::SetFocus(fCurrentShellViewWindow);
3570c2c66affSColin Finck     return 0;
3571c2c66affSColin Finck }
3572c2c66affSColin Finck 
3573c2c66affSColin Finck LRESULT CShellBrowser::RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3574c2c66affSColin Finck {
3575c2c66affSColin Finck     if (fCurrentShellViewWindow != NULL)
3576c2c66affSColin Finck         return SendMessage(fCurrentShellViewWindow, uMsg, wParam, lParam);
3577c2c66affSColin Finck     return 0;
3578c2c66affSColin Finck }
3579c2c66affSColin Finck 
3580a882ec7aSKatayama Hirofumi MZ LRESULT CShellBrowser::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3581c2c66affSColin Finck {
3582f744bb29SCarl J. Bialorucki     RefreshCabinetState();
3583c2c66affSColin Finck     SHPropagateMessage(m_hWnd, uMsg, wParam, lParam, TRUE);
3584c2c66affSColin Finck     return 0;
3585c2c66affSColin Finck }
3586c2c66affSColin Finck 
3587c2c66affSColin Finck LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3588c2c66affSColin Finck {
3589c2c66affSColin Finck     return SendMessage(WM_CLOSE);
3590c2c66affSColin Finck }
3591c2c66affSColin Finck 
3592c2c66affSColin Finck LRESULT CShellBrowser::OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3593c2c66affSColin Finck {
3594c2c66affSColin Finck     HRESULT hResult = DoFolderOptions();
3595c2c66affSColin Finck     if (FAILED(hResult))
3596c2c66affSColin Finck         TRACE("DoFolderOptions failed with hResult=%08lx\n", hResult);
3597c2c66affSColin Finck     return 0;
3598c2c66affSColin Finck }
3599c2c66affSColin Finck 
3600c2c66affSColin Finck LRESULT CShellBrowser::OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3601c2c66affSColin Finck {
3602c2c66affSColin Finck #ifndef __REACTOS__
3603c2c66affSColin Finck     WNetConnectionDialog(m_hWnd, RESOURCETYPE_DISK);
3604c2c66affSColin Finck #endif /* __REACTOS__ */
3605c2c66affSColin Finck     return 0;
3606c2c66affSColin Finck }
3607c2c66affSColin Finck 
3608c2c66affSColin Finck LRESULT CShellBrowser::OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3609c2c66affSColin Finck {
3610c2c66affSColin Finck     WNetDisconnectDialog(m_hWnd, RESOURCETYPE_DISK);
3611c2c66affSColin Finck     return 0;
3612c2c66affSColin Finck }
3613c2c66affSColin Finck 
3614c2c66affSColin Finck LRESULT CShellBrowser::OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3615c2c66affSColin Finck {
361615bc263bSHermès Bélusca-Maïto     ShellAbout(m_hWnd, _T("ReactOS"), NULL, NULL);
3617c2c66affSColin Finck     return 0;
3618c2c66affSColin Finck }
3619c2c66affSColin Finck 
3620c2c66affSColin Finck LRESULT CShellBrowser::OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3621c2c66affSColin Finck {
3622c2c66affSColin Finck     HRESULT hResult = GoBack();
3623c2c66affSColin Finck     if (FAILED(hResult))
3624c2c66affSColin Finck         TRACE("GoBack failed with hResult=%08lx\n", hResult);
3625c2c66affSColin Finck     return 0;
3626c2c66affSColin Finck }
3627c2c66affSColin Finck 
3628c2c66affSColin Finck LRESULT CShellBrowser::OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3629c2c66affSColin Finck {
3630c2c66affSColin Finck     HRESULT hResult = GoForward();
3631c2c66affSColin Finck     if (FAILED(hResult))
3632c2c66affSColin Finck         TRACE("GoForward failed with hResult=%08lx\n", hResult);
3633c2c66affSColin Finck     return 0;
3634c2c66affSColin Finck }
3635c2c66affSColin Finck 
3636c2c66affSColin Finck LRESULT CShellBrowser::OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3637c2c66affSColin Finck {
3638c2c66affSColin Finck     HRESULT hResult = NavigateToParent();
3639c2c66affSColin Finck     if (FAILED(hResult))
3640c2c66affSColin Finck         TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3641c2c66affSColin Finck     return 0;
3642c2c66affSColin Finck }
3643c2c66affSColin Finck 
3644c2c66affSColin Finck LRESULT CShellBrowser::OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3645c2c66affSColin Finck {
3646c2c66affSColin Finck     HRESULT hResult = GoHome();
3647c2c66affSColin Finck     if (FAILED(hResult))
3648c2c66affSColin Finck         TRACE("GoHome failed with hResult=%08lx\n", hResult);
3649c2c66affSColin Finck     return 0;
3650c2c66affSColin Finck }
3651c2c66affSColin Finck 
3652c2c66affSColin Finck LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3653c2c66affSColin Finck {
3654c2c66affSColin Finck     // FIXME: This does not appear to be what windows does.
3655c2c66affSColin Finck     HRESULT hResult = NavigateToParent();
3656c2c66affSColin Finck     if (FAILED(hResult))
3657c2c66affSColin Finck         TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3658c2c66affSColin Finck     return 0;
3659c2c66affSColin Finck }
3660c2c66affSColin Finck 
3661281f7c4eSKatayama Hirofumi MZ static BOOL
3662281f7c4eSKatayama Hirofumi MZ CreateShortcut(
3663281f7c4eSKatayama Hirofumi MZ     IN LPCWSTR pszLnkFileName,
3664281f7c4eSKatayama Hirofumi MZ     IN LPCITEMIDLIST pidl,
3665281f7c4eSKatayama Hirofumi MZ     IN LPCWSTR pszDescription OPTIONAL)
3666281f7c4eSKatayama Hirofumi MZ {
3667281f7c4eSKatayama Hirofumi MZ     IPersistFile *pPF;
3668281f7c4eSKatayama Hirofumi MZ     IShellLinkW *pSL;
3669281f7c4eSKatayama Hirofumi MZ     HRESULT hr = CoInitialize(NULL);
3670281f7c4eSKatayama Hirofumi MZ     if (FAILED(hr))
3671281f7c4eSKatayama Hirofumi MZ         return hr;
3672281f7c4eSKatayama Hirofumi MZ 
3673281f7c4eSKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3674281f7c4eSKatayama Hirofumi MZ                           IID_IShellLinkW, (LPVOID*)&pSL);
3675281f7c4eSKatayama Hirofumi MZ     if (SUCCEEDED(hr))
3676281f7c4eSKatayama Hirofumi MZ     {
3677281f7c4eSKatayama Hirofumi MZ         pSL->SetIDList(pidl);
3678281f7c4eSKatayama Hirofumi MZ 
3679281f7c4eSKatayama Hirofumi MZ         if (pszDescription)
3680281f7c4eSKatayama Hirofumi MZ             pSL->SetDescription(pszDescription);
3681281f7c4eSKatayama Hirofumi MZ 
3682281f7c4eSKatayama Hirofumi MZ         hr = pSL->QueryInterface(IID_IPersistFile, (LPVOID*)&pPF);
3683281f7c4eSKatayama Hirofumi MZ         if (SUCCEEDED(hr))
3684281f7c4eSKatayama Hirofumi MZ         {
3685281f7c4eSKatayama Hirofumi MZ             hr = pPF->Save(pszLnkFileName, TRUE);
3686281f7c4eSKatayama Hirofumi MZ             pPF->Release();
3687281f7c4eSKatayama Hirofumi MZ         }
3688281f7c4eSKatayama Hirofumi MZ         pSL->Release();
3689281f7c4eSKatayama Hirofumi MZ     }
3690281f7c4eSKatayama Hirofumi MZ 
3691281f7c4eSKatayama Hirofumi MZ     CoUninitialize();
3692281f7c4eSKatayama Hirofumi MZ 
3693281f7c4eSKatayama Hirofumi MZ     return SUCCEEDED(hr);
3694281f7c4eSKatayama Hirofumi MZ }
3695281f7c4eSKatayama Hirofumi MZ 
3696281f7c4eSKatayama Hirofumi MZ HRESULT GetFavsLocation(HWND hWnd, LPITEMIDLIST *pPidl)
3697281f7c4eSKatayama Hirofumi MZ {
3698281f7c4eSKatayama Hirofumi MZ     HRESULT hr = SHGetSpecialFolderLocation(hWnd, CSIDL_FAVORITES, pPidl);
3699281f7c4eSKatayama Hirofumi MZ     if (FAILED(hr))
3700281f7c4eSKatayama Hirofumi MZ         hr = SHGetSpecialFolderLocation(hWnd, CSIDL_COMMON_FAVORITES, pPidl);
3701281f7c4eSKatayama Hirofumi MZ 
3702281f7c4eSKatayama Hirofumi MZ     return hr;
3703281f7c4eSKatayama Hirofumi MZ }
3704281f7c4eSKatayama Hirofumi MZ 
3705281f7c4eSKatayama Hirofumi MZ LRESULT CShellBrowser::OnAddToFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3706281f7c4eSKatayama Hirofumi MZ {
3707281f7c4eSKatayama Hirofumi MZ     LPITEMIDLIST pidlFavs;
3708281f7c4eSKatayama Hirofumi MZ     HRESULT hr = GetFavsLocation(m_hWnd, &pidlFavs);
3709281f7c4eSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
3710281f7c4eSKatayama Hirofumi MZ         return 0;
3711281f7c4eSKatayama Hirofumi MZ 
3712281f7c4eSKatayama Hirofumi MZ     SHFILEINFOW fileInfo = { NULL };
3713281f7c4eSKatayama Hirofumi MZ     if (!SHGetFileInfoW((LPCWSTR)fCurrentDirectoryPIDL, 0, &fileInfo, sizeof(fileInfo),
3714281f7c4eSKatayama Hirofumi MZ                         SHGFI_PIDL | SHGFI_DISPLAYNAME))
3715281f7c4eSKatayama Hirofumi MZ     {
3716281f7c4eSKatayama Hirofumi MZ         return 0;
3717281f7c4eSKatayama Hirofumi MZ     }
3718281f7c4eSKatayama Hirofumi MZ 
3719281f7c4eSKatayama Hirofumi MZ     WCHAR szPath[MAX_PATH];
3720281f7c4eSKatayama Hirofumi MZ     SHGetPathFromIDListW(pidlFavs, szPath);
3721281f7c4eSKatayama Hirofumi MZ     PathAppendW(szPath, fileInfo.szDisplayName);
3722281f7c4eSKatayama Hirofumi MZ     PathAddExtensionW(szPath, L".lnk");
3723281f7c4eSKatayama Hirofumi MZ 
3724281f7c4eSKatayama Hirofumi MZ     CreateShortcut(szPath, fCurrentDirectoryPIDL, NULL);
3725281f7c4eSKatayama Hirofumi MZ     return 0;
3726281f7c4eSKatayama Hirofumi MZ }
3727281f7c4eSKatayama Hirofumi MZ 
3728c2c66affSColin Finck LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3729c2c66affSColin Finck {
3730c2c66affSColin Finck     CComPtr<IShellFolder> psfDesktop;
3731c2c66affSColin Finck     LPITEMIDLIST pidlFavs;
3732281f7c4eSKatayama Hirofumi MZ     HRESULT hr = GetFavsLocation(m_hWnd, &pidlFavs);
3733c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
3734c2c66affSColin Finck         return 0;
3735c2c66affSColin Finck 
3736281f7c4eSKatayama Hirofumi MZ     hr = SHGetDesktopFolder(&psfDesktop);
3737281f7c4eSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
3738281f7c4eSKatayama Hirofumi MZ     {
3739281f7c4eSKatayama Hirofumi MZ         ILFree(pidlFavs);
3740281f7c4eSKatayama Hirofumi MZ         return 0;
3741281f7c4eSKatayama Hirofumi MZ     }
3742281f7c4eSKatayama Hirofumi MZ 
3743c2c66affSColin Finck     hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
3744281f7c4eSKatayama Hirofumi MZ     ILFree(pidlFavs);
3745c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
3746c2c66affSColin Finck         return 0;
3747c2c66affSColin Finck 
3748c2c66affSColin Finck     return 0;
3749c2c66affSColin Finck }
3750c2c66affSColin Finck 
3751c2c66affSColin Finck LRESULT CShellBrowser::OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3752c2c66affSColin Finck {
375343b3dc20SCarl J. Bialorucki     m_settings.fStatusBarVisible = !m_settings.fStatusBarVisible;
375443b3dc20SCarl J. Bialorucki     m_settings.Save();
375543b3dc20SCarl J. Bialorucki     SendMessageW(BWM_SETTINGCHANGE, 0, (LPARAM)&m_settings);
3756c2c66affSColin Finck     return 0;
3757c2c66affSColin Finck }
3758c2c66affSColin Finck 
3759c2c66affSColin Finck LRESULT CShellBrowser::OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3760c2c66affSColin Finck {
3761c2c66affSColin Finck     HRESULT hResult;
3762c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3763c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
3764c2c66affSColin Finck     return 0;
3765c2c66affSColin Finck }
3766c2c66affSColin Finck 
3767c2c66affSColin Finck LRESULT CShellBrowser::OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3768c2c66affSColin Finck {
3769c2c66affSColin Finck     HRESULT hResult;
3770c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3771c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
3772c2c66affSColin Finck     return 0;
3773c2c66affSColin Finck }
3774c2c66affSColin Finck 
3775c2c66affSColin Finck LRESULT CShellBrowser::OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3776c2c66affSColin Finck {
3777c2c66affSColin Finck     HRESULT hResult;
3778c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3779c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
3780c2c66affSColin Finck     return 0;
3781c2c66affSColin Finck }
3782c2c66affSColin Finck 
3783c2c66affSColin Finck LRESULT CShellBrowser::OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3784c2c66affSColin Finck {
3785c2c66affSColin Finck     HRESULT hResult;
3786c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3787c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
3788c2c66affSColin Finck     return 0;
3789c2c66affSColin Finck }
3790c2c66affSColin Finck 
3791c2c66affSColin Finck LRESULT CShellBrowser::OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3792c2c66affSColin Finck {
3793c2c66affSColin Finck     HRESULT hResult;
3794c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3795c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
3796c2c66affSColin Finck     return 0;
3797c2c66affSColin Finck }
3798c2c66affSColin Finck 
3799c2c66affSColin Finck LRESULT CShellBrowser::OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3800c2c66affSColin Finck {
3801c2c66affSColin Finck     HRESULT hResult;
3802c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3803c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
3804c2c66affSColin Finck     return 0;
3805c2c66affSColin Finck }
3806c2c66affSColin Finck 
3807c2c66affSColin Finck LRESULT CShellBrowser::OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3808c2c66affSColin Finck {
3809c2c66affSColin Finck     if (fCurrentShellView)
3810c2c66affSColin Finck         fCurrentShellView->Refresh();
3811c2c66affSColin Finck     return 0;
3812c2c66affSColin Finck }
3813c2c66affSColin Finck 
3814c2c66affSColin Finck LRESULT CShellBrowser::OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3815c2c66affSColin Finck {
3816c2c66affSColin Finck     return 0;
3817c2c66affSColin Finck }
3818c2c66affSColin Finck 
3819c2c66affSColin Finck LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3820c2c66affSColin Finck {
3821c2c66affSColin Finck     // TODO: HACK ! use the proper mechanism to show the band (i.e. pass the BSTR to basebar)
3822c2c66affSColin Finck     if (wID >= IDM_EXPLORERBAND_BEGINCUSTOM && wID <= IDM_EXPLORERBAND_ENDCUSTOM)
3823c2c66affSColin Finck     {
3824c2c66affSColin Finck         MenuBandInfo *mbi;
3825c2c66affSColin Finck         mbi = (MenuBandInfo*)DSA_GetItemPtr(menuDsa, (wID - IDM_EXPLORERBAND_BEGINCUSTOM));
3826c2c66affSColin Finck         if (!mbi)
3827c2c66affSColin Finck             return 0;
3828c2c66affSColin Finck         ShowBand(mbi->barGuid, mbi->fVertical);
3829c2c66affSColin Finck         bHandled = TRUE;
3830c2c66affSColin Finck         return 1;
3831c2c66affSColin Finck     }
3832c2c66affSColin Finck     switch (wID)
3833c2c66affSColin Finck     {
3834c2c66affSColin Finck     case IDM_EXPLORERBAR_SEARCH:
38354212f4b1SBrock Mammen         ShowBand(CLSID_FileSearchBand, true);
3836c2c66affSColin Finck         break;
3837c2c66affSColin Finck     case IDM_EXPLORERBAR_FOLDERS:
3838c2c66affSColin Finck         ShowBand(CLSID_ExplorerBand, true);
3839c2c66affSColin Finck         break;
3840c2c66affSColin Finck     case IDM_EXPLORERBAR_HISTORY:
3841c2c66affSColin Finck         ShowBand(CLSID_SH_HistBand, true);
3842c2c66affSColin Finck         break;
3843c2c66affSColin Finck     case IDM_EXPLORERBAR_FAVORITES:
3844c2c66affSColin Finck         ShowBand(CLSID_SH_FavBand, true);
3845c2c66affSColin Finck         break;
3846c2c66affSColin Finck     default:
3847c2c66affSColin Finck         WARN("Unknown id %x\n", wID);
3848c2c66affSColin Finck     }
3849c2c66affSColin Finck     bHandled = TRUE;
3850c2c66affSColin Finck     return 1;
3851c2c66affSColin Finck }
3852c2c66affSColin Finck 
3853c2c66affSColin Finck LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3854c2c66affSColin Finck {
3855c2c66affSColin Finck     if (HIWORD(wParam) == 0 && LOWORD(wParam) < FCIDM_SHVIEWLAST && fCurrentShellViewWindow != NULL)
3856c2c66affSColin Finck         return SendMessage(fCurrentShellViewWindow, uMsg, wParam, lParam);
3857c2c66affSColin Finck     return 0;
3858c2c66affSColin Finck }
3859c2c66affSColin Finck 
386043b3dc20SCarl J. Bialorucki LRESULT CShellBrowser::OnSettingsChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
386143b3dc20SCarl J. Bialorucki {
386243b3dc20SCarl J. Bialorucki     /* Refresh child windows */
386343b3dc20SCarl J. Bialorucki     ::SendMessageW(fClientBars[BIInternetToolbar].hwnd, uMsg, wParam, lParam);
386443b3dc20SCarl J. Bialorucki 
386543b3dc20SCarl J. Bialorucki     /* Refresh status bar */
386643b3dc20SCarl J. Bialorucki     if (fStatusBar)
386743b3dc20SCarl J. Bialorucki     {
386843b3dc20SCarl J. Bialorucki         ::ShowWindow(fStatusBar, m_settings.fStatusBarVisible ? SW_SHOW : SW_HIDE);
386943b3dc20SCarl J. Bialorucki         RepositionBars();
387043b3dc20SCarl J. Bialorucki     }
387143b3dc20SCarl J. Bialorucki 
387243b3dc20SCarl J. Bialorucki     return 0;
387343b3dc20SCarl J. Bialorucki }
387443b3dc20SCarl J. Bialorucki 
387543b3dc20SCarl J. Bialorucki LRESULT CShellBrowser::OnGetSettingsPtr(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
387643b3dc20SCarl J. Bialorucki {
387743b3dc20SCarl J. Bialorucki     if (!lParam)
387843b3dc20SCarl J. Bialorucki         return ERROR_INVALID_PARAMETER;
387943b3dc20SCarl J. Bialorucki 
388043b3dc20SCarl J. Bialorucki     *(ShellSettings**)lParam = &m_settings;
388143b3dc20SCarl J. Bialorucki     return NO_ERROR;
388243b3dc20SCarl J. Bialorucki }
388343b3dc20SCarl J. Bialorucki 
3884ff63d064SKatayama Hirofumi MZ // WM_APPCOMMAND
3885ff63d064SKatayama Hirofumi MZ LRESULT CShellBrowser::OnAppCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
3886ff63d064SKatayama Hirofumi MZ {
3887ff63d064SKatayama Hirofumi MZ     UINT uCmd = GET_APPCOMMAND_LPARAM(lParam);
3888ff63d064SKatayama Hirofumi MZ     switch (uCmd)
3889ff63d064SKatayama Hirofumi MZ     {
3890ff63d064SKatayama Hirofumi MZ         case APPCOMMAND_BROWSER_BACKWARD:
3891ff63d064SKatayama Hirofumi MZ             GoBack();
3892ff63d064SKatayama Hirofumi MZ             break;
3893ff63d064SKatayama Hirofumi MZ 
3894ff63d064SKatayama Hirofumi MZ         case APPCOMMAND_BROWSER_FORWARD:
3895ff63d064SKatayama Hirofumi MZ             GoForward();
3896ff63d064SKatayama Hirofumi MZ             break;
3897ff63d064SKatayama Hirofumi MZ 
3898ff63d064SKatayama Hirofumi MZ         default:
3899ff63d064SKatayama Hirofumi MZ             FIXME("uCmd: %u\n", uCmd);
3900ff63d064SKatayama Hirofumi MZ             break;
3901ff63d064SKatayama Hirofumi MZ     }
3902ff63d064SKatayama Hirofumi MZ     return 0;
3903ff63d064SKatayama Hirofumi MZ }
3904ff63d064SKatayama Hirofumi MZ 
390562c33fbfSGiannis Adamopoulos HRESULT CShellBrowser_CreateInstance(REFIID riid, void **ppv)
3906c2c66affSColin Finck {
390762c33fbfSGiannis Adamopoulos     return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
3908c2c66affSColin Finck }
3909f744bb29SCarl J. Bialorucki 
3910f744bb29SCarl J. Bialorucki void CShellBrowser::RefreshCabinetState()
3911f744bb29SCarl J. Bialorucki {
3912f744bb29SCarl J. Bialorucki     gCabinetState.Load();
3913f744bb29SCarl J. Bialorucki     UpdateWindowTitle();
3914f744bb29SCarl J. Bialorucki }
3915f744bb29SCarl J. Bialorucki 
3916f744bb29SCarl J. Bialorucki void CShellBrowser::UpdateWindowTitle()
3917f744bb29SCarl J. Bialorucki {
3918f744bb29SCarl J. Bialorucki     WCHAR title[MAX_PATH];
3919f744bb29SCarl J. Bialorucki     SHGDNF flags = SHGDN_FORADDRESSBAR;
3920f744bb29SCarl J. Bialorucki 
3921f744bb29SCarl J. Bialorucki     if (gCabinetState.fFullPathTitle)
3922f744bb29SCarl J. Bialorucki         flags |= SHGDN_FORPARSING;
3923f744bb29SCarl J. Bialorucki 
3924f744bb29SCarl J. Bialorucki     if (SUCCEEDED(IEGetNameAndFlags(fCurrentDirectoryPIDL, flags, title, _countof(title), NULL)))
3925f744bb29SCarl J. Bialorucki         SetWindowText(title);
3926f744bb29SCarl J. Bialorucki }
3927