xref: /reactos/dll/win32/browseui/shellbrowser.cpp (revision 751641c2)
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;
1235b78381aSWhindmar Saksit static const long                           BTP_ACTIVATE_NOFOCUS = 0x04;
124c2c66affSColin Finck 
125c2c66affSColin Finck BOOL                                        createNewStuff = false;
126c2c66affSColin Finck 
127c2c66affSColin Finck 
128c2c66affSColin Finck // this class is private to browseui.dll and is not registered externally?
129c2c66affSColin Finck //DEFINE_GUID(CLSID_ShellFldSetExt, 0x6D5313C0, 0x8C62, 0x11D1, 0xB2, 0xCD, 0x00, 0x60, 0x97, 0xDF, 0x8C, 0x11);
130c2c66affSColin Finck 
DeleteMenuItems(HMENU theMenu,unsigned int firstIDToDelete,unsigned int lastIDToDelete)131c2c66affSColin Finck void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
132c2c66affSColin Finck {
133c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
134c2c66affSColin Finck     int                                     menuItemCount;
135c2c66affSColin Finck     int                                     curIndex;
136c2c66affSColin Finck 
137c2c66affSColin Finck     menuItemCount = GetMenuItemCount(theMenu);
138c2c66affSColin Finck     curIndex = 0;
139c2c66affSColin Finck     while (curIndex < menuItemCount)
140c2c66affSColin Finck     {
141c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
142c2c66affSColin Finck         menuItemInfo.fMask = MIIM_ID;
143c2c66affSColin Finck         if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
144c2c66affSColin Finck             menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
145c2c66affSColin Finck         {
146c2c66affSColin Finck             DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
147c2c66affSColin Finck             menuItemCount--;
148c2c66affSColin Finck         }
149c2c66affSColin Finck         else
150c2c66affSColin Finck             curIndex++;
151c2c66affSColin Finck     }
152c2c66affSColin Finck }
153c2c66affSColin Finck 
SHBindToFolder(LPCITEMIDLIST path,IShellFolder ** newFolder)154c2c66affSColin Finck HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
155c2c66affSColin Finck {
156c2c66affSColin Finck     CComPtr<IShellFolder>                   desktop;
157c2c66affSColin Finck 
158c2c66affSColin Finck     HRESULT hr = ::SHGetDesktopFolder(&desktop);
159c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
160c2c66affSColin Finck         return E_FAIL;
161c2c66affSColin Finck     if (path == NULL || path->mkid.cb == 0)
162c2c66affSColin Finck     {
163c2c66affSColin Finck         *newFolder = desktop;
164c2c66affSColin Finck         desktop.p->AddRef ();
165c2c66affSColin Finck         return S_OK;
166c2c66affSColin Finck     }
167c2c66affSColin Finck     return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
168c2c66affSColin Finck }
169c2c66affSColin Finck 
170c2c66affSColin Finck static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClass");
1715cb06151SAmine Khaldi //static const TCHAR szExploreWndClass[] = TEXT("ExploreWClass");
172c2c66affSColin Finck 
173c2c66affSColin Finck class CDockManager;
174c2c66affSColin Finck class CShellBrowser;
175c2c66affSColin Finck 
176c2c66affSColin Finck class CToolbarProxy :
177c2c66affSColin Finck     public CWindowImpl<CToolbarProxy, CWindow, CControlWinTraits>
178c2c66affSColin Finck {
179c2c66affSColin Finck private:
180c2c66affSColin Finck     CComPtr<IExplorerToolbar>               fExplorerToolbar;
181c2c66affSColin Finck public:
182c2c66affSColin Finck     void Initialize(HWND parent, IUnknown *explorerToolbar);
183c2c66affSColin Finck     void Destroy();
184c2c66affSColin Finck private:
185c2c66affSColin Finck 
186c2c66affSColin Finck     // message handlers
187c2c66affSColin Finck     LRESULT OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
188c2c66affSColin Finck     LRESULT OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
189c2c66affSColin Finck 
190c2c66affSColin Finck     BEGIN_MSG_MAP(CToolbarProxy)
191c2c66affSColin Finck         MESSAGE_HANDLER(TB_ADDBITMAP, OnAddBitmap)
192c2c66affSColin Finck         MESSAGE_RANGE_HANDLER(WM_USER, 0x7fff, OnForwardMessage)
193c2c66affSColin Finck     END_MSG_MAP()
194c2c66affSColin Finck };
195c2c66affSColin Finck 
Initialize(HWND parent,IUnknown * explorerToolbar)196c2c66affSColin Finck void CToolbarProxy::Initialize(HWND parent, IUnknown *explorerToolbar)
197c2c66affSColin Finck {
198c2c66affSColin Finck     HWND                                    myWindow;
199c2c66affSColin Finck     HRESULT                                 hResult;
200c2c66affSColin Finck 
201c2c66affSColin Finck     myWindow = SHCreateWorkerWindowW(0, parent, 0, WS_CHILD, NULL, 0);
202c2c66affSColin Finck     if (myWindow != NULL)
203c2c66affSColin Finck     {
204c2c66affSColin Finck         SubclassWindow(myWindow);
205c2c66affSColin Finck         SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
206c2c66affSColin Finck         hResult = explorerToolbar->QueryInterface(
207c2c66affSColin Finck             IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
208c2c66affSColin Finck     }
209c2c66affSColin Finck }
210c2c66affSColin Finck 
Destroy()211c2c66affSColin Finck void CToolbarProxy::Destroy()
212c2c66affSColin Finck {
213c2c66affSColin Finck     DestroyWindow();
214c2c66affSColin Finck     fExplorerToolbar = NULL;
215c2c66affSColin Finck }
216c2c66affSColin Finck 
OnAddBitmap(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)217c2c66affSColin Finck LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
218c2c66affSColin Finck {
219c2c66affSColin Finck     long int                                result;
220c2c66affSColin Finck     HRESULT                                 hResult;
221c2c66affSColin Finck 
222c2c66affSColin Finck     result = 0;
223c2c66affSColin Finck     if (fExplorerToolbar.p != NULL)
224c2c66affSColin Finck     {
225c2c66affSColin Finck         hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 1, (long)wParam,
226c2c66affSColin Finck             reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
227c2c66affSColin Finck         hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 2, (long)wParam,
228c2c66affSColin Finck             reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
229c2c66affSColin Finck     }
230c2c66affSColin Finck     return result;
231c2c66affSColin Finck }
232c2c66affSColin Finck 
OnForwardMessage(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)233c2c66affSColin Finck LRESULT CToolbarProxy::OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
234c2c66affSColin Finck {
235c2c66affSColin Finck     LRESULT                                 result;
236c2c66affSColin Finck     HRESULT                                 hResult;
237c2c66affSColin Finck 
238c2c66affSColin Finck     result = 0;
239c2c66affSColin Finck     if (fExplorerToolbar.p != NULL)
240c2c66affSColin Finck         hResult = fExplorerToolbar->SendToolbarMsg(&CGID_ShellBrowser, uMsg, wParam, lParam, &result);
241c2c66affSColin Finck     return result;
242c2c66affSColin Finck }
243c2c66affSColin Finck 
244c2c66affSColin Finck /*
245c2c66affSColin Finck Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
246c2c66affSColin Finck     where vaIn will be a VT_UNKNOWN with the new bar. It also sends a RB_SHOWBAND to the
247c2c66affSColin Finck     rebar
248c2c66affSColin Finck */
249c2c66affSColin Finck 
250c2c66affSColin Finck struct MenuBandInfo {
251c2c66affSColin Finck     GUID barGuid;
252c2c66affSColin Finck     BOOL fVertical;
253c2c66affSColin Finck };
254c2c66affSColin Finck 
255c2c66affSColin Finck class CShellBrowser :
256c2c66affSColin Finck     public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
257c2c66affSColin Finck     public CComObjectRootEx<CComMultiThreadModelNoCS>,
258c2c66affSColin Finck     public IShellBrowser,
259c2c66affSColin Finck     public IDropTarget,
260c2c66affSColin Finck     public IServiceProvider,
261c2c66affSColin Finck     public IProfferServiceImpl<CShellBrowser>,
262c2c66affSColin Finck     public IShellBrowserService,
263c2c66affSColin Finck     public IWebBrowser2,
264c2c66affSColin Finck     public ITravelLogClient,
265c2c66affSColin Finck     public IPersistHistory,
266c2c66affSColin Finck     public IDockingWindowSite,
267c2c66affSColin Finck     public IOleCommandTarget,
268c2c66affSColin Finck     public IBrowserService2,
269c2c66affSColin Finck     public IConnectionPointContainerImpl<CShellBrowser>,
270c2c66affSColin Finck     public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>,
271c2c66affSColin Finck     public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>
272c2c66affSColin Finck {
273c2c66affSColin Finck private:
274c2c66affSColin Finck     class barInfo
275c2c66affSColin Finck     {
276c2c66affSColin Finck     public:
barInfo()277e5f90298SMark Jansen         barInfo()
278e5f90298SMark Jansen         {
279e5f90298SMark Jansen             memset(&borderSpace, 0, sizeof(borderSpace));
280e5f90298SMark Jansen             hwnd = NULL;
281e5f90298SMark Jansen         }
282e5f90298SMark Jansen 
283c2c66affSColin Finck         RECT                                borderSpace;
284c2c66affSColin Finck         CComPtr<IUnknown>                   clientBar;
285c2c66affSColin Finck         HWND                                hwnd;
286c2c66affSColin Finck     };
287c2c66affSColin Finck     static const int                        BIInternetToolbar = 0;
288c2c66affSColin Finck     static const int                        BIVerticalBaseBar = 1;
289c2c66affSColin Finck     static const int                        BIHorizontalBaseBar = 2;
290c2c66affSColin Finck 
291c2c66affSColin Finck     HWND                                    fCurrentShellViewWindow;    // our currently hosted shell view window
292c2c66affSColin Finck     CComPtr<IShellFolder>                   fCurrentShellFolder;        //
293c2c66affSColin Finck     CComPtr<IShellView>                     fCurrentShellView;          //
294c2c66affSColin Finck     LPITEMIDLIST                            fCurrentDirectoryPIDL;      //
295c2c66affSColin Finck     HWND                                    fStatusBar;
296c2c66affSColin Finck     CToolbarProxy                           fToolbarProxy;
297c2c66affSColin Finck     barInfo                                 fClientBars[3];
298c2c66affSColin Finck     CComPtr<ITravelLog>                     fTravelLog;
299c2c66affSColin Finck     HMENU                                   fCurrentMenuBar;
300a0c5cafcSGiannis Adamopoulos     GUID                                    fCurrentVertBar;             //The guid of the built in vertical bar that is being shown
301c2c66affSColin Finck     // The next three fields support persisted history for shell views.
302c2c66affSColin Finck     // They do not need to be reference counted.
303c2c66affSColin Finck     IOleObject                              *fHistoryObject;
304c2c66affSColin Finck     IStream                                 *fHistoryStream;
305c2c66affSColin Finck     IBindCtx                                *fHistoryBindContext;
306c2c66affSColin Finck     HDSA menuDsa;
307c2c66affSColin Finck     HACCEL m_hAccel;
30843b3dc20SCarl J. Bialorucki     ShellSettings m_settings;
309c97c1ad4SWhindmar Saksit     SBFOLDERSETTINGS m_deffoldersettings;
3105b78381aSWhindmar Saksit     DWORD m_BrowserSvcFlags;
3116219a1abSWhindmar Saksit     bool m_Destroyed;
312c2c66affSColin Finck public:
313c2c66affSColin Finck #if 0
314c2c66affSColin Finck     ULONG InternalAddRef()
315c2c66affSColin Finck     {
316c2c66affSColin Finck         OutputDebugString(_T("AddRef\n"));
317c2c66affSColin Finck         return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalAddRef();
318c2c66affSColin Finck     }
319c2c66affSColin Finck     ULONG InternalRelease()
320c2c66affSColin Finck     {
321c2c66affSColin Finck         OutputDebugString(_T("Release\n"));
322c2c66affSColin Finck         return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalRelease();
323c2c66affSColin Finck     }
324c2c66affSColin Finck #endif
325c2c66affSColin Finck 
326c2c66affSColin Finck     CShellBrowser();
327c2c66affSColin Finck     ~CShellBrowser();
32862c33fbfSGiannis Adamopoulos     HRESULT Initialize();
329c2c66affSColin Finck public:
3305b78381aSWhindmar Saksit     UINT ApplyNewBrowserFlag(UINT Flags);
3315b78381aSWhindmar Saksit     HRESULT OpenNewBrowserWindow(LPCITEMIDLIST pidl, UINT SbspFlags);
3325b78381aSWhindmar Saksit     HRESULT CreateRelativeBrowsePIDL(LPCITEMIDLIST relative, UINT SbspFlags, LPITEMIDLIST *ppidl);
333c2c66affSColin Finck     HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
334c2c66affSColin Finck     HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
335c2c66affSColin Finck         FOLDERSETTINGS *folderSettings, long flags);
336802dc971SWhindmar Saksit     void SaveViewState();
337c2c66affSColin Finck     HRESULT GetMenuBand(REFIID riid, void **shellMenu);
338c2c66affSColin Finck     HRESULT GetBaseBar(bool vertical, REFIID riid, void **theBaseBar);
33946ab3466SHermès Bélusca-Maïto     BOOL IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID);
340c2c66affSColin Finck     HRESULT ShowBand(const CLSID &classID, bool vertical);
341c2c66affSColin Finck     HRESULT NavigateToParent();
342c2c66affSColin Finck     HRESULT DoFolderOptions();
343c97c1ad4SWhindmar Saksit     HRESULT ApplyBrowserDefaultFolderSettings(IShellView *pvs);
344c2c66affSColin Finck     static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
345c2c66affSColin Finck     void RepositionBars();
346c2c66affSColin Finck     HRESULT BuildExplorerBandMenu();
347c2c66affSColin Finck     HRESULT BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound);
348c2c66affSColin Finck     BOOL IsBuiltinBand(CLSID &bandID);
GetWindowProc()349c2c66affSColin Finck     virtual WNDPROC GetWindowProc()
350c2c66affSColin Finck     {
351c2c66affSColin Finck         return WindowProc;
352c2c66affSColin Finck     }
353c2c66affSColin Finck     HRESULT FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments);
354c2c66affSColin Finck     HRESULT FireNavigateComplete(const wchar_t *newDirectory);
355c2c66affSColin Finck     HRESULT FireCommandStateChange(bool newState, int commandID);
356c2c66affSColin Finck     HRESULT FireCommandStateChangeAll();
357c2c66affSColin Finck     HRESULT UpdateForwardBackState();
358c2c66affSColin Finck     HRESULT UpdateUpState();
359c2c66affSColin Finck     void UpdateGotoMenu(HMENU theMenu);
360c2c66affSColin Finck     void UpdateViewMenu(HMENU theMenu);
361674136bcSWhindmar Saksit     HRESULT IsInternetToolbarBandShown(UINT ITId);
362f744bb29SCarl J. Bialorucki     void RefreshCabinetState();
363f744bb29SCarl J. Bialorucki     void UpdateWindowTitle();
364674136bcSWhindmar Saksit     void SaveITBarLayout();
365c2c66affSColin Finck 
366c2c66affSColin Finck /*    // *** IDockingWindowFrame methods ***
367bb297bc3SKatayama Hirofumi MZ     STDMETHOD(AddToolbar)(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags) override;
368bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RemoveToolbar)(IUnknown *punkSrc, DWORD dwRemoveFlags) override;
369bb297bc3SKatayama Hirofumi MZ     STDMETHOD(FindToolbar)(LPCWSTR pwszItem, REFIID riid, void **ppv) override;
370c2c66affSColin Finck     */
371c2c66affSColin Finck 
372c2c66affSColin Finck     // *** IDockingWindowSite methods ***
373bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBorderDW)(IUnknown* punkObj, LPRECT prcBorder) override;
374bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RequestBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
375bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
376c2c66affSColin Finck 
377c2c66affSColin Finck     // *** IOleCommandTarget methods ***
378bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds,
379bb297bc3SKatayama Hirofumi MZ         OLECMD prgCmds[  ], OLECMDTEXT *pCmdText) override;
380bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID,
381bb297bc3SKatayama Hirofumi MZ         DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
382c2c66affSColin Finck 
383c2c66affSColin Finck     // *** IOleWindow methods ***
384bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetWindow)(HWND *lphwnd) override;
385bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
386c2c66affSColin Finck 
387c2c66affSColin Finck     // *** IShellBrowser methods ***
388bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InsertMenusSB)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) override;
389bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetMenuSB)(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) override;
390bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RemoveMenusSB)(HMENU hmenuShared) override;
391bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetStatusTextSB)(LPCOLESTR pszStatusText) override;
392bb297bc3SKatayama Hirofumi MZ     STDMETHOD(EnableModelessSB)(BOOL fEnable) override;
393bb297bc3SKatayama Hirofumi MZ     STDMETHOD(TranslateAcceleratorSB)(MSG *pmsg, WORD wID) override;
394bb297bc3SKatayama Hirofumi MZ     STDMETHOD(BrowseObject)(LPCITEMIDLIST pidl, UINT wFlags) override;
395bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream **ppStrm) override;
396bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetControlWindow)(UINT id, HWND *lphwnd) override;
397bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SendControlMsg)(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) override;
398bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryActiveShellView)(IShellView **ppshv) override;
399bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnViewWindowActive)(IShellView *ppshv) override;
400bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetToolbarItems)(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) override;
401c2c66affSColin Finck 
402c2c66affSColin Finck     // *** IDropTarget methods ***
403bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragEnter)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
404bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
405bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DragLeave)() override;
406bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Drop)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
407c2c66affSColin Finck 
408c2c66affSColin Finck     // *** IServiceProvider methods ***
409bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppvObject) override;
410c2c66affSColin Finck 
411802dc971SWhindmar Saksit     // *** IShellBrowserService methods ***
412bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPropertyBag)(long flags, REFIID riid, void **ppvObject) override;
413c2c66affSColin Finck 
414c2c66affSColin Finck     // *** IDispatch methods ***
415bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) override;
416bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
417bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetIDsOfNames)(
418bb297bc3SKatayama Hirofumi MZ         REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override;
419bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
420bb297bc3SKatayama Hirofumi MZ         DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
421c2c66affSColin Finck 
422c2c66affSColin Finck     // *** IBrowserService methods ***
423bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetParentSite)(IOleInPlaceSite **ppipsite) override;
424bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetTitle)(IShellView *psv, LPCWSTR pszName) override;
425bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTitle)(IShellView *psv, LPWSTR pszName, DWORD cchName) override;
426bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetOleObject)(IOleObject **ppobjv) override;
427bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetTravelLog)(ITravelLog **pptl) override;
428bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ShowControlWindow)(UINT id, BOOL fShow) override;
429bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IsControlWindowShown)(UINT id, BOOL *pfShown) override;
430bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IEGetDisplayName)(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags) override;
431bb297bc3SKatayama Hirofumi MZ     STDMETHOD(IEParseDisplayName)(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut) override;
432bb297bc3SKatayama Hirofumi MZ     STDMETHOD(DisplayParseError)(HRESULT hres, LPCWSTR pwszPath) override;
433bb297bc3SKatayama Hirofumi MZ     STDMETHOD(NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF) override;
434bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetNavigateState)(BNSTATE bnstate) override;
435bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetNavigateState)(BNSTATE *pbnstate) override;
436bb297bc3SKatayama Hirofumi MZ     STDMETHOD(NotifyRedirect)(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse) override;
437bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateWindowList)() override;
438bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateBackForwardState)() override;
439bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetFlags)(DWORD dwFlags, DWORD dwFlagMask) override;
440bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetFlags)(DWORD *pdwFlags) override;
441bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CanNavigateNow)( void) override;
442bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPidl)(LPITEMIDLIST *ppidl) override;
443bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetReferrer)(LPCITEMIDLIST pidl) override;
444bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(DWORD, GetBrowserIndex)() override;
445bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBrowserByIndex)(DWORD dwID, IUnknown **ppunk) override;
446bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetHistoryObject)(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc) override;
447bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetHistoryObject)(IOleObject *pole, BOOL fIsLocalAnchor) override;
448bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CacheOLEServer)(IOleObject *pole) override;
449bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetSetCodePage)(VARIANT *pvarIn, VARIANT *pvarOut) override;
450bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnHttpEquiv)(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut) override;
451bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPalette)(HPALETTE *hpal) override;
452bb297bc3SKatayama Hirofumi MZ     STDMETHOD(RegisterWindow)(BOOL fForceRegister, int swc) override;
453c2c66affSColin Finck 
454c2c66affSColin Finck     // *** IBrowserService2 methods ***
455bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, WndProcBS)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
456bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetAsDefFolderSettings)() override;
457bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewRect)(RECT *prc) override;
458bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnSize)(WPARAM wParam) override;
459bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnCreate)(struct tagCREATESTRUCTW *pcs) override;
460bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, OnCommand)(WPARAM wParam, LPARAM lParam) override;
461bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnDestroy)() override;
462bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, OnNotify)(struct tagNMHDR *pnm) override;
463bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnSetFocus)() override;
464bb297bc3SKatayama Hirofumi MZ     STDMETHOD(OnFrameWindowActivateBS)(BOOL fActive) override;
465bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ReleaseShellView)() override;
466bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ActivatePendingView)() override;
467bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CreateViewWindow)(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd) override;
468bb297bc3SKatayama Hirofumi MZ     STDMETHOD(CreateBrowserPropSheetExt)(REFIID riid, void **ppv) override;
469bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetViewWindow)(HWND *phwndView) override;
470bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetBaseBrowserData)(LPCBASEBROWSERDATA *pbbd) override;
471bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LPBASEBROWSERDATA, PutBaseBrowserData)(void) override;
472bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeTravelLog)(ITravelLog *ptl, DWORD dw) override;
473bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetTopBrowser)() override;
474bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Offline)(int iCmd) override;
475bb297bc3SKatayama Hirofumi MZ     STDMETHOD(AllowViewResize)(BOOL f) override;
476bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetActivateState)(UINT u) override;
477bb297bc3SKatayama Hirofumi MZ     STDMETHOD(UpdateSecureLockIcon)(int eSecureLock) override;
478bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeDownloadManager)() override;
479bb297bc3SKatayama Hirofumi MZ     STDMETHOD(InitializeTransitionSite)() override;
480bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_Initialize)(HWND hwnd, IUnknown *pauto) override;
481bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CancelPendingNavigationAsync)( void) override;
482bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CancelPendingView)() override;
483bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_MaySaveChanges)() override;
484bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_PauseOrResumeView)(BOOL fPaused) override;
485bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_DisableModeless)() override;
486bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags) override;
487bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_TryShell2Rename)(IShellView *psv, LPCITEMIDLIST pidlNew) override;
488bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SwitchActivationNow)() override;
489bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ExecChildren)(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup,
490bb297bc3SKatayama Hirofumi MZ         DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut) override;
491bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SendChildren)(
492bb297bc3SKatayama Hirofumi MZ         HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
493bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetFolderSetData)(struct tagFolderSetData *pfsd) override;
494bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_OnFocusChange)(UINT itb) override;
495bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_ShowHideChildWindows)(BOOL fChildOnly) override;
496bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(UINT, _get_itbLastFocus)() override;
497bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_put_itbLastFocus)(UINT itbLastFocus) override;
498bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_UIActivateView)(UINT uState) override;
499bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetViewBorderRect)(RECT *prc) override;
500bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_UpdateViewRectSize)() override;
501bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeNextBorder)(UINT itb) override;
502bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeView)() override;
503bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetEffectiveClientArea)(LPRECT lprectBorder, HMONITOR hmon) override;
504bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(IStream *, v_GetViewStream)(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName) override;
505bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LRESULT, ForwardViewMsg)(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
506bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetAcceleratorMenu)(HACCEL hacc) override;
507bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(int, _GetToolbarCount)() override;
508bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(LPTOOLBARITEM, _GetToolbarItem)(int itb) override;
509bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SaveToolbars)(IStream *pstm) override;
510bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_LoadToolbars)(IStream *pstm) override;
511bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_CloseAndReleaseToolbars)(BOOL fClose) override;
512bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_MayGetNextToolbarFocus)(LPMSG lpMsg, UINT itbNext,
513bb297bc3SKatayama Hirofumi MZ         int citb, LPTOOLBARITEM *pptbi, HWND *phwnd) override;
514bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_ResizeNextBorderHelper)(UINT itb, BOOL bUseHmonitor) override;
515bb297bc3SKatayama Hirofumi MZ     STDMETHOD_(UINT, _FindTBar)(IUnknown *punkSrc) override;
516bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_SetFocus)(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg) override;
517bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_MayTranslateAccelerator)(MSG *pmsg) override;
518bb297bc3SKatayama Hirofumi MZ     STDMETHOD(_GetBorderDWHelper)(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor) override;
519bb297bc3SKatayama Hirofumi MZ     STDMETHOD(v_CheckZoneCrossing)(LPCITEMIDLIST pidl) override;
520c2c66affSColin Finck 
521c2c66affSColin Finck     // *** IWebBrowser methods ***
522bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoBack)() override;
523bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoForward)() override;
524bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoHome)() override;
525bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GoSearch)() override;
526bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Navigate)(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName,
527bb297bc3SKatayama Hirofumi MZ         VARIANT *PostData, VARIANT *Headers) override;
528bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Refresh)() override;
529bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Refresh2)(VARIANT *Level) override;
530bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Stop)() override;
531bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Application)(IDispatch **ppDisp) override;
532bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Parent)(IDispatch **ppDisp) override;
533bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Container)(IDispatch **ppDisp) override;
534bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Document)(IDispatch **ppDisp) override;
535bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_TopLevelContainer)(VARIANT_BOOL *pBool) override;
536bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Type)(BSTR *Type) override;
537bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Left)(long *pl) override;
538bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Left)(long Left) override;
539bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Top)(long *pl) override;
540bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Top)(long Top) override;
541bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Width)(long *pl) override;
542bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Width)(long Width) override;
543bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Height)(long *pl) override;
544bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Height)(long Height) override;
545bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_LocationName)(BSTR *LocationName) override;
546bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_LocationURL)(BSTR *LocationURL) override;
547bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Busy)(VARIANT_BOOL *pBool) override;
548c2c66affSColin Finck 
549c2c66affSColin Finck     // *** IWebBrowserApp methods ***
550bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Quit)() override;
551bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ClientToWindow)(int *pcx, int *pcy) override;
552bb297bc3SKatayama Hirofumi MZ     STDMETHOD(PutProperty)(BSTR Property, VARIANT vtValue) override;
553bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetProperty)(BSTR Property, VARIANT *pvtValue) override;
554bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Name)(BSTR *Name) override;
555bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_HWND)(SHANDLE_PTR *pHWND) override;
556bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_FullName)(BSTR *FullName) override;
557bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Path)(BSTR *Path) override;
558bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Visible)(VARIANT_BOOL *pBool) override;
559bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Visible)(VARIANT_BOOL Value) override;
560bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_StatusBar)(VARIANT_BOOL *pBool) override;
561bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_StatusBar)(VARIANT_BOOL Value) override;
562bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_StatusText)(BSTR *StatusText) override;
563bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_StatusText)(BSTR StatusText) override;
564bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_ToolBar)(int *Value) override;
565bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_ToolBar)(int Value) override;
566bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_MenuBar)(VARIANT_BOOL *Value) override;
567bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_MenuBar)(VARIANT_BOOL Value) override;
568bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_FullScreen)(VARIANT_BOOL *pbFullScreen) override;
569bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_FullScreen)(VARIANT_BOOL bFullScreen) override;
570c2c66affSColin Finck 
571c2c66affSColin Finck     // *** IWebBrowser2 methods ***
572bb297bc3SKatayama Hirofumi MZ     STDMETHOD(Navigate2)(VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName,
573bb297bc3SKatayama Hirofumi MZ         VARIANT *PostData, VARIANT *Headers) override;
574bb297bc3SKatayama Hirofumi MZ     STDMETHOD(QueryStatusWB)(OLECMDID cmdID, OLECMDF *pcmdf) override;
575bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ExecWB)(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
576bb297bc3SKatayama Hirofumi MZ         VARIANT *pvaIn, VARIANT *pvaOut) override;
577bb297bc3SKatayama Hirofumi MZ     STDMETHOD(ShowBrowserBar)(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize) override;
578bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_ReadyState)(READYSTATE *plReadyState) override;
579bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Offline)(VARIANT_BOOL *pbOffline) override;
580bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Offline)(VARIANT_BOOL bOffline) override;
581bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Silent)(VARIANT_BOOL *pbSilent) override;
582bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Silent)(VARIANT_BOOL bSilent) override;
583bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_RegisterAsBrowser)(VARIANT_BOOL *pbRegister) override;
584bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_RegisterAsBrowser)(VARIANT_BOOL bRegister) override;
585bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_RegisterAsDropTarget)(VARIANT_BOOL *pbRegister) override;
586bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_RegisterAsDropTarget)(VARIANT_BOOL bRegister) override;
587bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_TheaterMode)(VARIANT_BOOL *pbRegister) override;
588bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_TheaterMode)(VARIANT_BOOL bRegister) override;
589bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_AddressBar)(VARIANT_BOOL *Value) override;
590bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_AddressBar)(VARIANT_BOOL Value) override;
591bb297bc3SKatayama Hirofumi MZ     STDMETHOD(get_Resizable)(VARIANT_BOOL *Value) override;
592bb297bc3SKatayama Hirofumi MZ     STDMETHOD(put_Resizable)(VARIANT_BOOL Value) override;
593c2c66affSColin Finck 
594c2c66affSColin Finck     // *** ITravelLogClient methods ***
595bb297bc3SKatayama Hirofumi MZ     STDMETHOD(FindWindowByIndex)(DWORD dwID, IUnknown **ppunk) override;
596bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetWindowData)(IStream *pStream, LPWINDOWDATA pWinData) override;
597bb297bc3SKatayama Hirofumi MZ     STDMETHOD(LoadHistoryPosition)(LPWSTR pszUrlLocation, DWORD dwPosition) override;
598c2c66affSColin Finck 
599c2c66affSColin Finck     // *** IPersist methods ***
600bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetClassID)(CLSID *pClassID) override;
601c2c66affSColin Finck 
602c2c66affSColin Finck     // *** IPersistHistory methods ***
603bb297bc3SKatayama Hirofumi MZ     STDMETHOD(LoadHistory)(IStream *pStream, IBindCtx *pbc) override;
604bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SaveHistory)(IStream *pStream) override;
605bb297bc3SKatayama Hirofumi MZ     STDMETHOD(SetPositionCookie)(DWORD dwPositioncookie) override;
606bb297bc3SKatayama Hirofumi MZ     STDMETHOD(GetPositionCookie)(DWORD *pdwPositioncookie) override;
607c2c66affSColin Finck 
608c2c66affSColin Finck     // message handlers
609c2c66affSColin Finck     LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
610c2c66affSColin Finck     LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
611c2c66affSColin Finck     LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
612c2c66affSColin Finck     LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
613c2c66affSColin Finck     LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
614c2c66affSColin Finck     LRESULT RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
615a882ec7aSKatayama Hirofumi MZ     LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
616*751641c2SWhindmar Saksit     LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
617c2c66affSColin Finck     LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
618c2c66affSColin Finck     LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
619c2c66affSColin Finck     LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
620c2c66affSColin Finck     LRESULT OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
621c2c66affSColin Finck     LRESULT OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
622c2c66affSColin Finck     LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
623c2c66affSColin Finck     LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
624c2c66affSColin Finck     LRESULT OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
625c2c66affSColin Finck     LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
626c2c66affSColin Finck     LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
627281f7c4eSKatayama Hirofumi MZ     LRESULT OnAddToFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
628c2c66affSColin Finck     LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
629c2c66affSColin Finck     LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
630c2c66affSColin Finck     LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
631c2c66affSColin Finck     LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
632c2c66affSColin Finck     LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
633c2c66affSColin Finck     LRESULT OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
634c2c66affSColin Finck     LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
635c2c66affSColin Finck     LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
636c2c66affSColin Finck     LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
637c2c66affSColin Finck     LRESULT OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
638c2c66affSColin Finck     LRESULT OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
639c2c66affSColin Finck     LRESULT RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
6405b78381aSWhindmar Saksit     LRESULT OnCabinetStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
64143b3dc20SCarl J. Bialorucki     LRESULT OnSettingsChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
64243b3dc20SCarl J. Bialorucki     LRESULT OnGetSettingsPtr(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
643ff63d064SKatayama Hirofumi MZ     LRESULT OnAppCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
644c2c66affSColin Finck     HRESULT OnSearch();
645c2c66affSColin Finck 
GetWndClassInfo()646c2c66affSColin Finck     static ATL::CWndClassInfo& GetWndClassInfo()
647c2c66affSColin Finck     {
648c2c66affSColin Finck         static ATL::CWndClassInfo wc =
649c2c66affSColin Finck         {
650c2c66affSColin Finck             { sizeof(WNDCLASSEX), CS_DBLCLKS, StartWindowProc,
651c2c66affSColin Finck               0, 0, NULL, LoadIcon(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_CABINET)),
652c2c66affSColin Finck               LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW + 1), NULL, szCabinetWndClass, NULL },
653c2c66affSColin Finck             NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
654c2c66affSColin Finck         };
655c2c66affSColin Finck         return wc;
656c2c66affSColin Finck     }
657c2c66affSColin Finck 
658c2c66affSColin Finck     BEGIN_MSG_MAP(CShellBrowser)
659c2c66affSColin Finck         MESSAGE_HANDLER(WM_CREATE, OnCreate)
660c2c66affSColin Finck         MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
661c2c66affSColin Finck         MESSAGE_HANDLER(WM_SIZE, OnSize)
662c2c66affSColin Finck         MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup)
663c2c66affSColin Finck         MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
664c2c66affSColin Finck         MESSAGE_HANDLER(WM_MEASUREITEM, RelayMsgToShellView)
665c2c66affSColin Finck         MESSAGE_HANDLER(WM_DRAWITEM, RelayMsgToShellView)
666c2c66affSColin Finck         MESSAGE_HANDLER(WM_MENUSELECT, RelayMsgToShellView)
667a882ec7aSKatayama Hirofumi MZ         MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
668*751641c2SWhindmar Saksit         MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
669c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_FILE_CLOSE, OnClose)
670c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_FOLDEROPTIONS, OnFolderOptions)
671c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_MAPNETWORKDRIVE, OnMapNetworkDrive)
672c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLS_DISCONNECTNETWORKDRIVE, OnDisconnectNetworkDrive)
673c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_HELP_ABOUT, OnAboutReactOS)
674c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_BACK, OnGoBack)
675c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_FORWARD, OnGoForward)
676c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_UPONELEVEL, OnGoUpLevel)
677c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_GOTO_HOMEPAGE, OnGoHome)
678281f7c4eSKatayama Hirofumi MZ         COMMAND_ID_HANDLER(IDM_FAVORITES_ADDTOFAVORITES, OnAddToFavorites)
679c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_FAVORITES_ORGANIZEFAVORITES, OnOrganizeFavorites)
680c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_VIEW_STATUSBAR, OnToggleStatusBarVisible)
681c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_VIEW_REFRESH, OnRefresh)
682c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_LOCKTOOLBARS, OnToggleToolbarLock)
683c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_STANDARDBUTTONS, OnToggleToolbarBandVisible)
684c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_ADDRESSBAR, OnToggleAddressBandVisible)
685c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_LINKSBAR, OnToggleLinksBandVisible)
686c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_TEXTLABELS, OnToggleTextLabels)
687c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_TOOLBARS_CUSTOMIZE, OnToolbarCustomize)
688c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_SEARCH, OnExplorerBar)
689c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FOLDERS, OnExplorerBar)
690c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_HISTORY, OnExplorerBar)
691c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_EXPLORERBAR_FAVORITES, OnExplorerBar)
692c2c66affSColin Finck         COMMAND_ID_HANDLER(IDM_BACKSPACE, OnBackspace)
693c2c66affSColin Finck         COMMAND_RANGE_HANDLER(IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, OnGoTravel)
694c2c66affSColin Finck         COMMAND_RANGE_HANDLER(IDM_EXPLORERBAND_BEGINCUSTOM, IDM_EXPLORERBAND_ENDCUSTOM, OnExplorerBar)
695c2c66affSColin Finck         MESSAGE_HANDLER(WM_COMMAND, RelayCommands)
6965b78381aSWhindmar Saksit         MESSAGE_HANDLER(CWM_STATECHANGE, OnCabinetStateChange)
69743b3dc20SCarl J. Bialorucki         MESSAGE_HANDLER(BWM_SETTINGCHANGE, OnSettingsChange)
69843b3dc20SCarl J. Bialorucki         MESSAGE_HANDLER(BWM_GETSETTINGSPTR, OnGetSettingsPtr)
699ff63d064SKatayama Hirofumi MZ         MESSAGE_HANDLER(WM_APPCOMMAND, OnAppCommand)
700c2c66affSColin Finck     END_MSG_MAP()
701c2c66affSColin Finck 
702c2c66affSColin Finck     BEGIN_CONNECTION_POINT_MAP(CShellBrowser)
703c2c66affSColin Finck         CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
704c2c66affSColin Finck         CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
705c2c66affSColin Finck     END_CONNECTION_POINT_MAP()
706c2c66affSColin Finck 
707c2c66affSColin Finck     BEGIN_COM_MAP(CShellBrowser)
708c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
709c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
710c2c66affSColin Finck         COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
711c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
712c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
713c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
714c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IProfferService, IProfferService)
715c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
716c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
717c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IConnectionPointContainer, IConnectionPointContainer)
718c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser)
719c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowserApp)
720c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IWebBrowser2, IWebBrowser2)
721c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_ITravelLogClient, ITravelLogClient)
722c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
723c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IPersistHistory, IPersistHistory)
724c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
725c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
726c2c66affSColin Finck     END_COM_MAP()
727c2c66affSColin Finck };
728c2c66affSColin Finck 
729c2c66affSColin Finck extern HRESULT CreateProgressDialog(REFIID riid, void **ppv);
730c2c66affSColin Finck 
CShellBrowser()731c2c66affSColin Finck CShellBrowser::CShellBrowser()
732c2c66affSColin Finck {
7335b78381aSWhindmar Saksit     m_BrowserSvcFlags = BSF_RESIZABLE | BSF_CANMAXIMIZE;
7346219a1abSWhindmar Saksit     m_Destroyed = false;
735c2c66affSColin Finck     fCurrentShellViewWindow = NULL;
736c2c66affSColin Finck     fCurrentDirectoryPIDL = NULL;
737c2c66affSColin Finck     fStatusBar = NULL;
738c2c66affSColin Finck     fCurrentMenuBar = NULL;
739c2c66affSColin Finck     fHistoryObject = NULL;
740c2c66affSColin Finck     fHistoryStream = NULL;
741c2c66affSColin Finck     fHistoryBindContext = NULL;
74243b3dc20SCarl J. Bialorucki     m_settings.Load();
743c97c1ad4SWhindmar Saksit     m_deffoldersettings.Load();
744f744bb29SCarl J. Bialorucki     gCabinetState.Load();
7455b78381aSWhindmar Saksit     SetTopBrowser();
746c2c66affSColin Finck }
747c2c66affSColin Finck 
~CShellBrowser()748c2c66affSColin Finck CShellBrowser::~CShellBrowser()
749c2c66affSColin Finck {
750c2c66affSColin Finck     if (menuDsa)
751c2c66affSColin Finck         DSA_Destroy(menuDsa);
752c2c66affSColin Finck }
753c2c66affSColin Finck 
Initialize()75462c33fbfSGiannis Adamopoulos HRESULT CShellBrowser::Initialize()
755c2c66affSColin Finck {
756c2c66affSColin Finck     CComPtr<IPersistStreamInit>             persistStreamInit;
757c2c66affSColin Finck     HRESULT                                 hResult;
758c2c66affSColin Finck     CComPtr<IUnknown> clientBar;
759c2c66affSColin Finck 
760c2c66affSColin Finck     _AtlInitialConstruct();
761c2c66affSColin Finck 
762c2c66affSColin Finck     menuDsa = DSA_Create(sizeof(MenuBandInfo), 5);
763c2c66affSColin Finck     if (!menuDsa)
764c2c66affSColin Finck         return E_OUTOFMEMORY;
765c2c66affSColin Finck 
766c2c66affSColin Finck     // create window
767c2c66affSColin Finck     Create(HWND_DESKTOP);
768c2c66affSColin Finck     if (m_hWnd == NULL)
769c2c66affSColin Finck         return E_FAIL;
770c2c66affSColin Finck 
771c2c66affSColin Finck     hResult = CInternetToolbar_CreateInstance(IID_PPV_ARG(IUnknown, &clientBar));
772c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
773c2c66affSColin Finck         return hResult;
774c2c66affSColin Finck 
775c2c66affSColin Finck     fClientBars[BIInternetToolbar].clientBar = clientBar;
776c2c66affSColin Finck 
777c2c66affSColin Finck     // create interfaces
778c2c66affSColin Finck     hResult = clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
779c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
780c2c66affSColin Finck         return hResult;
781c2c66affSColin Finck 
782c2c66affSColin Finck     hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
783c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
784c2c66affSColin Finck         return hResult;
785c2c66affSColin Finck 
786c2c66affSColin Finck     hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
787c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
788c2c66affSColin Finck         return hResult;
789c2c66affSColin Finck 
790674136bcSWhindmar Saksit     CComPtr<IStream> pITBarStream;
791674136bcSWhindmar Saksit     hResult = CInternetToolbar::GetStream(ITBARSTREAM_EXPLORER, STGM_READ, &pITBarStream);
792674136bcSWhindmar Saksit     hResult = SUCCEEDED(hResult) ? persistStreamInit->Load(pITBarStream) : persistStreamInit->InitNew();
793c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
794c2c66affSColin Finck         return hResult;
795c2c66affSColin Finck 
796c2c66affSColin Finck     hResult = IUnknown_ShowDW(clientBar, TRUE);
797c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
798c2c66affSColin Finck         return hResult;
799c2c66affSColin Finck 
800c2c66affSColin Finck     fToolbarProxy.Initialize(m_hWnd, clientBar);
801c2c66affSColin Finck 
802c2c66affSColin Finck     // create status bar
803bfadb22dSCarl J. Bialorucki     DWORD dwStatusStyle = WS_CHILD | WS_CLIPSIBLINGS | SBARS_SIZEGRIP | SBARS_TOOLTIPS;
80443b3dc20SCarl J. Bialorucki     if (m_settings.fStatusBarVisible)
805bfadb22dSCarl J. Bialorucki         dwStatusStyle |= WS_VISIBLE;
806bfadb22dSCarl J. Bialorucki     fStatusBar = ::CreateWindowExW(0, STATUSCLASSNAMEW, NULL, dwStatusStyle,
807bfadb22dSCarl J. Bialorucki                                    0, 0, 500, 20, m_hWnd, (HMENU)IDC_STATUSBAR,
808c2c66affSColin Finck                                    _AtlBaseModule.GetModuleInstance(), 0);
809c2c66affSColin Finck 
810c2c66affSColin Finck     ShowWindow(SW_SHOWNORMAL);
81162c33fbfSGiannis Adamopoulos     UpdateWindow();
812c2c66affSColin Finck 
813c2c66affSColin Finck     return S_OK;
814c2c66affSColin Finck }
815c2c66affSColin Finck 
ApplyBrowserDefaultFolderSettings(IShellView * pvs)816c97c1ad4SWhindmar Saksit HRESULT CShellBrowser::ApplyBrowserDefaultFolderSettings(IShellView *pvs)
817c97c1ad4SWhindmar Saksit {
818c97c1ad4SWhindmar Saksit     HRESULT hr;
819c97c1ad4SWhindmar Saksit     if (pvs)
820c97c1ad4SWhindmar Saksit     {
821c97c1ad4SWhindmar Saksit         m_settings.Save();
822c97c1ad4SWhindmar Saksit         SBFOLDERSETTINGS &sbfs = m_deffoldersettings, defsbfs;
823c97c1ad4SWhindmar Saksit         if (FAILED(pvs->GetCurrentInfo(&sbfs.FolderSettings)))
824c97c1ad4SWhindmar Saksit         {
825c97c1ad4SWhindmar Saksit             defsbfs.InitializeDefaults();
826c97c1ad4SWhindmar Saksit             sbfs = defsbfs;
827c97c1ad4SWhindmar Saksit         }
828c97c1ad4SWhindmar Saksit         hr = CGlobalFolderSettings::SaveBrowserSettings(sbfs);
829c97c1ad4SWhindmar Saksit     }
830c97c1ad4SWhindmar Saksit     else
831c97c1ad4SWhindmar Saksit     {
832c97c1ad4SWhindmar Saksit         m_settings.Reset();
833c97c1ad4SWhindmar Saksit         hr = CGlobalFolderSettings::ResetBrowserSettings();
834802dc971SWhindmar Saksit         if (SUCCEEDED(hr))
835802dc971SWhindmar Saksit             m_deffoldersettings.Load();
836c97c1ad4SWhindmar Saksit     }
837c97c1ad4SWhindmar Saksit     return hr;
838c97c1ad4SWhindmar Saksit }
839c97c1ad4SWhindmar Saksit 
ApplyNewBrowserFlag(UINT Flags)8405b78381aSWhindmar Saksit UINT CShellBrowser::ApplyNewBrowserFlag(UINT Flags)
8415b78381aSWhindmar Saksit {
8425b78381aSWhindmar Saksit     if ((Flags & (SBSP_SAMEBROWSER | SBSP_NEWBROWSER)) == SBSP_DEFBROWSER)
8435b78381aSWhindmar Saksit     {
8445b78381aSWhindmar Saksit         if (!fCurrentDirectoryPIDL || IsControlWindowShown(FCW_TREE, NULL) == S_OK)
8455b78381aSWhindmar Saksit             Flags |= SBSP_SAMEBROWSER; // Force if this is the first navigation or the folder tree is present
8465b78381aSWhindmar Saksit         else
8475b78381aSWhindmar Saksit             Flags |= (!!gCabinetState.fNewWindowMode) ^ (GetAsyncKeyState(VK_CONTROL) < 0) ? SBSP_NEWBROWSER : SBSP_SAMEBROWSER;
8485b78381aSWhindmar Saksit     }
8495b78381aSWhindmar Saksit     if (Flags & (SBSP_NAVIGATEBACK | SBSP_NAVIGATEFORWARD))
8505b78381aSWhindmar Saksit         Flags = (Flags & ~SBSP_NEWBROWSER) | SBSP_SAMEBROWSER; // Force same browser for now
8515b78381aSWhindmar Saksit     return Flags;
8525b78381aSWhindmar Saksit }
8535b78381aSWhindmar Saksit 
OpenNewBrowserWindow(LPCITEMIDLIST pidl,UINT SbspFlags)8545b78381aSWhindmar Saksit HRESULT CShellBrowser::OpenNewBrowserWindow(LPCITEMIDLIST pidl, UINT SbspFlags)
8555b78381aSWhindmar Saksit {
8565b78381aSWhindmar Saksit     SaveITBarLayout(); // Do this now so the new window inherits the current layout
8575b78381aSWhindmar Saksit     // TODO: www.geoffchappell.com/studies/windows/ie/shdocvw/interfaces/inotifyappstart.htm
8585b78381aSWhindmar Saksit     DWORD flags = (SbspFlags & SBSP_EXPLOREMODE) ? SH_EXPLORER_CMDLINE_FLAG_E : 0;
8595b78381aSWhindmar Saksit     if ((SbspFlags & (SBSP_OPENMODE | SBSP_EXPLOREMODE)) == SBSP_DEFMODE)
8605b78381aSWhindmar Saksit         flags |= IsControlWindowShown(FCW_TREE, NULL) == S_OK ? SH_EXPLORER_CMDLINE_FLAG_E : 0;
8615b78381aSWhindmar Saksit     LPITEMIDLIST pidlDir;
8625b78381aSWhindmar Saksit     HRESULT hr = SHILClone(pidl, &pidlDir);
8635b78381aSWhindmar Saksit     if (FAILED(hr))
8645b78381aSWhindmar Saksit         return hr;
8655b78381aSWhindmar Saksit     // TODO: !SBSP_NOTRANSFERHIST means we are supposed to pass the history here somehow?
8665b78381aSWhindmar Saksit     return SHOpenNewFrame(pidlDir, NULL, 0, flags | SH_EXPLORER_CMDLINE_FLAG_NEWWND | SH_EXPLORER_CMDLINE_FLAG_NOREUSE);
8675b78381aSWhindmar Saksit }
8685b78381aSWhindmar Saksit 
CreateRelativeBrowsePIDL(LPCITEMIDLIST relative,UINT SbspFlags,LPITEMIDLIST * ppidl)8695b78381aSWhindmar Saksit HRESULT CShellBrowser::CreateRelativeBrowsePIDL(LPCITEMIDLIST relative, UINT SbspFlags, LPITEMIDLIST *ppidl)
8705b78381aSWhindmar Saksit {
8715b78381aSWhindmar Saksit     if (SbspFlags & SBSP_RELATIVE)
8725b78381aSWhindmar Saksit         return SHILCombine(fCurrentDirectoryPIDL, relative, ppidl);
8735b78381aSWhindmar Saksit 
8745b78381aSWhindmar Saksit     if (SbspFlags & SBSP_PARENT)
8755b78381aSWhindmar Saksit     {
8765b78381aSWhindmar Saksit         HRESULT hr = GetPidl(ppidl);
8775b78381aSWhindmar Saksit         if (FAILED(hr))
8785b78381aSWhindmar Saksit             return hr;
8795b78381aSWhindmar Saksit         ILRemoveLastID(*ppidl);
8805b78381aSWhindmar Saksit         return S_OK;
8815b78381aSWhindmar Saksit     }
8825b78381aSWhindmar Saksit     // TODO: SBSP_NAVIGATEBACK and SBSP_NAVIGATEFORWARD?
8835b78381aSWhindmar Saksit     return E_UNEXPECTED;
8845b78381aSWhindmar Saksit }
8855b78381aSWhindmar Saksit 
BrowseToPIDL(LPCITEMIDLIST pidl,long flags)886c2c66affSColin Finck HRESULT CShellBrowser::BrowseToPIDL(LPCITEMIDLIST pidl, long flags)
887c2c66affSColin Finck {
888c2c66affSColin Finck     CComPtr<IShellFolder>   newFolder;
889c97c1ad4SWhindmar Saksit     FOLDERSETTINGS          newFolderSettings = m_deffoldersettings.FolderSettings;
890c2c66affSColin Finck     HRESULT                 hResult;
891d70e7989SCarl J. Bialorucki     CLSID                   clsid;
892d70e7989SCarl J. Bialorucki     BOOL                    HasIconViewType;
893c2c66affSColin Finck 
894c2c66affSColin Finck     // called by shell view to browse to new folder
895c2c66affSColin Finck     // also called by explorer band to navigate to new folder
896c2c66affSColin Finck     hResult = SHBindToFolder(pidl, &newFolder);
897c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
898c2c66affSColin Finck         return hResult;
899d70e7989SCarl J. Bialorucki     // HACK & FIXME: Get view mode from shellbag when fully implemented.
900d70e7989SCarl J. Bialorucki     IUnknown_GetClassID(newFolder, &clsid);
901d70e7989SCarl J. Bialorucki     HasIconViewType = clsid == CLSID_MyComputer || clsid == CLSID_ControlPanel ||
902d70e7989SCarl J. Bialorucki                       clsid == CLSID_ShellDesktop;
903c2c66affSColin Finck 
904d70e7989SCarl J. Bialorucki     if (HasIconViewType)
905c2c66affSColin Finck         newFolderSettings.ViewMode = FVM_ICON;
906c2c66affSColin Finck     hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
907c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
908c2c66affSColin Finck         return hResult;
909c2c66affSColin Finck     return S_OK;
910c2c66affSColin Finck }
911c2c66affSColin Finck 
_ILIsPidlSimple(LPCITEMIDLIST pidl)912c2c66affSColin Finck BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
913c2c66affSColin Finck {
914c2c66affSColin Finck     LPCITEMIDLIST                           pidlnext;
915c2c66affSColin Finck     WORD                                    length;
916c2c66affSColin Finck     BOOL                                    ret;
917c2c66affSColin Finck 
918c2c66affSColin Finck     ret = TRUE;
919c2c66affSColin Finck     if (! _ILIsDesktop(pidl))
920c2c66affSColin Finck     {
921c2c66affSColin Finck         length = pidl->mkid.cb;
922c2c66affSColin Finck         pidlnext =
923c2c66affSColin Finck             reinterpret_cast<LPCITEMIDLIST>(
924c2c66affSColin Finck                 reinterpret_cast<const BYTE *>(pidl) + length);
925c2c66affSColin Finck         if (pidlnext->mkid.cb != 0)
926c2c66affSColin Finck             ret = FALSE;
927c2c66affSColin Finck     }
928c2c66affSColin Finck     return ret;
929c2c66affSColin Finck }
930c2c66affSColin Finck 
SHBindToFolderIDListParent(IShellFolder * unused,LPCITEMIDLIST pidl,const IID * riid,LPVOID * ppv,LPITEMIDLIST * ppidlLast)931c2c66affSColin Finck HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *unused, LPCITEMIDLIST pidl,
932c2c66affSColin Finck     const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
933c2c66affSColin Finck {
934c2c66affSColin Finck     CComPtr<IShellFolder>                   psf;
935c2c66affSColin Finck     LPITEMIDLIST                            pidlChild;
936c2c66affSColin Finck     LPITEMIDLIST                            pidlParent;
937c2c66affSColin Finck     HRESULT                                 hResult;
938c2c66affSColin Finck 
939c2c66affSColin Finck     hResult = E_FAIL;
940c2c66affSColin Finck     if (ppv == NULL)
941c2c66affSColin Finck         return E_POINTER;
942c2c66affSColin Finck     *ppv = NULL;
943c2c66affSColin Finck     if (ppidlLast != NULL)
944c2c66affSColin Finck         *ppidlLast = NULL;
945c2c66affSColin Finck     if (_ILIsPidlSimple(pidl))
946c2c66affSColin Finck     {
947c2c66affSColin Finck         if (ppidlLast != NULL)
948c2c66affSColin Finck             *ppidlLast = ILClone(pidl);
949c2c66affSColin Finck         hResult = SHGetDesktopFolder((IShellFolder **)ppv);
950c2c66affSColin Finck     }
951c2c66affSColin Finck     else
952c2c66affSColin Finck     {
953c2c66affSColin Finck         pidlChild = ILClone(ILFindLastID(pidl));
954c2c66affSColin Finck         pidlParent = ILClone(pidl);
955c2c66affSColin Finck         ILRemoveLastID(pidlParent);
956c2c66affSColin Finck         hResult = SHGetDesktopFolder(&psf);
957c2c66affSColin Finck         if (SUCCEEDED(hResult))
958c2c66affSColin Finck             hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
959c2c66affSColin Finck         if (SUCCEEDED(hResult) && ppidlLast != NULL)
960c2c66affSColin Finck             *ppidlLast = pidlChild;
961c2c66affSColin Finck         else
962c2c66affSColin Finck             ILFree(pidlChild);
963c2c66affSColin Finck         ILFree(pidlParent);
964c2c66affSColin Finck     }
965c2c66affSColin Finck     return hResult;
966c2c66affSColin Finck }
967c2c66affSColin Finck 
IEGetNameAndFlagsEx(LPITEMIDLIST pidl,SHGDNF uFlags,long param10,LPWSTR pszBuf,UINT cchBuf,SFGAOF * rgfInOut)968c2c66affSColin Finck HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10,
969c2c66affSColin Finck     LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
970c2c66affSColin Finck {
971c2c66affSColin Finck     CComPtr<IShellFolder>                   parentFolder;
972c2c66affSColin Finck     LPITEMIDLIST                            childPIDL = NULL;
973c2c66affSColin Finck     STRRET                                  L108;
974c2c66affSColin Finck     HRESULT                                 hResult;
975c2c66affSColin Finck 
976c2c66affSColin Finck     hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
977c2c66affSColin Finck     if (FAILED(hResult))
978c2c66affSColin Finck         goto cleanup;
979c2c66affSColin Finck 
980c2c66affSColin Finck     hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
981c2c66affSColin Finck     if (FAILED(hResult))
982c2c66affSColin Finck         goto cleanup;
983c2c66affSColin Finck 
984c2c66affSColin Finck     StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
985c2c66affSColin Finck     if (rgfInOut)
986c2c66affSColin Finck     {
987c2c66affSColin Finck         hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
988c2c66affSColin Finck         if (FAILED(hResult))
989c2c66affSColin Finck             goto cleanup;
990c2c66affSColin Finck     }
991c2c66affSColin Finck 
992c2c66affSColin Finck     hResult = S_OK;
993c2c66affSColin Finck 
994c2c66affSColin Finck cleanup:
995c2c66affSColin Finck     if (childPIDL)
996c2c66affSColin Finck         ILFree(childPIDL);
997c2c66affSColin Finck     return hResult;
998c2c66affSColin Finck }
999c2c66affSColin Finck 
IEGetNameAndFlags(LPITEMIDLIST pidl,SHGDNF uFlags,LPWSTR pszBuf,UINT cchBuf,SFGAOF * rgfInOut)1000f744bb29SCarl J. Bialorucki HRESULT IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
1001c2c66affSColin Finck {
1002c2c66affSColin Finck     return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
1003c2c66affSColin Finck }
1004c2c66affSColin Finck 
SaveViewState()1005802dc971SWhindmar Saksit void CShellBrowser::SaveViewState()
1006802dc971SWhindmar Saksit {
1007802dc971SWhindmar Saksit     // TODO: Also respect EBO_NOPERSISTVIEWSTATE?
1008802dc971SWhindmar Saksit     if (gCabinetState.fSaveLocalView && fCurrentShellView && !SHRestricted(REST_NOSAVESET))
1009802dc971SWhindmar Saksit         fCurrentShellView->SaveViewState();
1010802dc971SWhindmar Saksit }
1011802dc971SWhindmar Saksit 
BrowseToPath(IShellFolder * newShellFolder,LPCITEMIDLIST absolutePIDL,FOLDERSETTINGS * folderSettings,long flags)1012c2c66affSColin Finck HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
1013c2c66affSColin Finck     LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
1014c2c66affSColin Finck {
1015c2c66affSColin Finck     CComPtr<IShellFolder>                   saveCurrentShellFolder;
1016c2c66affSColin Finck     CComPtr<IShellView>                     saveCurrentShellView;
1017c2c66affSColin Finck     CComPtr<IShellView>                     newShellView;
1018c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1019c2c66affSColin Finck     HWND                                    newShellViewWindow;
1020c2c66affSColin Finck     BOOL                                    windowUpdateIsLocked;
1021c2c66affSColin Finck     RECT                                    shellViewWindowBounds;
1022c2c66affSColin Finck     HWND                                    previousView;
1023c2c66affSColin Finck     HCURSOR                                 saveCursor;
1024c2c66affSColin Finck     wchar_t                                 newTitle[MAX_PATH];
1025c2c66affSColin Finck     SHGDNF                                  nameFlags;
1026c2c66affSColin Finck     HRESULT                                 hResult;
10275b78381aSWhindmar Saksit     //TODO: BOOL                            nohistory = m_BrowserSvcFlags & BSF_NAVNOHISTORY;
1028c2c66affSColin Finck 
10296219a1abSWhindmar Saksit     if (m_Destroyed)
10306219a1abSWhindmar Saksit         return S_FALSE;
10316219a1abSWhindmar Saksit 
1032c2c66affSColin Finck     if (newShellFolder == NULL)
1033c2c66affSColin Finck         return E_INVALIDARG;
1034c2c66affSColin Finck 
1035c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
1036c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1037c2c66affSColin Finck         return hResult;
1038c2c66affSColin Finck 
10391061e7f7SWhindmar Saksit     if (FAILED_UNEXPECTEDLY(hResult = SHILClone(absolutePIDL, &absolutePIDL)))
10401061e7f7SWhindmar Saksit         return hResult;
10411061e7f7SWhindmar Saksit     CComHeapPtr<ITEMIDLIST> pidlAbsoluteClone(const_cast<LPITEMIDLIST>(absolutePIDL));
10421061e7f7SWhindmar Saksit 
1043c2c66affSColin Finck     // update history
1044c2c66affSColin Finck     if (flags & BTP_UPDATE_CUR_HISTORY)
1045c2c66affSColin Finck     {
1046c2c66affSColin Finck         if (travelLog->CountEntries(static_cast<IDropTarget *>(this)) > 0)
1047c2c66affSColin Finck             hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1048c2c66affSColin Finck         // what to do with error? Do we want to halt browse because state save failed?
1049c2c66affSColin Finck     }
1050c2c66affSColin Finck 
1051c2c66affSColin Finck     if (fCurrentShellView)
1052c2c66affSColin Finck     {
1053802dc971SWhindmar Saksit         SaveViewState();
1054c2c66affSColin Finck         fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
1055c2c66affSColin Finck     }
1056c2c66affSColin Finck 
1057c2c66affSColin Finck     // create view object
1058c2c66affSColin Finck     hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
1059c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1060c2c66affSColin Finck         return hResult;
1061c2c66affSColin Finck     previousView = fCurrentShellViewWindow;
1062c2c66affSColin Finck 
1063c2c66affSColin Finck     // enter updating section
1064c2c66affSColin Finck     saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
1065c2c66affSColin Finck     windowUpdateIsLocked = LockWindowUpdate(TRUE);
1066c2c66affSColin Finck     if (fCurrentShellView != NULL)
1067c2c66affSColin Finck         ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0);
1068c2c66affSColin Finck 
1069c2c66affSColin Finck     // set site
1070c2c66affSColin Finck     hResult = IUnknown_SetSite(newShellView, static_cast<IDropTarget *>(this));
1071c2c66affSColin Finck 
1072c2c66affSColin Finck     // update folder and view
1073c2c66affSColin Finck     saveCurrentShellFolder = fCurrentShellFolder;
1074c2c66affSColin Finck     saveCurrentShellView = fCurrentShellView;
1075c2c66affSColin Finck     fCurrentShellFolder = newShellFolder;
1076c2c66affSColin Finck     fCurrentShellView = newShellView;
1077c2c66affSColin Finck 
1078c2c66affSColin Finck     // get boundary
1079c2c66affSColin Finck     if (previousView != NULL)
1080c2c66affSColin Finck         ::GetWindowRect(previousView, &shellViewWindowBounds);
1081c2c66affSColin Finck     else
1082c2c66affSColin Finck         ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
1083c2c66affSColin Finck     ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
1084c2c66affSColin Finck 
1085ca087b6aSMark Jansen     // update current pidl
1086ca087b6aSMark Jansen     ILFree(fCurrentDirectoryPIDL);
10871061e7f7SWhindmar Saksit     fCurrentDirectoryPIDL = pidlAbsoluteClone.Detach();
10881061e7f7SWhindmar Saksit     /* CORE-19697: CAddressEditBox::OnWinEvent(CBN_SELCHANGE) causes CAddressEditBox to
10891061e7f7SWhindmar Saksit      * call BrowseObject(pidlLastParsed). As part of our browsing we call FireNavigateComplete
10901061e7f7SWhindmar Saksit      * and this in turn causes CAddressEditBox::Invoke to ILFree(pidlLastParsed)!
10911061e7f7SWhindmar Saksit      * We then call SHBindToParent on absolutePIDL (which is really (the now invalid) pidlLastParsed) and we
10921061e7f7SWhindmar Saksit      * end up accessing invalid memory! We therefore set absolutePIDL to be our cloned PIDL here.
10931061e7f7SWhindmar Saksit      */
10941061e7f7SWhindmar Saksit     absolutePIDL = fCurrentDirectoryPIDL;
1095ca087b6aSMark Jansen 
1096c2c66affSColin Finck     // create view window
1097c2c66affSColin Finck     hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
1098c2c66affSColin Finck         this, &shellViewWindowBounds, &newShellViewWindow);
1099c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult) || newShellViewWindow == NULL)
1100c2c66affSColin Finck     {
1101c2c66affSColin Finck         fCurrentShellView = saveCurrentShellView;
1102c2c66affSColin Finck         fCurrentShellFolder = saveCurrentShellFolder;
1103c2c66affSColin Finck         ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 1, 0);
1104c2c66affSColin Finck         if (windowUpdateIsLocked)
1105c2c66affSColin Finck             LockWindowUpdate(FALSE);
1106c2c66affSColin Finck         SetCursor(saveCursor);
1107c2c66affSColin Finck         return hResult;
1108c2c66affSColin Finck     }
1109c2c66affSColin Finck 
1110c2c66affSColin Finck     // update view window
1111c2c66affSColin Finck     if (saveCurrentShellView != NULL)
1112c2c66affSColin Finck         saveCurrentShellView->DestroyViewWindow();
1113c2c66affSColin Finck     fCurrentShellViewWindow = newShellViewWindow;
1114c2c66affSColin Finck 
111562c33fbfSGiannis Adamopoulos     if (previousView == NULL)
111662c33fbfSGiannis Adamopoulos     {
111762c33fbfSGiannis Adamopoulos         RepositionBars();
111862c33fbfSGiannis Adamopoulos     }
111962c33fbfSGiannis Adamopoulos 
1120c2c66affSColin Finck     // no use
1121c2c66affSColin Finck     saveCurrentShellView.Release();
1122c2c66affSColin Finck     saveCurrentShellFolder.Release();
1123c2c66affSColin Finck 
11245b78381aSWhindmar Saksit     hResult = newShellView->UIActivate((flags & BTP_ACTIVATE_NOFOCUS) ? SVUIA_ACTIVATE_NOFOCUS : SVUIA_ACTIVATE_FOCUS);
1125c2c66affSColin Finck 
1126c2c66affSColin Finck     // leave updating section
1127c2c66affSColin Finck     if (windowUpdateIsLocked)
1128c2c66affSColin Finck         LockWindowUpdate(FALSE);
1129c2c66affSColin Finck     SetCursor(saveCursor);
1130c2c66affSColin Finck 
1131c2c66affSColin Finck     // update history
1132c2c66affSColin Finck     if (flags & BTP_UPDATE_NEXT_HISTORY)
1133c2c66affSColin Finck     {
1134c2c66affSColin Finck         hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1135c2c66affSColin Finck         hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1136c2c66affSColin Finck     }
1137c2c66affSColin Finck 
1138c2c66affSColin Finck     // completed
1139c2c66affSColin Finck     nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1140c2c66affSColin Finck     hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1141c2c66affSColin Finck         sizeof(newTitle) / sizeof(wchar_t), NULL);
1142c2c66affSColin Finck     if (SUCCEEDED(hResult))
1143c2c66affSColin Finck     {
1144c2c66affSColin Finck         FireNavigateComplete(newTitle);
1145c2c66affSColin Finck     }
1146c2c66affSColin Finck     else
1147c2c66affSColin Finck     {
1148c2c66affSColin Finck         FireNavigateComplete(L"ERROR");
1149c2c66affSColin Finck     }
1150c2c66affSColin Finck 
1151f744bb29SCarl J. Bialorucki     UpdateWindowTitle();
1152c2c66affSColin Finck 
1153c2c66affSColin Finck     LPCITEMIDLIST pidlChild;
1154c2c66affSColin Finck     INT index, indexOpen;
1155c2c66affSColin Finck     HIMAGELIST himlSmall, himlLarge;
1156c2c66affSColin Finck 
1157c2c66affSColin Finck     CComPtr<IShellFolder> sf;
1158c2c66affSColin Finck     hResult = SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1159c2c66affSColin Finck     if (SUCCEEDED(hResult))
1160c2c66affSColin Finck     {
1161c2c66affSColin Finck         index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1162c2c66affSColin Finck 
1163c2c66affSColin Finck         Shell_GetImageLists(&himlLarge, &himlSmall);
1164c2c66affSColin Finck 
1165c2c66affSColin Finck         HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1166c2c66affSColin Finck         HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1167c2c66affSColin Finck 
1168c2c66affSColin Finck         /* Hack to make it possible to release the old icons */
1169c2c66affSColin Finck         /* Something seems to go wrong with WM_SETICON */
1170c2c66affSColin Finck         HICON oldSmall = (HICON)SendMessage(WM_GETICON, ICON_SMALL, 0);
1171c2c66affSColin Finck         HICON oldLarge = (HICON)SendMessage(WM_GETICON, ICON_BIG,   0);
1172c2c66affSColin Finck 
1173c2c66affSColin Finck         SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1174c2c66affSColin Finck         SendMessage(WM_SETICON, ICON_BIG,   reinterpret_cast<LPARAM>(icLarge));
1175c2c66affSColin Finck 
1176c2c66affSColin Finck         DestroyIcon(oldSmall);
1177c2c66affSColin Finck         DestroyIcon(oldLarge);
1178c2c66affSColin Finck     }
1179c2c66affSColin Finck 
1180c2c66affSColin Finck     FireCommandStateChangeAll();
1181c2c66affSColin Finck     hResult = UpdateForwardBackState();
1182c2c66affSColin Finck     hResult = UpdateUpState();
1183c2c66affSColin Finck     return S_OK;
1184c2c66affSColin Finck }
1185c2c66affSColin Finck 
GetMenuBand(REFIID riid,void ** shellMenu)1186c2c66affSColin Finck HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
1187c2c66affSColin Finck {
1188c2c66affSColin Finck     CComPtr<IBandSite>                      bandSite;
1189c2c66affSColin Finck     CComPtr<IDeskBand>                      deskBand;
1190c2c66affSColin Finck     HRESULT                                 hResult;
1191c2c66affSColin Finck 
1192c2c66affSColin Finck     if (!fClientBars[BIInternetToolbar].clientBar)
1193c2c66affSColin Finck         return E_FAIL;
1194c2c66affSColin Finck 
1195c2c66affSColin Finck     hResult = IUnknown_QueryService(fClientBars[BIInternetToolbar].clientBar, SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
1196c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1197c2c66affSColin Finck         return hResult;
1198c2c66affSColin Finck 
1199c2c66affSColin Finck     hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1200c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1201c2c66affSColin Finck         return hResult;
1202c2c66affSColin Finck 
1203c2c66affSColin Finck     return deskBand->QueryInterface(riid, shellMenu);
1204c2c66affSColin Finck }
1205c2c66affSColin Finck 
GetBaseBar(bool vertical,REFIID riid,void ** theBaseBar)1206c2c66affSColin Finck HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
1207c2c66affSColin Finck {
1208c2c66affSColin Finck     CComPtr<IUnknown>                       newBaseBar;
1209c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1210c2c66affSColin Finck     CComPtr<IUnknown>                       newBaseBarSite;
1211c2c66affSColin Finck     CComPtr<IDeskBarClient>                 deskBarClient;
1212c2c66affSColin Finck     IUnknown                                **cache;
1213c2c66affSColin Finck     HRESULT                                 hResult;
1214c2c66affSColin Finck 
1215c2c66affSColin Finck     if (vertical)
1216c2c66affSColin Finck         cache = &fClientBars[BIVerticalBaseBar].clientBar.p;
1217c2c66affSColin Finck     else
1218c2c66affSColin Finck         cache = &fClientBars[BIHorizontalBaseBar].clientBar.p;
1219c2c66affSColin Finck     if (*cache == NULL)
1220c2c66affSColin Finck     {
1221c2c66affSColin Finck         hResult = CBaseBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBar), vertical);
1222c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1223c2c66affSColin Finck             return hResult;
1224c2c66affSColin Finck         hResult = CBaseBarSite_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBarSite), vertical);
1225c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1226c2c66affSColin Finck             return hResult;
1227c2c66affSColin Finck 
1228c2c66affSColin Finck         // we have to store our basebar into cache now
1229c2c66affSColin Finck         *cache = newBaseBar;
1230cd2d2841SMark Jansen         (*cache)->AddRef();
1231c2c66affSColin Finck 
1232c2c66affSColin Finck         // tell the new base bar about the shell browser
1233c2c66affSColin Finck         hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
1234c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1235c2c66affSColin Finck             return hResult;
1236c2c66affSColin Finck 
1237c2c66affSColin Finck         // tell the new base bar about the new base bar site
1238c2c66affSColin Finck         hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1239c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1240c2c66affSColin Finck             return hResult;
1241c2c66affSColin Finck         hResult = deskBar->SetClient(newBaseBarSite);
1242c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1243c2c66affSColin Finck             return hResult;
1244c2c66affSColin Finck 
1245c2c66affSColin Finck         // tell the new base bar site about the new base bar
1246c2c66affSColin Finck         hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1247c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1248c2c66affSColin Finck             return hResult;
1249c2c66affSColin Finck         hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1250c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1251c2c66affSColin Finck             return hResult;
1252c2c66affSColin Finck 
1253c2c66affSColin Finck     }
1254c2c66affSColin Finck     return (*cache)->QueryInterface(riid, theBaseBar);
1255c2c66affSColin Finck }
1256c2c66affSColin Finck 
IsBandLoaded(const CLSID clsidBand,bool vertical,DWORD * pdwBandID)1257c2c66affSColin Finck BOOL CShellBrowser::IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID)
1258c2c66affSColin Finck {
1259c2c66affSColin Finck     HRESULT                                 hResult;
1260c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1261c2c66affSColin Finck     CComPtr<IUnknown>                       baseBarSite;
1262c2c66affSColin Finck     CComPtr<IBandSite>                      bandSite;
1263c2c66affSColin Finck     CLSID                                   clsidTmp;
1264c2c66affSColin Finck     DWORD                                   numBands;
1265c2c66affSColin Finck     DWORD                                   dwBandID;
1266c2c66affSColin Finck     DWORD                                   i;
1267c2c66affSColin Finck 
1268c2c66affSColin Finck     /* Get our basebarsite to be able to enumerate bands */
1269c2c66affSColin Finck     hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1270c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1271c2c66affSColin Finck         return FALSE;
1272c2c66affSColin Finck     hResult = deskBar->GetClient(&baseBarSite);
1273c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1274c2c66affSColin Finck         return FALSE;
1275c2c66affSColin Finck     hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &bandSite));
1276c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1277c2c66affSColin Finck         return FALSE;
1278c2c66affSColin Finck 
1279c2c66affSColin Finck     hResult = bandSite->EnumBands(-1, &numBands);
1280c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1281c2c66affSColin Finck         return FALSE;
1282c2c66affSColin Finck 
1283c2c66affSColin Finck     for(i = 0; i < numBands; i++)
1284c2c66affSColin Finck     {
1285c2c66affSColin Finck         CComPtr<IPersist> bandPersist;
1286c2c66affSColin Finck 
1287c2c66affSColin Finck         hResult = bandSite->EnumBands(i, &dwBandID);
1288c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1289c2c66affSColin Finck             return FALSE;
1290c2c66affSColin Finck 
1291c2c66affSColin Finck         hResult = bandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &bandPersist));
1292c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1293c2c66affSColin Finck             return FALSE;
1294c2c66affSColin Finck         hResult = bandPersist->GetClassID(&clsidTmp);
1295c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1296c2c66affSColin Finck             return FALSE;
1297c2c66affSColin Finck         if (IsEqualGUID(clsidBand, clsidTmp))
1298c2c66affSColin Finck         {
1299c2c66affSColin Finck             if (pdwBandID) *pdwBandID = dwBandID;
1300c2c66affSColin Finck             return TRUE;
1301c2c66affSColin Finck         }
1302c2c66affSColin Finck     }
1303c2c66affSColin Finck     return FALSE;
1304c2c66affSColin Finck }
1305c2c66affSColin Finck 
ShowBand(const CLSID & classID,bool vertical)1306c2c66affSColin Finck HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1307c2c66affSColin Finck {
1308c2c66affSColin Finck     CComPtr<IDockingWindow>                 dockingWindow;
1309c2c66affSColin Finck     CComPtr<IUnknown>                       baseBarSite;
1310c2c66affSColin Finck     CComPtr<IUnknown>                       newBand;
1311c2c66affSColin Finck     CComPtr<IDeskBar>                       deskBar;
1312c2c66affSColin Finck     VARIANT                                 vaIn;
1313c2c66affSColin Finck     HRESULT                                 hResult;
1314c2c66affSColin Finck     DWORD                                   dwBandID;
1315c2c66affSColin Finck 
1316c2c66affSColin Finck     hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1317c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1318c2c66affSColin Finck         return hResult;
1319c2c66affSColin Finck 
1320c2c66affSColin Finck     hResult = deskBar->GetClient(&baseBarSite);
1321c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1322c2c66affSColin Finck         return hResult;
1323c2c66affSColin Finck 
1324c2c66affSColin Finck     hResult = deskBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1325c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1326c2c66affSColin Finck         return hResult;
1327c2c66affSColin Finck 
1328c2c66affSColin Finck     if (!IsBandLoaded(classID, vertical, &dwBandID))
1329c2c66affSColin Finck     {
1330c2c66affSColin Finck         TRACE("ShowBand called for CLSID %s, vertical=%d...\n", wine_dbgstr_guid(&classID), vertical);
1331c2c66affSColin Finck         if (IsEqualCLSID(CLSID_ExplorerBand, classID))
1332c2c66affSColin Finck         {
1333c2c66affSColin Finck             TRACE("CLSID_ExplorerBand requested, building internal band.\n");
1334c2c66affSColin Finck             hResult = CExplorerBand_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
1335c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hResult))
1336c2c66affSColin Finck                 return hResult;
1337c2c66affSColin Finck         }
13384212f4b1SBrock Mammen         else if (IsEqualCLSID(classID, CLSID_FileSearchBand))
13394212f4b1SBrock Mammen         {
13404212f4b1SBrock Mammen             TRACE("CLSID_FileSearchBand requested, building internal band.\n");
13414212f4b1SBrock Mammen             hResult = CSearchBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
13424212f4b1SBrock Mammen             if (FAILED_UNEXPECTEDLY(hResult))
13434212f4b1SBrock Mammen                 return hResult;
13444212f4b1SBrock Mammen         }
1345c2c66affSColin Finck         else
1346c2c66affSColin Finck         {
1347c2c66affSColin Finck             TRACE("A different CLSID requested, using CoCreateInstance.\n");
1348c2c66affSColin Finck             hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1349c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hResult))
1350c2c66affSColin Finck                 return hResult;
1351c2c66affSColin Finck         }
1352c2c66affSColin Finck     }
1353c2c66affSColin Finck     else
1354c2c66affSColin Finck     {
1355c2c66affSColin Finck         CComPtr<IBandSite>                  pBandSite;
1356c2c66affSColin Finck 
1357c2c66affSColin Finck         hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
1358c2c66affSColin Finck         if (!SUCCEEDED(hResult))
1359c2c66affSColin Finck         {
1360c2c66affSColin Finck             ERR("Can't get IBandSite interface\n");
1361c2c66affSColin Finck             return E_FAIL;
1362c2c66affSColin Finck         }
1363c2c66affSColin Finck         hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
1364c2c66affSColin Finck         if (!SUCCEEDED(hResult))
1365c2c66affSColin Finck         {
1366c2c66affSColin Finck             ERR("Can't find band object\n");
1367c2c66affSColin Finck             return E_FAIL;
1368c2c66affSColin Finck         }
1369c2c66affSColin Finck 
1370c2c66affSColin Finck         // It's hackish, but we should be able to show the wanted band until we
1371c2c66affSColin Finck         // find the proper way to do this (but it seems to work to add a new band)
1372c2c66affSColin Finck         // Here we'll just re-add the existing band to the site, causing it to display.
1373c2c66affSColin Finck     }
1374c2c66affSColin Finck     V_VT(&vaIn) = VT_UNKNOWN;
1375c2c66affSColin Finck     V_UNKNOWN(&vaIn) = newBand.p;
1376c2c66affSColin Finck     hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
1377c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1378c2c66affSColin Finck     {
1379c2c66affSColin Finck         return hResult;
1380c2c66affSColin Finck     }
1381c2c66affSColin Finck 
1382c2c66affSColin Finck     hResult = dockingWindow->ShowDW(TRUE);
1383c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1384c2c66affSColin Finck         return hResult;
1385c2c66affSColin Finck 
1386a0c5cafcSGiannis Adamopoulos     if (vertical)
1387a0c5cafcSGiannis Adamopoulos     {
1388a0c5cafcSGiannis Adamopoulos         fCurrentVertBar = classID;
1389a0c5cafcSGiannis Adamopoulos         FireCommandStateChangeAll();
1390a0c5cafcSGiannis Adamopoulos     }
1391a0c5cafcSGiannis Adamopoulos 
1392c2c66affSColin Finck     return S_OK;
1393c2c66affSColin Finck }
1394c2c66affSColin Finck 
NavigateToParent()1395c2c66affSColin Finck HRESULT CShellBrowser::NavigateToParent()
1396c2c66affSColin Finck {
1397c2c66affSColin Finck     LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL);
1398c2c66affSColin Finck     if (newDirectory == NULL)
1399c2c66affSColin Finck         return E_OUTOFMEMORY;
1400c2c66affSColin Finck     if (_ILIsDesktop(newDirectory))
1401c2c66affSColin Finck     {
1402c2c66affSColin Finck         ILFree(newDirectory);
1403c2c66affSColin Finck         return E_INVALIDARG;
1404c2c66affSColin Finck     }
1405c2c66affSColin Finck     ILRemoveLastID(newDirectory);
1406c2c66affSColin Finck     HRESULT hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1407c2c66affSColin Finck     ILFree(newDirectory);
1408c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1409c2c66affSColin Finck         return hResult;
1410c2c66affSColin Finck     return S_OK;
1411c2c66affSColin Finck }
1412c2c66affSColin Finck 
AddFolderOptionsPage(HPROPSHEETPAGE thePage,LPARAM lParam)1413c2c66affSColin Finck BOOL CALLBACK AddFolderOptionsPage(HPROPSHEETPAGE thePage, LPARAM lParam)
1414c2c66affSColin Finck {
1415c2c66affSColin Finck     PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1416c2c66affSColin Finck     if (sheetInfo->nPages >= folderOptionsPageCountMax)
1417c2c66affSColin Finck         return FALSE;
1418c2c66affSColin Finck     sheetInfo->phpage[sheetInfo->nPages] = thePage;
1419c2c66affSColin Finck     sheetInfo->nPages++;
1420c2c66affSColin Finck     return TRUE;
1421c2c66affSColin Finck }
1422c2c66affSColin Finck 
DoFolderOptions()1423c2c66affSColin Finck HRESULT CShellBrowser::DoFolderOptions()
1424c2c66affSColin Finck {
1425c2c66affSColin Finck     CComPtr<IShellPropSheetExt>             folderOptionsSheet;
1426c2c66affSColin Finck     PROPSHEETHEADER                         m_PropSheet;
1427c2c66affSColin Finck     HPROPSHEETPAGE                          m_psp[folderOptionsPageCountMax];
1428c2c66affSColin Finck //    CComPtr<IGlobalFolderSettings>          globalSettings;
1429c2c66affSColin Finck //    SHELLSTATE2                             shellState;
1430c2c66affSColin Finck     HRESULT                                 hResult;
1431c2c66affSColin Finck 
1432c2c66affSColin Finck     memset(m_psp, 0, sizeof(m_psp));
1433c2c66affSColin Finck     memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1434c2c66affSColin Finck 
1435c2c66affSColin Finck     // create sheet object
1436c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1437c2c66affSColin Finck         IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1438c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1439c2c66affSColin Finck         return E_FAIL;
1440c2c66affSColin Finck 
1441c2c66affSColin Finck     // must set site in order for Apply to all Folders on Advanced page to be enabled
1442c2c66affSColin Finck     hResult = IUnknown_SetSite(folderOptionsSheet, static_cast<IDispatch *>(this));
1443c2c66affSColin Finck     m_PropSheet.phpage = m_psp;
1444c2c66affSColin Finck 
1445c2c66affSColin Finck #if 0
1446c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1447c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1448c2c66affSColin Finck         return E_FAIL;
1449c2c66affSColin Finck     hResult = globalSettings->Get(&shellState, sizeof(shellState));
1450c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1451c2c66affSColin Finck         return E_FAIL;
1452c2c66affSColin Finck #endif
1453c2c66affSColin Finck 
1454c2c66affSColin Finck     // add pages
1455c2c66affSColin Finck     hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1456c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1457c2c66affSColin Finck         return E_FAIL;
1458c2c66affSColin Finck 
145938b7a681SKatayama Hirofumi MZ     if (fCurrentShellView)
1460c2c66affSColin Finck     {
1461c2c66affSColin Finck         hResult = fCurrentShellView->AddPropertySheetPages(
1462c2c66affSColin Finck             0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1463c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
1464c2c66affSColin Finck             return E_FAIL;
1465c2c66affSColin Finck     }
1466c2c66affSColin Finck 
1467c2c66affSColin Finck     // show sheet
1468f222e89dSKatayama Hirofumi MZ     CStringW strFolderOptions(MAKEINTRESOURCEW(IDS_FOLDER_OPTIONS));
1469c2c66affSColin Finck     m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1470c2c66affSColin Finck     m_PropSheet.dwFlags = 0;
1471c2c66affSColin Finck     m_PropSheet.hwndParent = m_hWnd;
1472c2c66affSColin Finck     m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1473f222e89dSKatayama Hirofumi MZ     m_PropSheet.pszCaption = strFolderOptions;
1474c2c66affSColin Finck     m_PropSheet.nStartPage = 0;
1475c2c66affSColin Finck     PropertySheet(&m_PropSheet);
1476c2c66affSColin Finck     return S_OK;
1477c2c66affSColin Finck }
1478c2c66affSColin Finck 
WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)1479c2c66affSColin Finck LRESULT CALLBACK CShellBrowser::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1480c2c66affSColin Finck {
1481c2c66affSColin Finck     CShellBrowser                           *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1482c2c66affSColin Finck     _ATL_MSG                                msg(pThis->m_hWnd, uMsg, wParam, lParam);
1483c2c66affSColin Finck     LRESULT                                 lResult;
1484c2c66affSColin Finck     const _ATL_MSG                          *previousMessage;
1485c2c66affSColin Finck     BOOL                                    handled;
1486c2c66affSColin Finck     WNDPROC                                 saveWindowProc;
1487c2c66affSColin Finck     HRESULT                                 hResult;
1488c2c66affSColin Finck 
1489c2c66affSColin Finck     hWnd = pThis->m_hWnd;
1490c2c66affSColin Finck     previousMessage = pThis->m_pCurrentMsg;
1491c2c66affSColin Finck     pThis->m_pCurrentMsg = &msg;
1492c2c66affSColin Finck 
1493c2c66affSColin Finck     /* If the shell browser is initialized, let the menu band preprocess the messages */
1494c2c66affSColin Finck     if (pThis->fCurrentDirectoryPIDL)
1495c2c66affSColin Finck     {
1496c2c66affSColin Finck         CComPtr<IMenuBand> menuBand;
1497c2c66affSColin Finck         hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1498c2c66affSColin Finck         if (SUCCEEDED(hResult) && menuBand.p != NULL)
1499c2c66affSColin Finck         {
1500c2c66affSColin Finck             hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1501c2c66affSColin Finck             if (hResult == S_OK)
1502c2c66affSColin Finck                 return lResult;
1503c2c66affSColin Finck             uMsg = msg.message;
1504c2c66affSColin Finck             wParam = msg.wParam;
1505c2c66affSColin Finck             lParam = msg.lParam;
1506c2c66affSColin Finck         }
1507c2c66affSColin Finck         menuBand.Release();
1508c2c66affSColin Finck     }
1509c2c66affSColin Finck 
1510c2c66affSColin Finck     handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1511c2c66affSColin Finck     ATLASSERT(pThis->m_pCurrentMsg == &msg);
1512c2c66affSColin Finck     if (handled == FALSE)
1513c2c66affSColin Finck     {
1514c2c66affSColin Finck         if (uMsg == WM_NCDESTROY)
1515c2c66affSColin Finck         {
1516d281d14fSTimo Kreuzer             saveWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
1517c2c66affSColin Finck             lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1518d281d14fSTimo Kreuzer             if (saveWindowProc == reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)))
1519d281d14fSTimo Kreuzer                 ::SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc);
1520c2c66affSColin Finck             pThis->m_dwState |= WINSTATE_DESTROYED;
1521c2c66affSColin Finck         }
1522c2c66affSColin Finck         else
1523c2c66affSColin Finck             lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1524c2c66affSColin Finck     }
1525c2c66affSColin Finck     pThis->m_pCurrentMsg = previousMessage;
1526c2c66affSColin Finck     if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1527c2c66affSColin Finck     {
1528c2c66affSColin Finck         pThis->m_dwState &= ~WINSTATE_DESTROYED;
1529c2c66affSColin Finck         pThis->m_hWnd = NULL;
1530c2c66affSColin Finck         pThis->OnFinalMessage(hWnd);
1531c2c66affSColin Finck     }
1532c2c66affSColin Finck     return lResult;
1533c2c66affSColin Finck }
1534c2c66affSColin Finck 
RepositionBars()1535c2c66affSColin Finck void CShellBrowser::RepositionBars()
1536c2c66affSColin Finck {
1537c2c66affSColin Finck     RECT                                    clientRect;
1538c2c66affSColin Finck     RECT                                    statusRect;
1539c2c66affSColin Finck     int                                     x;
1540c2c66affSColin Finck 
1541c2c66affSColin Finck     GetClientRect(&clientRect);
1542c2c66affSColin Finck 
154343b3dc20SCarl J. Bialorucki     if (m_settings.fStatusBarVisible && fStatusBar)
1544c2c66affSColin Finck     {
1545c2c66affSColin Finck         ::GetWindowRect(fStatusBar, &statusRect);
1546c2c66affSColin Finck         ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1547c2c66affSColin Finck                             clientRect.right - clientRect.left,
1548c2c66affSColin Finck                             statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1549c2c66affSColin Finck         clientRect.bottom -= statusRect.bottom - statusRect.top;
1550c2c66affSColin Finck     }
1551c2c66affSColin Finck 
1552c2c66affSColin Finck     for (x = 0; x < 3; x++)
1553c2c66affSColin Finck     {
1554c2c66affSColin Finck         HWND hwnd = fClientBars[x].hwnd;
1555c2c66affSColin Finck         RECT borderSpace = fClientBars[x].borderSpace;
1556c2c66affSColin Finck         if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1557c2c66affSColin Finck         {
1558c2c66affSColin Finck             IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1559c2c66affSColin Finck             fClientBars[x].hwnd = hwnd;
1560c2c66affSColin Finck         }
1561c2c66affSColin Finck         if (hwnd != NULL)
1562c2c66affSColin Finck         {
1563c2c66affSColin Finck             RECT toolbarRect = clientRect;
1564c2c66affSColin Finck             if (borderSpace.top != 0)
1565c2c66affSColin Finck             {
1566c2c66affSColin Finck                 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1567c2c66affSColin Finck             }
1568c2c66affSColin Finck             else if (borderSpace.bottom != 0)
1569c2c66affSColin Finck             {
1570c2c66affSColin Finck                 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1571c2c66affSColin Finck             }
1572c2c66affSColin Finck             else if (borderSpace.left != 0)
1573c2c66affSColin Finck             {
1574c2c66affSColin Finck                 toolbarRect.right = toolbarRect.left + borderSpace.left;
1575c2c66affSColin Finck             }
1576c2c66affSColin Finck             else if (borderSpace.right != 0)
1577c2c66affSColin Finck             {
1578c2c66affSColin Finck                 toolbarRect.left = toolbarRect.right - borderSpace.right;
1579c2c66affSColin Finck             }
1580c2c66affSColin Finck 
1581c2c66affSColin Finck             ::SetWindowPos(hwnd, NULL,
1582c2c66affSColin Finck                 toolbarRect.left,
1583c2c66affSColin Finck                 toolbarRect.top,
1584c2c66affSColin Finck                 toolbarRect.right - toolbarRect.left,
1585c2c66affSColin Finck                 toolbarRect.bottom - toolbarRect.top,
1586c2c66affSColin Finck                 SWP_NOOWNERZORDER | SWP_NOZORDER);
1587c2c66affSColin Finck 
1588c2c66affSColin Finck             if (borderSpace.top != 0)
1589c2c66affSColin Finck             {
1590c2c66affSColin Finck                 clientRect.top = toolbarRect.bottom;
1591c2c66affSColin Finck             }
1592c2c66affSColin Finck             else if (borderSpace.bottom != 0)
1593c2c66affSColin Finck             {
1594c2c66affSColin Finck                 clientRect.bottom = toolbarRect.top;
1595c2c66affSColin Finck             }
1596c2c66affSColin Finck             else if (borderSpace.left != 0)
1597c2c66affSColin Finck             {
1598c2c66affSColin Finck                 clientRect.left = toolbarRect.right;
1599c2c66affSColin Finck             }
1600c2c66affSColin Finck             else if (borderSpace.right != 0)
1601c2c66affSColin Finck             {
1602c2c66affSColin Finck                 clientRect.right = toolbarRect.left;
1603c2c66affSColin Finck             }
1604c2c66affSColin Finck         }
1605c2c66affSColin Finck     }
1606c2c66affSColin Finck     ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1607c2c66affSColin Finck                         clientRect.right - clientRect.left,
1608c2c66affSColin Finck                         clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1609c2c66affSColin Finck }
1610c2c66affSColin Finck 
FireEvent(DISPID dispIdMember,int argCount,VARIANT * arguments)1611c2c66affSColin Finck HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1612c2c66affSColin Finck {
1613c2c66affSColin Finck     DISPPARAMS                          params;
1614c2c66affSColin Finck     CComDynamicUnkArray                 &vec = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>::m_vec;
1615c2c66affSColin Finck     CComDynamicUnkArray                 &vec2 = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>::m_vec;
1616c2c66affSColin Finck     HRESULT                             hResult;
1617c2c66affSColin Finck 
1618c2c66affSColin Finck     params.rgvarg = arguments;
1619c2c66affSColin Finck     params.rgdispidNamedArgs = NULL;
1620c2c66affSColin Finck     params.cArgs = argCount;
1621c2c66affSColin Finck     params.cNamedArgs = 0;
1622c2c66affSColin Finck     IUnknown** pp = vec.begin();
1623c2c66affSColin Finck     while (pp < vec.end())
1624c2c66affSColin Finck     {
1625c2c66affSColin Finck         if (*pp != NULL)
1626c2c66affSColin Finck         {
1627c2c66affSColin Finck             CComPtr<IDispatch>          theDispatch;
1628c2c66affSColin Finck 
1629c2c66affSColin Finck             hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1630c2c66affSColin Finck             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1631c2c66affSColin Finck         }
1632c2c66affSColin Finck         pp++;
1633c2c66affSColin Finck     }
1634c2c66affSColin Finck     pp = vec2.begin();
1635c2c66affSColin Finck     while (pp < vec2.end())
1636c2c66affSColin Finck     {
1637c2c66affSColin Finck         if (*pp != NULL)
1638c2c66affSColin Finck         {
1639c2c66affSColin Finck             CComPtr<IDispatch>          theDispatch;
1640c2c66affSColin Finck 
1641c2c66affSColin Finck             hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1642c2c66affSColin Finck             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1643c2c66affSColin Finck         }
1644c2c66affSColin Finck         pp++;
1645c2c66affSColin Finck     }
1646c2c66affSColin Finck     return S_OK;
1647c2c66affSColin Finck }
1648c2c66affSColin Finck 
FireNavigateComplete(const wchar_t * newDirectory)1649c2c66affSColin Finck HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1650c2c66affSColin Finck {
1651c2c66affSColin Finck     // these two variants intentionally to do use CComVariant because it would double free/release
1652c2c66affSColin Finck     // or does not need to dispose at all
1653c2c66affSColin Finck     VARIANT                             varArg[2];
1654c2c66affSColin Finck     VARIANT                             varArgs;
1655c2c66affSColin Finck     CComBSTR                            tempString(newDirectory);
1656c2c66affSColin Finck 
1657c2c66affSColin Finck     V_VT(&varArgs) = VT_BSTR;
1658c2c66affSColin Finck     V_BSTR(&varArgs) = tempString.m_str;
1659c2c66affSColin Finck 
1660c2c66affSColin Finck     V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1661c2c66affSColin Finck     V_VARIANTREF(&varArg[0]) = &varArgs;
1662c2c66affSColin Finck     V_VT(&varArg[1]) = VT_DISPATCH;
1663c2c66affSColin Finck     V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1664c2c66affSColin Finck 
1665c2c66affSColin Finck     return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1666c2c66affSColin Finck }
1667c2c66affSColin Finck 
FireCommandStateChange(bool newState,int commandID)1668c2c66affSColin Finck HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1669c2c66affSColin Finck {
1670c2c66affSColin Finck     VARIANT                             varArg[2];
1671c2c66affSColin Finck 
1672c2c66affSColin Finck     V_VT(&varArg[0]) = VT_BOOL;
1673c2c66affSColin Finck     V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1674c2c66affSColin Finck     V_VT(&varArg[1]) = VT_I4;
1675c2c66affSColin Finck     V_I4(&varArg[1]) = commandID;
1676c2c66affSColin Finck 
1677c2c66affSColin Finck     return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1678c2c66affSColin Finck }
1679c2c66affSColin Finck 
FireCommandStateChangeAll()1680c2c66affSColin Finck HRESULT CShellBrowser::FireCommandStateChangeAll()
1681c2c66affSColin Finck {
1682c2c66affSColin Finck     return FireCommandStateChange(false, -1);
1683c2c66affSColin Finck }
1684c2c66affSColin Finck 
UpdateForwardBackState()1685c2c66affSColin Finck HRESULT CShellBrowser::UpdateForwardBackState()
1686c2c66affSColin Finck {
1687c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1688c2c66affSColin Finck     CComPtr<ITravelEntry>                   unusedEntry;
1689c2c66affSColin Finck     bool                                    canGoBack;
1690c2c66affSColin Finck     bool                                    canGoForward;
1691c2c66affSColin Finck     HRESULT                                 hResult;
1692c2c66affSColin Finck 
1693c2c66affSColin Finck     canGoBack = false;
1694c2c66affSColin Finck     canGoForward = false;
1695c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
1696c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1697c2c66affSColin Finck         return hResult;
1698c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1699c2c66affSColin Finck     if (SUCCEEDED(hResult))
1700c2c66affSColin Finck     {
1701c2c66affSColin Finck         canGoBack = true;
1702c2c66affSColin Finck         unusedEntry.Release();
1703c2c66affSColin Finck     }
1704c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1705c2c66affSColin Finck     if (SUCCEEDED(hResult))
1706c2c66affSColin Finck     {
1707c2c66affSColin Finck         canGoForward = true;
1708c2c66affSColin Finck         unusedEntry.Release();
1709c2c66affSColin Finck     }
1710c2c66affSColin Finck     hResult = FireCommandStateChange(canGoBack, 2);
1711c2c66affSColin Finck     hResult = FireCommandStateChange(canGoForward, 1);
1712c2c66affSColin Finck     return S_OK;
1713c2c66affSColin Finck }
1714c2c66affSColin Finck 
UpdateUpState()1715c2c66affSColin Finck HRESULT CShellBrowser::UpdateUpState()
1716c2c66affSColin Finck {
1717c2c66affSColin Finck     bool canGoUp;
1718c2c66affSColin Finck     HRESULT hResult;
1719c2c66affSColin Finck 
1720c2c66affSColin Finck     canGoUp = true;
1721c2c66affSColin Finck     if (_ILIsDesktop(fCurrentDirectoryPIDL))
1722c2c66affSColin Finck         canGoUp = false;
1723c2c66affSColin Finck     hResult = FireCommandStateChange(canGoUp, 3);
1724c2c66affSColin Finck     return S_OK;
1725c2c66affSColin Finck }
1726c2c66affSColin Finck 
UpdateGotoMenu(HMENU theMenu)1727c2c66affSColin Finck void CShellBrowser::UpdateGotoMenu(HMENU theMenu)
1728c2c66affSColin Finck {
1729c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1730c2c66affSColin Finck     CComPtr<ITravelEntry>                   unusedEntry;
1731c2c66affSColin Finck     int                                     position;
1732c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
1733c2c66affSColin Finck     HRESULT                                 hResult;
1734c2c66affSColin Finck 
1735c2c66affSColin Finck     DeleteMenuItems(theMenu, IDM_GOTO_TRAVEL_FIRST, IDM_GOTO_TRAVEL_LAST);
1736c2c66affSColin Finck 
1737c2c66affSColin Finck     position = GetMenuItemCount(theMenu);
1738c2c66affSColin Finck     hResult = GetTravelLog(&travelLog);
1739c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1740c2c66affSColin Finck         return;
1741c2c66affSColin Finck 
1742c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1743c2c66affSColin Finck                                         TLOG_BACK,
1744c2c66affSColin Finck                                         &unusedEntry);
1745c2c66affSColin Finck 
1746c2c66affSColin Finck     if (SUCCEEDED(hResult))
1747c2c66affSColin Finck     {
1748c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_BACK, TRUE);
1749c2c66affSColin Finck         unusedEntry.Release();
1750c2c66affSColin Finck     }
1751c2c66affSColin Finck     else
1752c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_BACK, FALSE);
1753c2c66affSColin Finck 
1754c2c66affSColin Finck     hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1755c2c66affSColin Finck                                         TLOG_FORE,
1756c2c66affSColin Finck                                         &unusedEntry);
1757c2c66affSColin Finck 
1758c2c66affSColin Finck     if (SUCCEEDED(hResult))
1759c2c66affSColin Finck     {
1760c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_FORWARD, TRUE);
1761c2c66affSColin Finck         unusedEntry.Release();
1762c2c66affSColin Finck     }
1763c2c66affSColin Finck     else
1764c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_GOTO_FORWARD, FALSE);
1765c2c66affSColin Finck 
1766c2c66affSColin Finck     SHEnableMenuItem(theMenu,
1767c2c66affSColin Finck                      IDM_GOTO_UPONELEVEL,
1768c2c66affSColin Finck                      !_ILIsDesktop(fCurrentDirectoryPIDL));
1769c2c66affSColin Finck 
1770c2c66affSColin Finck     hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1771c2c66affSColin Finck         IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, TLMENUF_BACKANDFORTH | TLMENUF_CHECKCURRENT);
1772c2c66affSColin Finck     if (SUCCEEDED(hResult))
1773c2c66affSColin Finck     {
1774c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1775c2c66affSColin Finck         menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1776c2c66affSColin Finck         menuItemInfo.fType = MF_SEPARATOR;
1777c2c66affSColin Finck         menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1778c2c66affSColin Finck         InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1779c2c66affSColin Finck     }
1780c2c66affSColin Finck }
1781c2c66affSColin Finck 
UpdateViewMenu(HMENU theMenu)1782c2c66affSColin Finck void CShellBrowser::UpdateViewMenu(HMENU theMenu)
1783c2c66affSColin Finck {
1784c2c66affSColin Finck     CComPtr<ITravelLog>                     travelLog;
1785c2c66affSColin Finck     HMENU                                   gotoMenu;
1786c2c66affSColin Finck     OLECMD                                  commandList[5];
1787c2c66affSColin Finck     HMENU                                   toolbarMenuBar;
1788c2c66affSColin Finck     HMENU                                   toolbarMenu;
1789c2c66affSColin Finck     MENUITEMINFO                            menuItemInfo;
1790c2c66affSColin Finck     HRESULT                                 hResult;
1791c2c66affSColin Finck 
1792c2c66affSColin Finck     gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1793c2c66affSColin Finck     if (gotoMenu != NULL)
1794c2c66affSColin Finck         UpdateGotoMenu(gotoMenu);
1795c2c66affSColin Finck 
1796c2c66affSColin Finck     commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1797c2c66affSColin Finck     commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1798c2c66affSColin Finck     commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1799c2c66affSColin Finck     commandList[3].cmdID = ITID_TOOLBARLOCKED;
1800c2c66affSColin Finck     commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1801c2c66affSColin Finck 
1802c2c66affSColin Finck     hResult = IUnknown_QueryStatus(fClientBars[BIInternetToolbar].clientBar,
1803c2c66affSColin Finck                                    CGID_PrivCITCommands, 5, commandList, NULL);
1804c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1805c2c66affSColin Finck         DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND);
1806c2c66affSColin Finck     else
1807c2c66affSColin Finck     {
1808c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1809c2c66affSColin Finck         menuItemInfo.fMask = MIIM_SUBMENU;
1810c2c66affSColin Finck         GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1811c2c66affSColin Finck         DestroyMenu(menuItemInfo.hSubMenu);
1812c2c66affSColin Finck 
1813c2c66affSColin Finck         toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1814c2c66affSColin Finck         toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1815c2c66affSColin Finck         RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION);
1816c2c66affSColin Finck         DestroyMenu(toolbarMenuBar);
1817c2c66affSColin Finck 
1818c2c66affSColin Finck         // TODO: Implement
1819c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_ENABLED);
1820c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1821c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1822c2c66affSColin Finck         SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, commandList[4].cmdf & OLECMDF_ENABLED);
1823c2c66affSColin Finck 
1824c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_LATCHED);
1825c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_LATCHED);
1826c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_LATCHED);
1827c2c66affSColin Finck         SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_LATCHED);
1828c2c66affSColin Finck         if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1829c2c66affSColin Finck             DeleteMenu(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
1830c2c66affSColin Finck         DeleteMenu(toolbarMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
1831c2c66affSColin Finck         DeleteMenu(toolbarMenu, IDM_TOOLBARS_GOBUTTON, MF_BYCOMMAND);
1832c2c66affSColin Finck 
1833c2c66affSColin Finck         menuItemInfo.cbSize = sizeof(menuItemInfo);
1834c2c66affSColin Finck         menuItemInfo.fMask = MIIM_SUBMENU;
1835c2c66affSColin Finck         menuItemInfo.hSubMenu = toolbarMenu;
1836c2c66affSColin Finck         SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1837c2c66affSColin Finck     }
183843b3dc20SCarl J. Bialorucki     SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, m_settings.fStatusBarVisible ? TRUE : FALSE);
183981ec0569SKatayama Hirofumi MZ 
184081ec0569SKatayama Hirofumi MZ     // Check the menu items for Explorer bar
184181ec0569SKatayama Hirofumi MZ     BOOL bSearchBand = (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
184281ec0569SKatayama Hirofumi MZ                         IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
184381ec0569SKatayama Hirofumi MZ                         IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
184481ec0569SKatayama Hirofumi MZ                         IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar));
184581ec0569SKatayama Hirofumi MZ     BOOL bHistory = IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar);
184681ec0569SKatayama Hirofumi MZ     BOOL bFavorites = IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar);
184781ec0569SKatayama Hirofumi MZ     BOOL bFolders = IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar);
184881ec0569SKatayama Hirofumi MZ     SHCheckMenuItem(theMenu, IDM_EXPLORERBAR_SEARCH, bSearchBand);
184981ec0569SKatayama Hirofumi MZ     SHCheckMenuItem(theMenu, IDM_EXPLORERBAR_HISTORY, bHistory);
185081ec0569SKatayama Hirofumi MZ     SHCheckMenuItem(theMenu, IDM_EXPLORERBAR_FAVORITES, bFavorites);
185181ec0569SKatayama Hirofumi MZ     SHCheckMenuItem(theMenu, IDM_EXPLORERBAR_FOLDERS, bFolders);
1852c2c66affSColin Finck }
1853c2c66affSColin Finck 
BuildExplorerBandMenu()1854c2c66affSColin Finck HRESULT CShellBrowser::BuildExplorerBandMenu()
1855c2c66affSColin Finck {
1856c2c66affSColin Finck     HMENU                                   hBandsMenu;
1857c2c66affSColin Finck     UINT                                    nbFound;
1858c2c66affSColin Finck 
1859c2c66affSColin Finck     hBandsMenu = SHGetMenuFromID(fCurrentMenuBar, IDM_VIEW_EXPLORERBAR);
1860c2c66affSColin Finck     if (!hBandsMenu)
1861c2c66affSColin Finck     {
1862c2c66affSColin Finck         OutputDebugString(L"No menu !\n");
1863c2c66affSColin Finck         return E_FAIL;
1864c2c66affSColin Finck     }
1865c2c66affSColin Finck     DSA_DeleteAllItems(menuDsa);
1866c2c66affSColin Finck     BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
1867c2c66affSColin Finck     BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
1868c2c66affSColin Finck     if (!nbFound)
1869c2c66affSColin Finck     {
1870c2c66affSColin Finck         // Remove separator
1871c2c66affSColin Finck         DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_SEPARATOR, MF_BYCOMMAND);
1872c2c66affSColin Finck     }
1873c2c66affSColin Finck     // Remove media menu since XP does it (according to API Monitor)
1874c2c66affSColin Finck     DeleteMenu(hBandsMenu, IDM_EXPLORERBAR_MEDIA, MF_BYCOMMAND);
1875c2c66affSColin Finck     return S_OK;
1876c2c66affSColin Finck }
1877c2c66affSColin Finck 
BuildExplorerBandCategory(HMENU hBandsMenu,CATID category,DWORD dwPos,UINT * nbFound)1878c2c66affSColin Finck HRESULT CShellBrowser::BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound)
1879c2c66affSColin Finck {
1880c2c66affSColin Finck     HRESULT                                 hr;
1881c2c66affSColin Finck     CComPtr<IEnumGUID>                      pEnumGUID;
1882c2c66affSColin Finck     WCHAR                                   wszBandName[MAX_PATH];
1883c2c66affSColin Finck     WCHAR                                   wszBandGUID[MAX_PATH];
1884c2c66affSColin Finck     WCHAR                                   wRegKey[MAX_PATH];
1885c2c66affSColin Finck     UINT                                    cBands;
1886c2c66affSColin Finck     DWORD                                   dwRead;
1887c2c66affSColin Finck     DWORD                                   dwDataSize;
1888c2c66affSColin Finck     GUID                                    iter;
1889c2c66affSColin Finck     MenuBandInfo                            mbi;
1890c2c66affSColin Finck 
1891c2c66affSColin Finck     mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
1892c2c66affSColin Finck     cBands = 0;
1893c2c66affSColin Finck     hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
1894c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
1895c2c66affSColin Finck     {
1896c2c66affSColin Finck         return hr;
1897c2c66affSColin Finck     }
1898c2c66affSColin Finck     do
1899c2c66affSColin Finck     {
1900c2c66affSColin Finck         pEnumGUID->Next(1, &iter, &dwRead);
1901c2c66affSColin Finck         if (dwRead)
1902c2c66affSColin Finck         {
1903c2c66affSColin Finck             // Get the band name
1904c2c66affSColin Finck             if (IsBuiltinBand(iter))
1905c2c66affSColin Finck                 continue;
1906c2c66affSColin Finck             if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
1907c2c66affSColin Finck                 continue;
1908c2c66affSColin Finck             StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
1909c2c66affSColin Finck             dwDataSize = MAX_PATH;
1910c2c66affSColin Finck             SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
1911c2c66affSColin Finck 
1912c2c66affSColin Finck             mbi.barGuid = iter;
1913c2c66affSColin Finck             InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
1914c2c66affSColin Finck             DSA_AppendItem(menuDsa, &mbi);
1915c2c66affSColin Finck             cBands++;
1916c2c66affSColin Finck         }
1917c2c66affSColin Finck     }
1918c2c66affSColin Finck     while (dwRead > 0);
1919c2c66affSColin Finck     if (nbFound)
1920c2c66affSColin Finck         *nbFound = cBands;
1921c2c66affSColin Finck     return S_OK;
1922c2c66affSColin Finck }
1923c2c66affSColin Finck 
IsBuiltinBand(CLSID & bandID)1924c2c66affSColin Finck BOOL CShellBrowser::IsBuiltinBand(CLSID &bandID)
1925c2c66affSColin Finck {
1926c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
1927c2c66affSColin Finck         return TRUE;
1928c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
1929c2c66affSColin Finck         return TRUE;
1930c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
1931c2c66affSColin Finck         return TRUE;
1932c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
1933c2c66affSColin Finck         return TRUE;
1934c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
1935c2c66affSColin Finck         return TRUE;
1936c2c66affSColin Finck     if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
1937c2c66affSColin Finck         return TRUE;
1938c2c66affSColin Finck     return FALSE;
1939c2c66affSColin Finck }
1940c2c66affSColin Finck 
OnSearch()1941c2c66affSColin Finck HRESULT CShellBrowser::OnSearch()
1942c2c66affSColin Finck {
1943c2c66affSColin Finck     CComPtr<IObjectWithSite>                objectWithSite;
1944c2c66affSColin Finck     CComPtr<IContextMenu>                   contextMenu;
1945c2c66affSColin Finck     CMINVOKECOMMANDINFO                     commandInfo;
1946c2c66affSColin Finck     const char                              *searchGUID = "{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
1947c2c66affSColin Finck     HRESULT                                 hResult;
1948c2c66affSColin Finck 
1949c2c66affSColin Finck     // TODO: Query shell if this command is enabled first
1950c2c66affSColin Finck 
1951c2c66affSColin Finck     memset(&commandInfo, 0, sizeof(commandInfo));
1952c2c66affSColin Finck     commandInfo.cbSize = sizeof(commandInfo);
1953c2c66affSColin Finck     commandInfo.hwnd = m_hWnd;
1954c2c66affSColin Finck     commandInfo.lpParameters = searchGUID;
1955c2c66affSColin Finck     commandInfo.nShow = SW_SHOWNORMAL;
1956c2c66affSColin Finck 
1957c2c66affSColin Finck     hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
1958c2c66affSColin Finck         IID_PPV_ARG(IContextMenu, &contextMenu));
1959c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1960c2c66affSColin Finck         return 0;
1961c2c66affSColin Finck     hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1962c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1963c2c66affSColin Finck         return 0;
1964c2c66affSColin Finck     hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
1965c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1966c2c66affSColin Finck         return 0;
1967c2c66affSColin Finck     hResult = contextMenu->InvokeCommand(&commandInfo);
1968c2c66affSColin Finck     hResult = objectWithSite->SetSite(NULL);
1969c2c66affSColin Finck     return hResult;
1970c2c66affSColin Finck }
1971c2c66affSColin Finck 
IUnknownIsEqual(IUnknown * int1,IUnknown * int2)1972c2c66affSColin Finck bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
1973c2c66affSColin Finck {
1974c2c66affSColin Finck     CComPtr<IUnknown>                       int1Retry;
1975c2c66affSColin Finck     CComPtr<IUnknown>                       int2Retry;
1976c2c66affSColin Finck     HRESULT                                 hResult;
1977c2c66affSColin Finck 
1978c2c66affSColin Finck     if (int1 == int2)
1979c2c66affSColin Finck         return true;
1980c2c66affSColin Finck     if (int1 == NULL || int2 == NULL)
1981c2c66affSColin Finck         return false;
1982c2c66affSColin Finck     hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1983c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1984c2c66affSColin Finck         return false;
1985c2c66affSColin Finck     hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1986c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
1987c2c66affSColin Finck         return false;
1988c2c66affSColin Finck     if (int1Retry == int2Retry)
1989c2c66affSColin Finck         return true;
1990c2c66affSColin Finck     return false;
1991c2c66affSColin Finck }
1992c2c66affSColin Finck 
GetBorderDW(IUnknown * punkObj,LPRECT prcBorder)1993c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
1994c2c66affSColin Finck {
1995bfadb22dSCarl J. Bialorucki     static const INT excludeItems[] = { 1, 1, 1, IDC_STATUSBAR, 0, 0 };
1996c2c66affSColin Finck 
1997c2c66affSColin Finck     RECT availableBounds;
1998c2c66affSColin Finck 
1999c2c66affSColin Finck     GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
2000c2c66affSColin Finck     for (INT x = 0; x < 3; x++)
2001c2c66affSColin Finck     {
2002c2c66affSColin Finck         if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
2003c2c66affSColin Finck         {
2004c2c66affSColin Finck             availableBounds.top += fClientBars[x].borderSpace.top;
2005c2c66affSColin Finck             availableBounds.left += fClientBars[x].borderSpace.left;
2006c2c66affSColin Finck             availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
2007c2c66affSColin Finck             availableBounds.right -= fClientBars[x].borderSpace.right;
2008c2c66affSColin Finck         }
2009c2c66affSColin Finck     }
2010c2c66affSColin Finck     *prcBorder = availableBounds;
2011c2c66affSColin Finck     return S_OK;
2012c2c66affSColin Finck }
2013c2c66affSColin Finck 
RequestBorderSpaceDW(IUnknown * punkObj,LPCBORDERWIDTHS pbw)2014c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
2015c2c66affSColin Finck {
2016c2c66affSColin Finck     return S_OK;
2017c2c66affSColin Finck }
2018c2c66affSColin Finck 
SetBorderSpaceDW(IUnknown * punkObj,LPCBORDERWIDTHS pbw)2019c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
2020c2c66affSColin Finck {
2021c2c66affSColin Finck     for (INT x = 0; x < 3; x++)
2022c2c66affSColin Finck     {
2023c2c66affSColin Finck         if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
2024c2c66affSColin Finck         {
2025c2c66affSColin Finck             fClientBars[x].borderSpace = *pbw;
2026c2c66affSColin Finck             // if this bar changed size, it cascades and forces all subsequent bars to resize
2027c2c66affSColin Finck             RepositionBars();
2028c2c66affSColin Finck             return S_OK;
2029c2c66affSColin Finck         }
2030c2c66affSColin Finck     }
2031c2c66affSColin Finck     return E_INVALIDARG;
2032c2c66affSColin Finck }
2033c2c66affSColin Finck 
QueryStatus(const GUID * pguidCmdGroup,ULONG cCmds,OLECMD prgCmds[],OLECMDTEXT * pCmdText)2034c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
2035c2c66affSColin Finck     ULONG cCmds, OLECMD prgCmds[  ], OLECMDTEXT *pCmdText)
2036c2c66affSColin Finck {
2037c2c66affSColin Finck     CComPtr<IOleCommandTarget>              commandTarget;
2038c2c66affSColin Finck     HRESULT                                 hResult;
2039c2c66affSColin Finck 
2040c2c66affSColin Finck     if (prgCmds == NULL)
2041c2c66affSColin Finck         return E_INVALIDARG;
2042c2c66affSColin Finck     if (pguidCmdGroup == NULL)
2043c2c66affSColin Finck     {
2044c2c66affSColin Finck         if (fCurrentShellView.p != NULL)
2045c2c66affSColin Finck         {
2046c2c66affSColin Finck             hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
2047c2c66affSColin Finck             if (SUCCEEDED(hResult) && commandTarget.p != NULL)
2048c2c66affSColin Finck                 return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
2049c2c66affSColin Finck         }
2050c2c66affSColin Finck         while (cCmds != 0)
2051c2c66affSColin Finck         {
2052c2c66affSColin Finck             prgCmds->cmdf = 0;
2053c2c66affSColin Finck             prgCmds++;
2054c2c66affSColin Finck             cCmds--;
2055c2c66affSColin Finck         }
2056c2c66affSColin Finck     }
2057c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2058c2c66affSColin Finck     {
2059c2c66affSColin Finck         while (cCmds != 0)
2060c2c66affSColin Finck         {
2061c2c66affSColin Finck             switch (prgCmds->cmdID)
2062c2c66affSColin Finck             {
2063c2c66affSColin Finck                 case 0x1c:  // search
2064c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
2065a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
2066a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
2067a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
2068a0c5cafcSGiannis Adamopoulos                         IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
2069a0c5cafcSGiannis Adamopoulos                     {
2070a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
2071a0c5cafcSGiannis Adamopoulos                     }
2072c2c66affSColin Finck                     break;
2073c2c66affSColin Finck                 case 0x1d:  // history
2074c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
2075a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
2076a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
2077c2c66affSColin Finck                     break;
2078c2c66affSColin Finck                 case 0x1e:  // favorites
2079c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
2080a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
2081a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
2082c2c66affSColin Finck                     break;
20839e8214faSWhindmar Saksit                 case SBCMDID_EXPLORERBARFOLDERS:  // folders
2084a0c5cafcSGiannis Adamopoulos                     prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
2085a0c5cafcSGiannis Adamopoulos                     if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
2086a0c5cafcSGiannis Adamopoulos                         prgCmds->cmdf |= OLECMDF_LATCHED;
2087c2c66affSColin Finck                     break;
2088c2c66affSColin Finck                 default:
2089c2c66affSColin Finck                     prgCmds->cmdf = 0;
2090c2c66affSColin Finck                     break;
2091c2c66affSColin Finck             }
2092c2c66affSColin Finck             prgCmds++;
2093c2c66affSColin Finck             cCmds--;
2094c2c66affSColin Finck         }
2095c2c66affSColin Finck     }
2096c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2097c2c66affSColin Finck     {
2098c2c66affSColin Finck         while (cCmds != 0)
2099c2c66affSColin Finck         {
2100c2c66affSColin Finck             switch (prgCmds->cmdID)
2101c2c66affSColin Finck             {
2102bfadb22dSCarl J. Bialorucki                 case IDM_GOTO_UPONELEVEL:
2103c2c66affSColin Finck                     prgCmds->cmdf = OLECMDF_SUPPORTED;
2104c2c66affSColin Finck                     if (fCurrentDirectoryPIDL->mkid.cb != 0)
2105c2c66affSColin Finck                         prgCmds->cmdf |= OLECMDF_ENABLED;
2106c2c66affSColin Finck                     break;
2107c2c66affSColin Finck             }
2108c2c66affSColin Finck             prgCmds++;
2109c2c66affSColin Finck             cCmds--;
2110c2c66affSColin Finck         }
2111c2c66affSColin Finck     }
2112c2c66affSColin Finck     return S_OK;
2113c2c66affSColin Finck }
2114c2c66affSColin Finck 
Exec(const GUID * pguidCmdGroup,DWORD nCmdID,DWORD nCmdexecopt,VARIANT * pvaIn,VARIANT * pvaOut)2115c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
2116c2c66affSColin Finck     DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2117c2c66affSColin Finck {
2118c2c66affSColin Finck     HRESULT                                 hResult;
2119c2c66affSColin Finck 
2120c2c66affSColin Finck     if (!pguidCmdGroup)
2121c2c66affSColin Finck     {
2122c2c66affSColin Finck         TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
2123c2c66affSColin Finck         return E_NOTIMPL;
2124c2c66affSColin Finck     }
2125c2c66affSColin Finck     if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2126c2c66affSColin Finck     {
2127c2c66affSColin Finck         switch (nCmdID)
2128c2c66affSColin Finck         {
2129a0c5cafcSGiannis Adamopoulos             case 0x1c: //Toggle Search
2130a0c5cafcSGiannis Adamopoulos             case 0x1d: //Toggle History
2131a0c5cafcSGiannis Adamopoulos             case 0x1e: //Toggle Favorites
21329e8214faSWhindmar Saksit             case SBCMDID_EXPLORERBARFOLDERS: //Toggle Folders
2133a0c5cafcSGiannis Adamopoulos                 const GUID* pclsid;
21344212f4b1SBrock Mammen                 if (nCmdID == 0x1c) pclsid = &CLSID_FileSearchBand;
21354212f4b1SBrock Mammen                 else if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
2136a0c5cafcSGiannis Adamopoulos                 else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
2137a0c5cafcSGiannis Adamopoulos                 else pclsid = &CLSID_ExplorerBand;
2138a0c5cafcSGiannis Adamopoulos 
2139a0c5cafcSGiannis Adamopoulos                 if (IsEqualCLSID(*pclsid, fCurrentVertBar))
2140a0c5cafcSGiannis Adamopoulos                 {
2141a0c5cafcSGiannis Adamopoulos                     hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2142a0c5cafcSGiannis Adamopoulos                     memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2143a0c5cafcSGiannis Adamopoulos                     FireCommandStateChangeAll();
2144a0c5cafcSGiannis Adamopoulos                 }
2145a0c5cafcSGiannis Adamopoulos                 else
2146a0c5cafcSGiannis Adamopoulos                 {
2147a0c5cafcSGiannis Adamopoulos                     hResult = ShowBand(*pclsid, true);
2148a0c5cafcSGiannis Adamopoulos                 }
2149a0c5cafcSGiannis Adamopoulos                 return S_OK;
2150a0c5cafcSGiannis Adamopoulos             case 0x22:
2151a0c5cafcSGiannis Adamopoulos                 //Sent when a band closes
2152a0c5cafcSGiannis Adamopoulos                 if (V_VT(pvaIn) != VT_UNKNOWN)
2153a0c5cafcSGiannis Adamopoulos                     return E_INVALIDARG;
2154a0c5cafcSGiannis Adamopoulos 
2155a0c5cafcSGiannis Adamopoulos                 if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
2156a0c5cafcSGiannis Adamopoulos                 {
2157a0c5cafcSGiannis Adamopoulos                     memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
2158a0c5cafcSGiannis Adamopoulos                     FireCommandStateChangeAll();
2159a0c5cafcSGiannis Adamopoulos                 }
2160c2c66affSColin Finck                 return S_OK;
2161c2c66affSColin Finck             case 0x27:
2162c2c66affSColin Finck                 if (nCmdexecopt == 1)
2163c2c66affSColin Finck                 {
2164c2c66affSColin Finck                     // pvaIn is a VT_UNKNOWN with a band that is being hidden
2165c2c66affSColin Finck                 }
2166c2c66affSColin Finck                 else
2167c2c66affSColin Finck                 {
2168c2c66affSColin Finck                     // update zones part of the status bar
2169c2c66affSColin Finck                 }
2170c2c66affSColin Finck                 return S_OK;
2171c2c66affSColin Finck             case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
2172c2c66affSColin Finck                 V_VT(pvaOut) = VT_INT_PTR;
2173c2c66affSColin Finck                 V_INTREF(pvaOut) = reinterpret_cast<INT *>(
2174c2c66affSColin Finck                     LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
2175c2c66affSColin Finck                 return S_OK;
2176c2c66affSColin Finck             case 0x38:
2177c2c66affSColin Finck                 // indicate if this cabinet was opened as a browser
2178c2c66affSColin Finck                 return S_FALSE;
2179c2c66affSColin Finck             default:
2180c2c66affSColin Finck                 return E_NOTIMPL;
2181c2c66affSColin Finck         }
2182c2c66affSColin Finck     }
2183c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
2184c2c66affSColin Finck     {
2185c2c66affSColin Finck         switch (nCmdID)
2186c2c66affSColin Finck         {
2187c2c66affSColin Finck             case 0x23:
2188c2c66affSColin Finck                 // placeholder
2189c2c66affSColin Finck                 return S_OK;
2190c2c66affSColin Finck         }
2191c2c66affSColin Finck     }
2192c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
2193c2c66affSColin Finck     {
2194c2c66affSColin Finck         switch (nCmdID)
2195c2c66affSColin Finck         {
2196c2c66affSColin Finck             case 6:
2197c2c66affSColin Finck                 // what is theater mode and why do we receive this?
2198c2c66affSColin Finck                 return E_NOTIMPL;
2199c2c66affSColin Finck         }
2200c2c66affSColin Finck     }
2201c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
2202c2c66affSColin Finck     {
2203c2c66affSColin Finck         switch (nCmdID)
2204c2c66affSColin Finck         {
2205c2c66affSColin Finck             case 14:
2206c2c66affSColin Finck                 // initialize favorites menu
2207c2c66affSColin Finck                 return S_OK;
2208c2c66affSColin Finck         }
2209c2c66affSColin Finck     }
2210c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
2211c2c66affSColin Finck     {
2212c2c66affSColin Finck         switch (nCmdID)
2213c2c66affSColin Finck         {
2214c2c66affSColin Finck             case 0x12:
2215c2c66affSColin Finck                 // refresh on toolbar clicked
2216c2c66affSColin Finck                 return S_OK;
2217c2c66affSColin Finck             case 0x26:
2218c2c66affSColin Finck                 // called for unknown bands ?
2219c2c66affSColin Finck                 return S_OK;
2220c2c66affSColin Finck             case 0x4d:
2221c2c66affSColin Finck                 // tell the view if it should hide the task pane or not
2222c2c66affSColin Finck                 return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
2223c2c66affSColin Finck         }
2224c2c66affSColin Finck     }
2225c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2226c2c66affSColin Finck     {
2227c2c66affSColin Finck         switch (nCmdID)
2228c2c66affSColin Finck         {
2229c2c66affSColin Finck             case 40994:
2230c2c66affSColin Finck                 return NavigateToParent();
2231674136bcSWhindmar Saksit             case IDM_NOTIFYITBARDIRTY:
2232674136bcSWhindmar Saksit                 SaveITBarLayout();
2233674136bcSWhindmar Saksit                 break;
2234c2c66affSColin Finck         }
2235c2c66affSColin Finck     }
2236c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
2237c2c66affSColin Finck     {
2238c2c66affSColin Finck         switch (nCmdID)
2239c2c66affSColin Finck         {
2240c2c66affSColin Finck             case 0x7063:
2241c2c66affSColin Finck                 return DoFolderOptions();
2242c2c66affSColin Finck         }
2243c2c66affSColin Finck     }
2244c2c66affSColin Finck     else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
2245c2c66affSColin Finck     {
2246c2c66affSColin Finck         switch (nCmdID)
2247c2c66affSColin Finck         {
2248c97c1ad4SWhindmar Saksit             case DVCMDID_RESET_DEFAULTFOLDER_SETTINGS:
2249802dc971SWhindmar Saksit                 ApplyBrowserDefaultFolderSettings(NULL);
2250c97c1ad4SWhindmar Saksit                 IUnknown_Exec(fCurrentShellView, CGID_DefView, nCmdID, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
2251c2c66affSColin Finck                 break;
2252c2c66affSColin Finck         }
2253c2c66affSColin Finck     }
2254c2c66affSColin Finck     else
2255c2c66affSColin Finck     {
2256c2c66affSColin Finck         return E_NOTIMPL;
2257c2c66affSColin Finck     }
2258c2c66affSColin Finck     return E_NOTIMPL;
2259c2c66affSColin Finck }
2260c2c66affSColin Finck 
GetWindow(HWND * lphwnd)2261c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindow(HWND *lphwnd)
2262c2c66affSColin Finck {
2263c2c66affSColin Finck     if (lphwnd == NULL)
2264c2c66affSColin Finck         return E_POINTER;
2265c2c66affSColin Finck     *lphwnd = m_hWnd;
2266c2c66affSColin Finck     return S_OK;
2267c2c66affSColin Finck }
2268c2c66affSColin Finck 
ContextSensitiveHelp(BOOL fEnterMode)2269c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ContextSensitiveHelp(BOOL fEnterMode)
2270c2c66affSColin Finck {
2271c2c66affSColin Finck     return E_NOTIMPL;
2272c2c66affSColin Finck }
2273c2c66affSColin Finck 
InsertMenusSB(HMENU hmenuShared,LPOLEMENUGROUPWIDTHS lpMenuWidths)2274c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
2275c2c66affSColin Finck {
2276c2c66affSColin Finck     HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2277c2c66affSColin Finck 
2278c2c66affSColin Finck     Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
2279c2c66affSColin Finck 
2280c2c66affSColin Finck     int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
2281c2c66affSColin Finck     Unused(itemCount3);
2282c2c66affSColin Finck 
2283c2c66affSColin Finck     DestroyMenu(mainMenu);
2284c2c66affSColin Finck 
2285c2c66affSColin Finck     lpMenuWidths->width[0] = 2;
2286c2c66affSColin Finck     lpMenuWidths->width[2] = 3;
2287c2c66affSColin Finck     lpMenuWidths->width[4] = 1;
2288c2c66affSColin Finck     return S_OK;
2289c2c66affSColin Finck }
2290c2c66affSColin Finck 
SetMenuSB(HMENU hmenuShared,HOLEMENU holemenuRes,HWND hwndActiveObject)2291c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
2292c2c66affSColin Finck {
2293c2c66affSColin Finck     CComPtr<IShellMenu>                     shellMenu;
2294c2c66affSColin Finck     HRESULT                                 hResult;
2295c2c66affSColin Finck 
2296c2c66affSColin Finck     if (hmenuShared && IsMenu(hmenuShared) == FALSE)
2297c2c66affSColin Finck         return E_FAIL;
2298c2c66affSColin Finck     hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
2299c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2300c2c66affSColin Finck         return hResult;
2301c2c66affSColin Finck 
2302c2c66affSColin Finck     if (!hmenuShared)
2303c2c66affSColin Finck     {
2304c2c66affSColin Finck         hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2305c2c66affSColin Finck     }
2306c2c66affSColin Finck     // FIXME: Figure out the proper way to do this.
2307c2c66affSColin Finck     HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
2308c2c66affSColin Finck     if (hMenuFavs)
2309c2c66affSColin Finck     {
2310c2c66affSColin Finck         DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
2311c2c66affSColin Finck     }
2312c2c66affSColin Finck 
2313c2c66affSColin Finck     hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
2314c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
2315c2c66affSColin Finck         return hResult;
2316c2c66affSColin Finck     fCurrentMenuBar = hmenuShared;
2317c2c66affSColin Finck     BuildExplorerBandMenu();
2318c2c66affSColin Finck     return S_OK;
2319c2c66affSColin Finck }
2320c2c66affSColin Finck 
RemoveMenusSB(HMENU hmenuShared)2321c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
2322c2c66affSColin Finck {
2323c2c66affSColin Finck     if (hmenuShared == fCurrentMenuBar)
2324c2c66affSColin Finck     {
2325c2c66affSColin Finck         //DestroyMenu(fCurrentMenuBar);
2326c2c66affSColin Finck         SetMenuSB(NULL, NULL, NULL);
2327c2c66affSColin Finck     }
2328c2c66affSColin Finck     return S_OK;
2329c2c66affSColin Finck }
2330c2c66affSColin Finck 
SetStatusTextSB(LPCOLESTR pszStatusText)2331c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
2332c2c66affSColin Finck {
2333c2c66affSColin Finck     //
2334c2c66affSColin Finck     if (pszStatusText)
2335c2c66affSColin Finck     {
2336c2c66affSColin Finck         ::SetWindowText(fStatusBar, pszStatusText);
2337c2c66affSColin Finck     }
2338c2c66affSColin Finck     else
2339c2c66affSColin Finck     {
2340c2c66affSColin Finck 
2341c2c66affSColin Finck     }
2342c2c66affSColin Finck     return S_OK;
2343c2c66affSColin Finck }
2344c2c66affSColin Finck 
EnableModelessSB(BOOL fEnable)2345c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
2346c2c66affSColin Finck {
2347c2c66affSColin Finck     return E_NOTIMPL;
2348c2c66affSColin Finck }
2349c2c66affSColin Finck 
TranslateAcceleratorSB(MSG * pmsg,WORD wID)2350c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::TranslateAcceleratorSB(MSG *pmsg, WORD wID)
2351c2c66affSColin Finck {
2352c2c66affSColin Finck     if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
2353c2c66affSColin Finck         return S_FALSE;
2354c2c66affSColin Finck     return S_OK;
2355c2c66affSColin Finck }
2356c2c66affSColin Finck 
BrowseObject(LPCITEMIDLIST pidl,UINT wFlags)2357c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
2358c2c66affSColin Finck {
23595b78381aSWhindmar Saksit     wFlags = ApplyNewBrowserFlag(wFlags);
23605b78381aSWhindmar Saksit     // FIXME: Should not automatically show the Explorer band
23615b78381aSWhindmar Saksit     if ((wFlags & SBSP_EXPLOREMODE) && !(wFlags & SBSP_NEWBROWSER))
2362c2c66affSColin Finck         ShowBand(CLSID_ExplorerBand, true);
2363c2c66affSColin Finck 
23645b78381aSWhindmar Saksit     CComHeapPtr<ITEMIDLIST> pidlResolved;
23655b78381aSWhindmar Saksit     if (wFlags & (SBSP_RELATIVE | SBSP_PARENT))
23665b78381aSWhindmar Saksit     {
23675b78381aSWhindmar Saksit         HRESULT hr = CreateRelativeBrowsePIDL(pidl, wFlags, &pidlResolved);
23685b78381aSWhindmar Saksit         if (FAILED(hr))
23695b78381aSWhindmar Saksit             return hr;
23705b78381aSWhindmar Saksit         pidl = pidlResolved;
23715b78381aSWhindmar Saksit     }
23725b78381aSWhindmar Saksit 
23735b78381aSWhindmar Saksit     if (wFlags & SBSP_NEWBROWSER)
23745b78381aSWhindmar Saksit         return OpenNewBrowserWindow(pidl, wFlags);
23755b78381aSWhindmar Saksit 
23765b78381aSWhindmar Saksit     switch (wFlags & (SBSP_ABSOLUTE | SBSP_RELATIVE | SBSP_PARENT | SBSP_NAVIGATEBACK | SBSP_NAVIGATEFORWARD))
23775b78381aSWhindmar Saksit     {
23785b78381aSWhindmar Saksit         case SBSP_PARENT:
23795b78381aSWhindmar Saksit             return NavigateToParent();
23805b78381aSWhindmar Saksit         case SBSP_NAVIGATEBACK:
23815b78381aSWhindmar Saksit             return GoBack();
23825b78381aSWhindmar Saksit         case SBSP_NAVIGATEFORWARD:
23835b78381aSWhindmar Saksit             return GoForward();
23845b78381aSWhindmar Saksit     }
23855b78381aSWhindmar Saksit 
23865b78381aSWhindmar Saksit     // TODO: SBSP_WRITENOHISTORY? SBSP_CREATENOHISTORY?
238762c33fbfSGiannis Adamopoulos     long flags = BTP_UPDATE_NEXT_HISTORY;
238862c33fbfSGiannis Adamopoulos     if (fTravelLog)
238962c33fbfSGiannis Adamopoulos         flags |= BTP_UPDATE_CUR_HISTORY;
23905b78381aSWhindmar Saksit     if (wFlags & SBSP_ACTIVATE_NOFOCUS)
23915b78381aSWhindmar Saksit         flags |= BTP_ACTIVATE_NOFOCUS;
239262c33fbfSGiannis Adamopoulos     return BrowseToPIDL(pidl, flags);
2393c2c66affSColin Finck }
2394c2c66affSColin Finck 
GetViewStateStream(DWORD grfMode,IStream ** ppStrm)2395c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
2396c2c66affSColin Finck {
2397c2c66affSColin Finck     return E_NOTIMPL;
2398c2c66affSColin Finck }
2399c2c66affSColin Finck 
GetControlWindow(UINT id,HWND * lphwnd)2400c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetControlWindow(UINT id, HWND *lphwnd)
2401c2c66affSColin Finck {
2402c2c66affSColin Finck     if (lphwnd == NULL)
2403c2c66affSColin Finck         return E_POINTER;
2404c2c66affSColin Finck     *lphwnd = NULL;
2405c2c66affSColin Finck     switch (id)
2406c2c66affSColin Finck     {
2407c2c66affSColin Finck         case FCW_TOOLBAR:
2408c2c66affSColin Finck             *lphwnd = fToolbarProxy.m_hWnd;
2409c2c66affSColin Finck             return S_OK;
2410c2c66affSColin Finck         case FCW_STATUS:
2411c2c66affSColin Finck             *lphwnd = fStatusBar;
2412c2c66affSColin Finck             return S_OK;
2413c2c66affSColin Finck         case FCW_TREE:
24149e8214faSWhindmar Saksit         {
24159e8214faSWhindmar Saksit             BOOL shown;
24169e8214faSWhindmar Saksit             if (SUCCEEDED(IsControlWindowShown(id, &shown)) && shown)
24179e8214faSWhindmar Saksit                 return IUnknown_GetWindow(fClientBars[BIVerticalBaseBar].clientBar.p, lphwnd);
24189e8214faSWhindmar Saksit             return S_FALSE;
24199e8214faSWhindmar Saksit         }
2420c2c66affSColin Finck         case FCW_PROGRESS:
2421c2c66affSColin Finck             // is this a progress dialog?
2422c2c66affSColin Finck             return S_OK;
2423c2c66affSColin Finck     }
2424c2c66affSColin Finck     return S_OK;
2425c2c66affSColin Finck }
2426c2c66affSColin Finck 
SendControlMsg(UINT id,UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT * pret)2427c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SendControlMsg(
2428c2c66affSColin Finck     UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
2429c2c66affSColin Finck {
2430c2c66affSColin Finck     LPARAM                                  result;
2431c2c66affSColin Finck 
2432c2c66affSColin Finck     if (pret != NULL)
2433c2c66affSColin Finck         *pret = 0;
2434c2c66affSColin Finck     switch (id)
2435c2c66affSColin Finck     {
2436c2c66affSColin Finck         case FCW_TOOLBAR:
2437c2c66affSColin Finck             result = fToolbarProxy.SendMessage(uMsg, wParam, lParam);
2438c2c66affSColin Finck             if (pret != NULL)
2439c2c66affSColin Finck                 *pret = result;
2440c2c66affSColin Finck             break;
2441c2c66affSColin Finck         case FCW_STATUS:
2442c2c66affSColin Finck             result = SendMessage(fStatusBar, uMsg, wParam, lParam);
2443c2c66affSColin Finck             if (pret != NULL)
2444c2c66affSColin Finck                 *pret = result;
2445c2c66affSColin Finck             break;
2446c2c66affSColin Finck     }
2447c2c66affSColin Finck     return S_OK;
2448c2c66affSColin Finck }
2449c2c66affSColin Finck 
QueryActiveShellView(IShellView ** ppshv)2450c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryActiveShellView(IShellView **ppshv)
2451c2c66affSColin Finck {
2452c2c66affSColin Finck     if (ppshv == NULL)
2453c2c66affSColin Finck         return E_POINTER;
2454c2c66affSColin Finck     *ppshv = fCurrentShellView;
2455c2c66affSColin Finck     if (fCurrentShellView.p != NULL)
245611ea1d61SWhindmar Saksit     {
2457c2c66affSColin Finck         fCurrentShellView.p->AddRef();
2458c2c66affSColin Finck         return S_OK;
2459c2c66affSColin Finck     }
246011ea1d61SWhindmar Saksit     return E_FAIL;
246111ea1d61SWhindmar Saksit }
2462c2c66affSColin Finck 
OnViewWindowActive(IShellView * ppshv)2463c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnViewWindowActive(IShellView *ppshv)
2464c2c66affSColin Finck {
2465c2c66affSColin Finck     return E_NOTIMPL;
2466c2c66affSColin Finck }
2467c2c66affSColin Finck 
SetToolbarItems(LPTBBUTTON lpButtons,UINT nButtons,UINT uFlags)2468c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
2469c2c66affSColin Finck {
2470c2c66affSColin Finck     return E_NOTIMPL;
2471c2c66affSColin Finck }
2472c2c66affSColin Finck 
DragEnter(IDataObject * pDataObj,DWORD grfKeyState,POINTL pt,DWORD * pdwEffect)2473c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragEnter(
2474c2c66affSColin Finck     IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2475c2c66affSColin Finck {
2476c2c66affSColin Finck     return E_NOTIMPL;
2477c2c66affSColin Finck }
2478c2c66affSColin Finck 
DragOver(DWORD grfKeyState,POINTL pt,DWORD * pdwEffect)2479c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2480c2c66affSColin Finck {
2481c2c66affSColin Finck     return E_NOTIMPL;
2482c2c66affSColin Finck }
2483c2c66affSColin Finck 
DragLeave()2484c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DragLeave()
2485c2c66affSColin Finck {
2486c2c66affSColin Finck     return E_NOTIMPL;
2487c2c66affSColin Finck }
2488c2c66affSColin Finck 
Drop(IDataObject * pDataObj,DWORD grfKeyState,POINTL pt,DWORD * pdwEffect)2489c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Drop(
2490c2c66affSColin Finck     IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2491c2c66affSColin Finck {
2492c2c66affSColin Finck     return E_NOTIMPL;
2493c2c66affSColin Finck }
2494c2c66affSColin Finck 
QueryService(REFGUID guidService,REFIID riid,void ** ppvObject)2495c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
2496c2c66affSColin Finck {
2497c2c66affSColin Finck     // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2498c2c66affSColin Finck     // the returned interface has a method GetPropertyBag on it
2499c2c66affSColin Finck     if (IsEqualIID(guidService, SID_STopLevelBrowser))
2500c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2501c2c66affSColin Finck     if (IsEqualIID(guidService, SID_SShellBrowser))
2502c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2503c2c66affSColin Finck     if (IsEqualIID(guidService, SID_ITargetFrame2))
2504c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2505c2c66affSColin Finck     if (IsEqualIID(guidService, SID_IWebBrowserApp))        // without this, the internet toolbar won't reflect notifications
2506c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2507c2c66affSColin Finck     if (IsEqualIID(guidService, SID_SProxyBrowser))
2508c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2509674136bcSWhindmar Saksit     if (IsEqualIID(guidService, SID_IExplorerToolbar) && fClientBars[BIInternetToolbar].clientBar.p)
2510c2c66affSColin Finck         return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2511c2c66affSColin Finck     if (IsEqualIID(riid, IID_IShellBrowser))
2512c2c66affSColin Finck         return this->QueryInterface(riid, ppvObject);
2513c2c66affSColin Finck     return E_NOINTERFACE;
2514c2c66affSColin Finck }
2515c2c66affSColin Finck 
_ILIsNetworkPlace(LPCITEMIDLIST pidl)25164814dfeaSKatayama Hirofumi MZ static BOOL _ILIsNetworkPlace(LPCITEMIDLIST pidl)
25174814dfeaSKatayama Hirofumi MZ {
25184814dfeaSKatayama Hirofumi MZ     WCHAR szPath[MAX_PATH];
25194814dfeaSKatayama Hirofumi MZ     return SHGetPathFromIDListWrapW(pidl, szPath) && PathIsUNCW(szPath);
25204814dfeaSKatayama Hirofumi MZ }
25214814dfeaSKatayama Hirofumi MZ 
GetPropertyBag(long flags,REFIID riid,void ** ppvObject)2522c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPropertyBag(long flags, REFIID riid, void **ppvObject)
2523c2c66affSColin Finck {
2524c2c66affSColin Finck     if (ppvObject == NULL)
2525c2c66affSColin Finck         return E_POINTER;
25264814dfeaSKatayama Hirofumi MZ 
2527c2c66affSColin Finck     *ppvObject = NULL;
25284814dfeaSKatayama Hirofumi MZ 
25294814dfeaSKatayama Hirofumi MZ     LPITEMIDLIST pidl;
25304814dfeaSKatayama Hirofumi MZ     HRESULT hr = GetPidl(&pidl);
25314814dfeaSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
25324814dfeaSKatayama Hirofumi MZ         return E_FAIL;
25334814dfeaSKatayama Hirofumi MZ 
25344814dfeaSKatayama Hirofumi MZ     // FIXME: pidl for Internet etc.
25354814dfeaSKatayama Hirofumi MZ 
25364814dfeaSKatayama Hirofumi MZ     if (_ILIsNetworkPlace(pidl))
25374814dfeaSKatayama Hirofumi MZ         flags |= SHGVSPB_ROAM;
25384814dfeaSKatayama Hirofumi MZ 
25394814dfeaSKatayama Hirofumi MZ     hr = SHGetViewStatePropertyBag(pidl, L"Shell", flags, riid, ppvObject);
25404814dfeaSKatayama Hirofumi MZ 
25414814dfeaSKatayama Hirofumi MZ     ILFree(pidl);
25424814dfeaSKatayama Hirofumi MZ     return hr;
2543c2c66affSColin Finck }
2544c2c66affSColin Finck 
GetTypeInfoCount(UINT * pctinfo)2545c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfoCount(UINT *pctinfo)
2546c2c66affSColin Finck {
2547c2c66affSColin Finck     return E_NOTIMPL;
2548c2c66affSColin Finck }
2549c2c66affSColin Finck 
GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)2550c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
2551c2c66affSColin Finck {
2552c2c66affSColin Finck     return E_NOTIMPL;
2553c2c66affSColin Finck }
2554c2c66affSColin Finck 
GetIDsOfNames(REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)2555c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
2556c2c66affSColin Finck     UINT cNames, LCID lcid, DISPID *rgDispId)
2557c2c66affSColin Finck {
2558c2c66affSColin Finck     return E_NOTIMPL;
2559c2c66affSColin Finck }
2560c2c66affSColin Finck 
Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)2561c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
2562c2c66affSColin Finck     WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2563c2c66affSColin Finck {
2564c2c66affSColin Finck     return E_NOTIMPL;
2565c2c66affSColin Finck }
2566c2c66affSColin Finck 
GetParentSite(IOleInPlaceSite ** ppipsite)2567c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetParentSite(IOleInPlaceSite **ppipsite)
2568c2c66affSColin Finck {
2569c2c66affSColin Finck     return E_NOTIMPL;
2570c2c66affSColin Finck }
2571c2c66affSColin Finck 
SetTitle(IShellView * psv,LPCWSTR pszName)2572c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetTitle(IShellView *psv, LPCWSTR pszName)
2573c2c66affSColin Finck {
2574c2c66affSColin Finck     return E_NOTIMPL;
2575c2c66affSColin Finck }
2576c2c66affSColin Finck 
GetTitle(IShellView * psv,LPWSTR pszName,DWORD cchName)2577c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName)
2578c2c66affSColin Finck {
2579c2c66affSColin Finck     return E_NOTIMPL;
2580c2c66affSColin Finck }
2581c2c66affSColin Finck 
GetOleObject(IOleObject ** ppobjv)2582c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetOleObject(IOleObject **ppobjv)
2583c2c66affSColin Finck {
2584c2c66affSColin Finck     return E_NOTIMPL;
2585c2c66affSColin Finck }
2586c2c66affSColin Finck 
GetTravelLog(ITravelLog ** pptl)2587c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
2588c2c66affSColin Finck {
2589c2c66affSColin Finck     HRESULT                                 hResult;
2590c2c66affSColin Finck 
2591c2c66affSColin Finck     // called by toolbar when displaying tooltips
2592c2c66affSColin Finck     if (pptl == NULL)
2593c2c66affSColin Finck         return E_FAIL;
2594c2c66affSColin Finck 
2595c2c66affSColin Finck     *pptl = NULL;
2596c2c66affSColin Finck     if (fTravelLog.p == NULL)
2597c2c66affSColin Finck     {
2598c2c66affSColin Finck         hResult = CTravelLog_CreateInstance(IID_PPV_ARG(ITravelLog, &fTravelLog));
2599c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
2600c2c66affSColin Finck             return hResult;
2601c2c66affSColin Finck     }
2602c2c66affSColin Finck     *pptl = fTravelLog.p;
2603c2c66affSColin Finck     fTravelLog.p->AddRef();
2604c2c66affSColin Finck     return S_OK;
2605c2c66affSColin Finck }
2606c2c66affSColin Finck 
ShowControlWindow(UINT id,BOOL fShow)2607c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ShowControlWindow(UINT id, BOOL fShow)
2608c2c66affSColin Finck {
26099e8214faSWhindmar Saksit     BOOL shown;
26109e8214faSWhindmar Saksit     if (FAILED(IsControlWindowShown(id, &shown)))
26119e8214faSWhindmar Saksit         return E_NOTIMPL;
26129e8214faSWhindmar Saksit     else if (!shown == !fShow) // Negated for true boolean comparison
26139e8214faSWhindmar Saksit         return S_OK;
26149e8214faSWhindmar Saksit     else switch (id)
26159e8214faSWhindmar Saksit     {
26169e8214faSWhindmar Saksit         case FCW_STATUS:
26179e8214faSWhindmar Saksit             OnToggleStatusBarVisible(0, 0, NULL, shown);
26189e8214faSWhindmar Saksit             return S_OK;
26199e8214faSWhindmar Saksit         case FCW_TREE:
26209e8214faSWhindmar Saksit             return Exec(&CGID_Explorer, SBCMDID_EXPLORERBARFOLDERS, 0, NULL, NULL);
2621674136bcSWhindmar Saksit         case FCW_ADDRESSBAR:
2622674136bcSWhindmar Saksit             return IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
2623674136bcSWhindmar Saksit                                  CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
26249e8214faSWhindmar Saksit     }
2625c2c66affSColin Finck     return E_NOTIMPL;
2626c2c66affSColin Finck }
2627c2c66affSColin Finck 
IsControlWindowShown(UINT id,BOOL * pfShown)2628c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IsControlWindowShown(UINT id, BOOL *pfShown)
2629c2c66affSColin Finck {
26309e8214faSWhindmar Saksit     HRESULT hr = S_OK;
26319e8214faSWhindmar Saksit     BOOL shown = FALSE;
26329e8214faSWhindmar Saksit     switch (id)
26339e8214faSWhindmar Saksit     {
26349e8214faSWhindmar Saksit         case FCW_STATUS:
26359e8214faSWhindmar Saksit             shown = m_settings.fStatusBarVisible;
26369e8214faSWhindmar Saksit             break;
26379e8214faSWhindmar Saksit         case FCW_TREE:
26389e8214faSWhindmar Saksit         {
26399e8214faSWhindmar Saksit             OLECMD cmd = { SBCMDID_EXPLORERBARFOLDERS };
26409e8214faSWhindmar Saksit             hr = QueryStatus(&CGID_Explorer, 1, &cmd, NULL);
26419e8214faSWhindmar Saksit             shown = cmd.cmdf & OLECMDF_LATCHED;
26429e8214faSWhindmar Saksit             break;
26439e8214faSWhindmar Saksit         }
2644674136bcSWhindmar Saksit         case FCW_ADDRESSBAR:
2645674136bcSWhindmar Saksit             hr = IsInternetToolbarBandShown(ITID_ADDRESSBANDSHOWN);
2646674136bcSWhindmar Saksit             shown = hr == S_OK;
2647674136bcSWhindmar Saksit             break;
26489e8214faSWhindmar Saksit         default:
26499e8214faSWhindmar Saksit             hr = E_NOTIMPL;
26509e8214faSWhindmar Saksit     }
26519e8214faSWhindmar Saksit     if (pfShown)
26529e8214faSWhindmar Saksit     {
26539e8214faSWhindmar Saksit         *pfShown = shown;
26549e8214faSWhindmar Saksit         return hr;
26559e8214faSWhindmar Saksit     }
26569e8214faSWhindmar Saksit     return SUCCEEDED(hr) ? (shown ? S_OK : S_FALSE) : hr;
2657c2c66affSColin Finck }
2658c2c66affSColin Finck 
IsInternetToolbarBandShown(UINT ITId)2659674136bcSWhindmar Saksit HRESULT CShellBrowser::IsInternetToolbarBandShown(UINT ITId)
2660674136bcSWhindmar Saksit {
2661674136bcSWhindmar Saksit     OLECMD cmd = { ITId };
2662674136bcSWhindmar Saksit     HRESULT hr = IUnknown_QueryStatus(fClientBars[BIInternetToolbar].clientBar,
2663674136bcSWhindmar Saksit                                       CGID_PrivCITCommands, 1, &cmd, NULL);
2664674136bcSWhindmar Saksit     return SUCCEEDED(hr) ? (cmd.cmdf & OLECMDF_LATCHED) ? S_OK : S_FALSE : hr;
2665674136bcSWhindmar Saksit }
2666674136bcSWhindmar Saksit 
IEGetDisplayName(LPCITEMIDLIST pidl,LPWSTR pwszName,UINT uFlags)2667c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
2668c2c66affSColin Finck {
2669c2c66affSColin Finck     return E_NOTIMPL;
2670c2c66affSColin Finck }
2671c2c66affSColin Finck 
IEParseDisplayName(UINT uiCP,LPCWSTR pwszPath,LPITEMIDLIST * ppidlOut)2672c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut)
2673c2c66affSColin Finck {
2674c2c66affSColin Finck     return E_NOTIMPL;
2675c2c66affSColin Finck }
2676c2c66affSColin Finck 
DisplayParseError(HRESULT hres,LPCWSTR pwszPath)2677c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::DisplayParseError(HRESULT hres, LPCWSTR pwszPath)
2678c2c66affSColin Finck {
2679c2c66affSColin Finck     return E_NOTIMPL;
2680c2c66affSColin Finck }
2681c2c66affSColin Finck 
NavigateToPidl(LPCITEMIDLIST pidl,DWORD grfHLNF)2682c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF)
2683c2c66affSColin Finck {
26845b78381aSWhindmar Saksit     return _NavigateToPidl(pidl, grfHLNF, 0);
2685c2c66affSColin Finck }
2686c2c66affSColin Finck 
SetNavigateState(BNSTATE bnstate)2687c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetNavigateState(BNSTATE bnstate)
2688c2c66affSColin Finck {
2689c2c66affSColin Finck     return E_NOTIMPL;
2690c2c66affSColin Finck }
2691c2c66affSColin Finck 
GetNavigateState(BNSTATE * pbnstate)2692c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetNavigateState(BNSTATE *pbnstate)
2693c2c66affSColin Finck {
2694c2c66affSColin Finck     return E_NOTIMPL;
2695c2c66affSColin Finck }
2696c2c66affSColin Finck 
NotifyRedirect(IShellView * psv,LPCITEMIDLIST pidl,BOOL * pfDidBrowse)2697c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse)
2698c2c66affSColin Finck {
2699c2c66affSColin Finck     return E_NOTIMPL;
2700c2c66affSColin Finck }
2701c2c66affSColin Finck 
UpdateWindowList()2702c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateWindowList()
2703c2c66affSColin Finck {
2704c2c66affSColin Finck     return E_NOTIMPL;
2705c2c66affSColin Finck }
2706c2c66affSColin Finck 
UpdateBackForwardState()2707c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateBackForwardState()
2708c2c66affSColin Finck {
2709c2c66affSColin Finck     return E_NOTIMPL;
2710c2c66affSColin Finck }
2711c2c66affSColin Finck 
SetFlags(DWORD dwFlags,DWORD dwFlagMask)2712c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetFlags(DWORD dwFlags, DWORD dwFlagMask)
2713c2c66affSColin Finck {
27145b78381aSWhindmar Saksit     m_BrowserSvcFlags = (m_BrowserSvcFlags & ~dwFlagMask) | (dwFlags & dwFlagMask);
27155b78381aSWhindmar Saksit     return S_OK;
2716c2c66affSColin Finck }
2717c2c66affSColin Finck 
GetFlags(DWORD * pdwFlags)2718c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetFlags(DWORD *pdwFlags)
2719c2c66affSColin Finck {
27205b78381aSWhindmar Saksit     *pdwFlags = m_BrowserSvcFlags;
27215b78381aSWhindmar Saksit     return S_OK;
2722c2c66affSColin Finck }
2723c2c66affSColin Finck 
CanNavigateNow()2724c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CanNavigateNow()
2725c2c66affSColin Finck {
2726c2c66affSColin Finck     return E_NOTIMPL;
2727c2c66affSColin Finck }
2728c2c66affSColin Finck 
GetPidl(LPITEMIDLIST * ppidl)2729c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPidl(LPITEMIDLIST *ppidl)
2730c2c66affSColin Finck {
2731c2c66affSColin Finck     // called by explorer bar to get current pidl
273211ea1d61SWhindmar Saksit     return ppidl ? SHILClone(fCurrentDirectoryPIDL, ppidl) : E_POINTER;
2733c2c66affSColin Finck }
2734c2c66affSColin Finck 
SetReferrer(LPCITEMIDLIST pidl)2735c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetReferrer(LPCITEMIDLIST pidl)
2736c2c66affSColin Finck {
2737c2c66affSColin Finck     return E_NOTIMPL;
2738c2c66affSColin Finck }
2739c2c66affSColin Finck 
GetBrowserIndex()2740c2c66affSColin Finck DWORD STDMETHODCALLTYPE CShellBrowser::GetBrowserIndex()
2741c2c66affSColin Finck {
2742c2c66affSColin Finck     return -1;
2743c2c66affSColin Finck }
2744c2c66affSColin Finck 
GetBrowserByIndex(DWORD dwID,IUnknown ** ppunk)2745c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
2746c2c66affSColin Finck {
2747c2c66affSColin Finck     return E_NOTIMPL;
2748c2c66affSColin Finck }
2749c2c66affSColin Finck 
GetHistoryObject(IOleObject ** ppole,IStream ** pstm,IBindCtx ** ppbc)2750c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc)
2751c2c66affSColin Finck {
2752c2c66affSColin Finck     if (ppole == NULL || pstm == NULL || ppbc == NULL)
2753c2c66affSColin Finck         return E_INVALIDARG;
2754c2c66affSColin Finck     *ppole = fHistoryObject;
2755c2c66affSColin Finck     if (fHistoryObject != NULL)
2756c2c66affSColin Finck         fHistoryObject->AddRef();
2757c2c66affSColin Finck     *pstm = fHistoryStream;
2758c2c66affSColin Finck     if (fHistoryStream != NULL)
2759c2c66affSColin Finck         fHistoryStream->AddRef();
2760c2c66affSColin Finck     *ppbc = fHistoryBindContext;
2761c2c66affSColin Finck     if (fHistoryBindContext != NULL)
2762c2c66affSColin Finck         fHistoryBindContext->AddRef();
2763c2c66affSColin Finck     fHistoryObject = NULL;
2764c2c66affSColin Finck     fHistoryStream = NULL;
2765c2c66affSColin Finck     fHistoryBindContext = NULL;
2766c2c66affSColin Finck     if (*ppole == NULL)
2767c2c66affSColin Finck         return E_FAIL;
2768c2c66affSColin Finck     return S_OK;
2769c2c66affSColin Finck }
2770c2c66affSColin Finck 
SetHistoryObject(IOleObject * pole,BOOL fIsLocalAnchor)2771c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor)
2772c2c66affSColin Finck {
2773c2c66affSColin Finck     return E_NOTIMPL;
2774c2c66affSColin Finck }
2775c2c66affSColin Finck 
CacheOLEServer(IOleObject * pole)2776c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CacheOLEServer(IOleObject *pole)
2777c2c66affSColin Finck {
2778c2c66affSColin Finck     return E_NOTIMPL;
2779c2c66affSColin Finck }
2780c2c66affSColin Finck 
GetSetCodePage(VARIANT * pvarIn,VARIANT * pvarOut)2781c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut)
2782c2c66affSColin Finck {
2783c2c66affSColin Finck     return E_NOTIMPL;
2784c2c66affSColin Finck }
2785c2c66affSColin Finck 
OnHttpEquiv(IShellView * psv,BOOL fDone,VARIANT * pvarargIn,VARIANT * pvarargOut)2786c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnHttpEquiv(
2787c2c66affSColin Finck     IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2788c2c66affSColin Finck {
2789c2c66affSColin Finck     return E_NOTIMPL;
2790c2c66affSColin Finck }
2791c2c66affSColin Finck 
GetPalette(HPALETTE * hpal)2792c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPalette(HPALETTE *hpal)
2793c2c66affSColin Finck {
2794c2c66affSColin Finck     return E_NOTIMPL;
2795c2c66affSColin Finck }
2796c2c66affSColin Finck 
RegisterWindow(BOOL fForceRegister,int swc)2797c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::RegisterWindow(BOOL fForceRegister, int swc)
2798c2c66affSColin Finck {
2799c2c66affSColin Finck     return E_NOTIMPL;
2800c2c66affSColin Finck }
2801c2c66affSColin Finck 
WndProcBS(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)2802c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2803c2c66affSColin Finck {
2804c2c66affSColin Finck     return E_NOTIMPL;
2805c2c66affSColin Finck }
2806c2c66affSColin Finck 
SetAsDefFolderSettings()2807c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetAsDefFolderSettings()
2808c2c66affSColin Finck {
2809c97c1ad4SWhindmar Saksit     HRESULT hr = E_FAIL;
2810c97c1ad4SWhindmar Saksit     if (fCurrentShellView)
2811c97c1ad4SWhindmar Saksit     {
2812c97c1ad4SWhindmar Saksit         hr = ApplyBrowserDefaultFolderSettings(fCurrentShellView);
2813c97c1ad4SWhindmar Saksit         IUnknown_Exec(fCurrentShellView, CGID_DefView, DVCMDID_SET_DEFAULTFOLDER_SETTINGS, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
2814c97c1ad4SWhindmar Saksit     }
2815c97c1ad4SWhindmar Saksit     return hr;
2816c2c66affSColin Finck }
2817c2c66affSColin Finck 
GetViewRect(RECT * prc)2818c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewRect(RECT *prc)
2819c2c66affSColin Finck {
2820c2c66affSColin Finck     return E_NOTIMPL;
2821c2c66affSColin Finck }
2822c2c66affSColin Finck 
OnSize(WPARAM wParam)2823c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnSize(WPARAM wParam)
2824c2c66affSColin Finck {
2825c2c66affSColin Finck     return E_NOTIMPL;
2826c2c66affSColin Finck }
2827c2c66affSColin Finck 
OnCreate(struct tagCREATESTRUCTW * pcs)2828c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnCreate(struct tagCREATESTRUCTW *pcs)
2829c2c66affSColin Finck {
2830c2c66affSColin Finck     m_hAccel = LoadAcceleratorsW(GetModuleHandle(L"browseui.dll"), MAKEINTRESOURCEW(256));
2831c2c66affSColin Finck     return S_OK;
2832c2c66affSColin Finck }
2833c2c66affSColin Finck 
OnCommand(WPARAM wParam,LPARAM lParam)2834c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::OnCommand(WPARAM wParam, LPARAM lParam)
2835c2c66affSColin Finck {
2836c2c66affSColin Finck     return 0;
2837c2c66affSColin Finck }
2838c2c66affSColin Finck 
OnDestroy()2839c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnDestroy()
2840c2c66affSColin Finck {
2841c2c66affSColin Finck     return E_NOTIMPL;
2842c2c66affSColin Finck }
2843c2c66affSColin Finck 
OnNotify(struct tagNMHDR * pnm)2844c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::OnNotify(struct tagNMHDR *pnm)
2845c2c66affSColin Finck {
2846c2c66affSColin Finck     return 0;
2847c2c66affSColin Finck }
2848c2c66affSColin Finck 
OnSetFocus()2849c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnSetFocus()
2850c2c66affSColin Finck {
2851c2c66affSColin Finck     return E_NOTIMPL;
2852c2c66affSColin Finck }
2853c2c66affSColin Finck 
OnFrameWindowActivateBS(BOOL fActive)2854c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::OnFrameWindowActivateBS(BOOL fActive)
2855c2c66affSColin Finck {
2856c2c66affSColin Finck     return E_NOTIMPL;
2857c2c66affSColin Finck }
2858c2c66affSColin Finck 
ReleaseShellView()2859c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ReleaseShellView()
2860c2c66affSColin Finck {
2861c2c66affSColin Finck     return E_NOTIMPL;
2862c2c66affSColin Finck }
2863c2c66affSColin Finck 
ActivatePendingView()2864c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ActivatePendingView()
2865c2c66affSColin Finck {
2866c2c66affSColin Finck     return E_NOTIMPL;
2867c2c66affSColin Finck }
2868c2c66affSColin Finck 
CreateViewWindow(IShellView * psvNew,IShellView * psvOld,LPRECT prcView,HWND * phwnd)2869c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CreateViewWindow(
2870c2c66affSColin Finck     IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2871c2c66affSColin Finck {
2872c2c66affSColin Finck     return E_NOTIMPL;
2873c2c66affSColin Finck }
2874c2c66affSColin Finck 
CreateBrowserPropSheetExt(REFIID riid,void ** ppv)2875c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::CreateBrowserPropSheetExt(REFIID riid, void **ppv)
2876c2c66affSColin Finck {
2877c2c66affSColin Finck     return E_NOTIMPL;
2878c2c66affSColin Finck }
2879c2c66affSColin Finck 
GetViewWindow(HWND * phwndView)2880c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewWindow(HWND *phwndView)
2881c2c66affSColin Finck {
2882c2c66affSColin Finck     return E_NOTIMPL;
2883c2c66affSColin Finck }
2884c2c66affSColin Finck 
GetBaseBrowserData(LPCBASEBROWSERDATA * pbbd)2885c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd)
2886c2c66affSColin Finck {
2887c2c66affSColin Finck     return E_NOTIMPL;
2888c2c66affSColin Finck }
2889c2c66affSColin Finck 
PutBaseBrowserData()2890c2c66affSColin Finck LPBASEBROWSERDATA STDMETHODCALLTYPE CShellBrowser::PutBaseBrowserData()
2891c2c66affSColin Finck {
2892c2c66affSColin Finck     return NULL;
2893c2c66affSColin Finck }
2894c2c66affSColin Finck 
InitializeTravelLog(ITravelLog * ptl,DWORD dw)2895c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTravelLog(ITravelLog *ptl, DWORD dw)
2896c2c66affSColin Finck {
2897c2c66affSColin Finck     return E_NOTIMPL;
2898c2c66affSColin Finck }
2899c2c66affSColin Finck 
SetTopBrowser()2900c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetTopBrowser()
2901c2c66affSColin Finck {
29025b78381aSWhindmar Saksit     m_BrowserSvcFlags |= BSF_TOPBROWSER;
29035b78381aSWhindmar Saksit     return S_OK;
2904c2c66affSColin Finck }
2905c2c66affSColin Finck 
Offline(int iCmd)2906c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Offline(int iCmd)
2907c2c66affSColin Finck {
2908c2c66affSColin Finck     return E_NOTIMPL;
2909c2c66affSColin Finck }
2910c2c66affSColin Finck 
AllowViewResize(BOOL f)2911c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::AllowViewResize(BOOL f)
2912c2c66affSColin Finck {
2913c2c66affSColin Finck     return E_NOTIMPL;
2914c2c66affSColin Finck }
2915c2c66affSColin Finck 
SetActivateState(UINT u)2916c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetActivateState(UINT u)
2917c2c66affSColin Finck {
2918c2c66affSColin Finck     return E_NOTIMPL;
2919c2c66affSColin Finck }
2920c2c66affSColin Finck 
UpdateSecureLockIcon(int eSecureLock)2921c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateSecureLockIcon(int eSecureLock)
2922c2c66affSColin Finck {
2923c2c66affSColin Finck     return E_NOTIMPL;
2924c2c66affSColin Finck }
2925c2c66affSColin Finck 
InitializeDownloadManager()2926c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeDownloadManager()
2927c2c66affSColin Finck {
2928c2c66affSColin Finck     return E_NOTIMPL;
2929c2c66affSColin Finck }
2930c2c66affSColin Finck 
InitializeTransitionSite()2931c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTransitionSite()
2932c2c66affSColin Finck {
2933c2c66affSColin Finck     return E_NOTIMPL;
2934c2c66affSColin Finck }
2935c2c66affSColin Finck 
_Initialize(HWND hwnd,IUnknown * pauto)2936c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_Initialize(HWND hwnd, IUnknown *pauto)
2937c2c66affSColin Finck {
2938c2c66affSColin Finck     return E_NOTIMPL;
2939c2c66affSColin Finck }
2940c2c66affSColin Finck 
_CancelPendingNavigationAsync()2941c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingNavigationAsync()
2942c2c66affSColin Finck {
2943c2c66affSColin Finck     return E_NOTIMPL;
2944c2c66affSColin Finck }
2945c2c66affSColin Finck 
_CancelPendingView()2946c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingView()
2947c2c66affSColin Finck {
2948c2c66affSColin Finck     return E_NOTIMPL;
2949c2c66affSColin Finck }
2950c2c66affSColin Finck 
_MaySaveChanges()2951c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_MaySaveChanges()
2952c2c66affSColin Finck {
2953c2c66affSColin Finck     return E_NOTIMPL;
2954c2c66affSColin Finck }
2955c2c66affSColin Finck 
_PauseOrResumeView(BOOL fPaused)2956c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_PauseOrResumeView(BOOL fPaused)
2957c2c66affSColin Finck {
2958c2c66affSColin Finck     return E_NOTIMPL;
2959c2c66affSColin Finck }
2960c2c66affSColin Finck 
_DisableModeless()2961c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_DisableModeless()
2962c2c66affSColin Finck {
2963c2c66affSColin Finck     return E_NOTIMPL;
2964c2c66affSColin Finck }
2965c2c66affSColin Finck 
_NavigateToPidl(LPCITEMIDLIST pidl,DWORD grfHLNF,DWORD dwFlags)2966c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags)
2967c2c66affSColin Finck {
29685b78381aSWhindmar Saksit     const UINT navflags = HLNF_NAVIGATINGBACK | HLNF_NAVIGATINGFORWARD;
29695b78381aSWhindmar Saksit     if ((grfHLNF & navflags) && grfHLNF != ~0ul)
29705b78381aSWhindmar Saksit     {
29715b78381aSWhindmar Saksit         UINT SbspFlags = (grfHLNF & HLNF_NAVIGATINGBACK) ? SBSP_NAVIGATEBACK : SBSP_NAVIGATEFORWARD;
29725b78381aSWhindmar Saksit         if (grfHLNF & SHHLNF_WRITENOHISTORY)
29735b78381aSWhindmar Saksit             SbspFlags |= SBSP_WRITENOHISTORY;
29745b78381aSWhindmar Saksit         if (grfHLNF & SHHLNF_NOAUTOSELECT)
29755b78381aSWhindmar Saksit             SbspFlags |= SBSP_NOAUTOSELECT;
29765b78381aSWhindmar Saksit         return BrowseObject(pidl, SbspFlags);
29775b78381aSWhindmar Saksit     }
2978c2c66affSColin Finck     return E_NOTIMPL;
2979c2c66affSColin Finck }
2980c2c66affSColin Finck 
_TryShell2Rename(IShellView * psv,LPCITEMIDLIST pidlNew)2981c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew)
2982c2c66affSColin Finck {
2983c2c66affSColin Finck     return E_NOTIMPL;
2984c2c66affSColin Finck }
2985c2c66affSColin Finck 
_SwitchActivationNow()2986c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SwitchActivationNow()
2987c2c66affSColin Finck {
2988c2c66affSColin Finck     return E_NOTIMPL;
2989c2c66affSColin Finck }
2990c2c66affSColin Finck 
_ExecChildren(IUnknown * punkBar,BOOL fBroadcast,const GUID * pguidCmdGroup,DWORD nCmdID,DWORD nCmdexecopt,VARIANTARG * pvarargIn,VARIANTARG * pvarargOut)2991c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
2992c2c66affSColin Finck     const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2993c2c66affSColin Finck {
2994c2c66affSColin Finck     return E_NOTIMPL;
2995c2c66affSColin Finck }
2996c2c66affSColin Finck 
_SendChildren(HWND hwndBar,BOOL fBroadcast,UINT uMsg,WPARAM wParam,LPARAM lParam)2997c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SendChildren(
2998c2c66affSColin Finck     HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2999c2c66affSColin Finck {
3000c2c66affSColin Finck     return E_NOTIMPL;
3001c2c66affSColin Finck }
3002c2c66affSColin Finck 
GetFolderSetData(struct tagFolderSetData * pfsd)3003c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetFolderSetData(struct tagFolderSetData *pfsd)
3004c2c66affSColin Finck {
3005c2c66affSColin Finck     return E_NOTIMPL;
3006c2c66affSColin Finck }
3007c2c66affSColin Finck 
_OnFocusChange(UINT itb)3008c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_OnFocusChange(UINT itb)
3009c2c66affSColin Finck {
3010c2c66affSColin Finck     return E_NOTIMPL;
3011c2c66affSColin Finck }
3012c2c66affSColin Finck 
v_ShowHideChildWindows(BOOL fChildOnly)3013c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_ShowHideChildWindows(BOOL fChildOnly)
3014c2c66affSColin Finck {
3015c2c66affSColin Finck     return E_NOTIMPL;
3016c2c66affSColin Finck }
3017c2c66affSColin Finck 
_get_itbLastFocus()3018c2c66affSColin Finck UINT STDMETHODCALLTYPE CShellBrowser::_get_itbLastFocus()
3019c2c66affSColin Finck {
3020c2c66affSColin Finck     return 0;
3021c2c66affSColin Finck }
3022c2c66affSColin Finck 
_put_itbLastFocus(UINT itbLastFocus)3023c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_put_itbLastFocus(UINT itbLastFocus)
3024c2c66affSColin Finck {
3025c2c66affSColin Finck     return E_NOTIMPL;
3026c2c66affSColin Finck }
3027c2c66affSColin Finck 
_UIActivateView(UINT uState)3028c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_UIActivateView(UINT uState)
3029c2c66affSColin Finck {
3030c2c66affSColin Finck     return E_NOTIMPL;
3031c2c66affSColin Finck }
3032c2c66affSColin Finck 
_GetViewBorderRect(RECT * prc)3033c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetViewBorderRect(RECT *prc)
3034c2c66affSColin Finck {
3035c2c66affSColin Finck     return E_NOTIMPL;
3036c2c66affSColin Finck }
3037c2c66affSColin Finck 
_UpdateViewRectSize()3038c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_UpdateViewRectSize()
3039c2c66affSColin Finck {
3040c2c66affSColin Finck     return E_NOTIMPL;
3041c2c66affSColin Finck }
3042c2c66affSColin Finck 
_ResizeNextBorder(UINT itb)3043c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorder(UINT itb)
3044c2c66affSColin Finck {
3045c2c66affSColin Finck     return E_NOTIMPL;
3046c2c66affSColin Finck }
3047c2c66affSColin Finck 
_ResizeView()3048c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeView()
3049c2c66affSColin Finck {
3050c2c66affSColin Finck     return E_NOTIMPL;
3051c2c66affSColin Finck }
3052c2c66affSColin Finck 
_GetEffectiveClientArea(LPRECT lprectBorder,HMONITOR hmon)3053c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon)
3054c2c66affSColin Finck {
3055c2c66affSColin Finck     return E_NOTIMPL;
3056c2c66affSColin Finck }
3057c2c66affSColin Finck 
v_GetViewStream(LPCITEMIDLIST pidl,DWORD grfMode,LPCWSTR pwszName)3058c2c66affSColin Finck IStream *STDMETHODCALLTYPE CShellBrowser::v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName)
3059c2c66affSColin Finck {
3060c2c66affSColin Finck     return NULL;
3061c2c66affSColin Finck }
3062c2c66affSColin Finck 
ForwardViewMsg(UINT uMsg,WPARAM wParam,LPARAM lParam)3063c2c66affSColin Finck LRESULT STDMETHODCALLTYPE CShellBrowser::ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
3064c2c66affSColin Finck {
3065c2c66affSColin Finck     return 0;
3066c2c66affSColin Finck }
3067c2c66affSColin Finck 
SetAcceleratorMenu(HACCEL hacc)3068c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetAcceleratorMenu(HACCEL hacc)
3069c2c66affSColin Finck {
3070c2c66affSColin Finck     return E_NOTIMPL;
3071c2c66affSColin Finck }
3072c2c66affSColin Finck 
_GetToolbarCount()3073c2c66affSColin Finck int STDMETHODCALLTYPE CShellBrowser::_GetToolbarCount()
3074c2c66affSColin Finck {
3075c2c66affSColin Finck     return 0;
3076c2c66affSColin Finck }
3077c2c66affSColin Finck 
_GetToolbarItem(int itb)3078c2c66affSColin Finck LPTOOLBARITEM STDMETHODCALLTYPE CShellBrowser::_GetToolbarItem(int itb)
3079c2c66affSColin Finck {
3080c2c66affSColin Finck     return NULL;
3081c2c66affSColin Finck }
3082c2c66affSColin Finck 
_SaveToolbars(IStream * pstm)3083c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SaveToolbars(IStream *pstm)
3084c2c66affSColin Finck {
3085c2c66affSColin Finck     return E_NOTIMPL;
3086c2c66affSColin Finck }
3087c2c66affSColin Finck 
_LoadToolbars(IStream * pstm)3088c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_LoadToolbars(IStream *pstm)
3089c2c66affSColin Finck {
3090c2c66affSColin Finck     return E_NOTIMPL;
3091c2c66affSColin Finck }
3092c2c66affSColin Finck 
_CloseAndReleaseToolbars(BOOL fClose)3093c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_CloseAndReleaseToolbars(BOOL fClose)
3094c2c66affSColin Finck {
3095c2c66affSColin Finck     return E_NOTIMPL;
3096c2c66affSColin Finck }
3097c2c66affSColin Finck 
v_MayGetNextToolbarFocus(LPMSG lpMsg,UINT itbNext,int citb,LPTOOLBARITEM * pptbi,HWND * phwnd)3098c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayGetNextToolbarFocus(
3099c2c66affSColin Finck     LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
3100c2c66affSColin Finck {
3101c2c66affSColin Finck     return E_NOTIMPL;
3102c2c66affSColin Finck }
3103c2c66affSColin Finck 
_ResizeNextBorderHelper(UINT itb,BOOL bUseHmonitor)3104c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor)
3105c2c66affSColin Finck {
3106c2c66affSColin Finck     return E_NOTIMPL;
3107c2c66affSColin Finck }
3108c2c66affSColin Finck 
_FindTBar(IUnknown * punkSrc)3109c2c66affSColin Finck UINT STDMETHODCALLTYPE CShellBrowser::_FindTBar(IUnknown *punkSrc)
3110c2c66affSColin Finck {
3111c2c66affSColin Finck     return 0;
3112c2c66affSColin Finck }
3113c2c66affSColin Finck 
_SetFocus(LPTOOLBARITEM ptbi,HWND hwnd,LPMSG lpMsg)3114c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
3115c2c66affSColin Finck {
3116c2c66affSColin Finck     return E_NOTIMPL;
3117c2c66affSColin Finck }
3118c2c66affSColin Finck 
v_MayTranslateAccelerator(MSG * pmsg)3119c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg)
3120c2c66affSColin Finck {
3121c2c66affSColin Finck     for (int i = 0; i < 3; i++)
3122c2c66affSColin Finck     {
3123c2c66affSColin Finck         if (IUnknown_TranslateAcceleratorIO(fClientBars[i].clientBar, pmsg) == S_OK)
3124c2c66affSColin Finck             return S_OK;
3125c2c66affSColin Finck     }
3126c2c66affSColin Finck 
3127c2c66affSColin Finck     if (!fCurrentShellView)
3128c2c66affSColin Finck         return S_FALSE;
3129c2c66affSColin Finck 
3130c2c66affSColin Finck     return fCurrentShellView->TranslateAcceleratorW(pmsg);
3131c2c66affSColin Finck }
3132c2c66affSColin Finck 
_GetBorderDWHelper(IUnknown * punkSrc,LPRECT lprectBorder,BOOL bUseHmonitor)3133c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor)
3134c2c66affSColin Finck {
3135c2c66affSColin Finck     return E_NOTIMPL;
3136c2c66affSColin Finck }
3137c2c66affSColin Finck 
v_CheckZoneCrossing(LPCITEMIDLIST pidl)3138c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
3139c2c66affSColin Finck {
3140c2c66affSColin Finck     return E_NOTIMPL;
3141c2c66affSColin Finck }
3142c2c66affSColin Finck 
GoBack()3143c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoBack()
3144c2c66affSColin Finck {
3145c2c66affSColin Finck     CComPtr<ITravelLog> travelLog;
3146c2c66affSColin Finck     HRESULT hResult = GetTravelLog(&travelLog);
3147c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3148c2c66affSColin Finck         return hResult;
3149c2c66affSColin Finck     return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
3150c2c66affSColin Finck }
3151c2c66affSColin Finck 
GoForward()3152c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoForward()
3153c2c66affSColin Finck {
3154c2c66affSColin Finck     CComPtr<ITravelLog> travelLog;
3155c2c66affSColin Finck     HRESULT hResult = GetTravelLog(&travelLog);
3156c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3157c2c66affSColin Finck         return hResult;
3158c2c66affSColin Finck     return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
3159c2c66affSColin Finck }
3160c2c66affSColin Finck 
GoHome()3161c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoHome()
3162c2c66affSColin Finck {
3163c2c66affSColin Finck     return E_NOTIMPL;
3164c2c66affSColin Finck }
3165c2c66affSColin Finck 
GoSearch()3166c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GoSearch()
3167c2c66affSColin Finck {
3168c2c66affSColin Finck     return E_NOTIMPL;
3169c2c66affSColin Finck }
3170c2c66affSColin Finck 
Navigate(BSTR URL,VARIANT * Flags,VARIANT * TargetFrameName,VARIANT * PostData,VARIANT * Headers)3171c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate(BSTR URL, VARIANT *Flags,
3172c2c66affSColin Finck     VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3173c2c66affSColin Finck {
3174c2c66affSColin Finck     CComHeapPtr<ITEMIDLIST> pidl;
3175c2c66affSColin Finck     HRESULT hResult;
3176c2c66affSColin Finck     CComPtr<IShellFolder> pDesktop;
3177c2c66affSColin Finck 
3178c2c66affSColin Finck     hResult = SHGetDesktopFolder(&pDesktop);
3179c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3180c2c66affSColin Finck         return hResult;
3181c2c66affSColin Finck     hResult = pDesktop->ParseDisplayName(NULL, NULL, URL, NULL, &pidl, NULL);
3182c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3183c2c66affSColin Finck         return hResult;
3184c2c66affSColin Finck     return BrowseObject(pidl, 1);
3185c2c66affSColin Finck }
3186c2c66affSColin Finck 
Refresh()3187c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh()
3188c2c66affSColin Finck {
3189c2c66affSColin Finck     VARIANT                                 level;
3190c2c66affSColin Finck 
3191c2c66affSColin Finck     V_VT(&level) = VT_I4;
3192c2c66affSColin Finck     V_I4(&level) = 4;
3193c2c66affSColin Finck     return Refresh2(&level);
3194c2c66affSColin Finck }
3195c2c66affSColin Finck 
Refresh2(VARIANT * Level)3196c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh2(VARIANT *Level)
3197c2c66affSColin Finck {
3198c2c66affSColin Finck     CComPtr<IOleCommandTarget>              oleCommandTarget;
3199c2c66affSColin Finck     HRESULT                                 hResult;
3200c2c66affSColin Finck 
3201c2c66affSColin Finck     hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
3202c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3203c2c66affSColin Finck         return hResult;
3204c2c66affSColin Finck     return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
3205c2c66affSColin Finck }
3206c2c66affSColin Finck 
Stop()3207c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Stop()
3208c2c66affSColin Finck {
3209c2c66affSColin Finck     return E_NOTIMPL;
3210c2c66affSColin Finck }
3211c2c66affSColin Finck 
get_Application(IDispatch ** ppDisp)3212c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Application(IDispatch **ppDisp)
3213c2c66affSColin Finck {
3214c2c66affSColin Finck     return E_NOTIMPL;
3215c2c66affSColin Finck }
3216c2c66affSColin Finck 
get_Parent(IDispatch ** ppDisp)3217c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Parent(IDispatch **ppDisp)
3218c2c66affSColin Finck {
3219c2c66affSColin Finck     return E_NOTIMPL;
3220c2c66affSColin Finck }
3221c2c66affSColin Finck 
get_Container(IDispatch ** ppDisp)3222c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Container(IDispatch **ppDisp)
3223c2c66affSColin Finck {
3224c2c66affSColin Finck     return E_NOTIMPL;
3225c2c66affSColin Finck }
3226c2c66affSColin Finck 
get_Document(IDispatch ** ppDisp)3227c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Document(IDispatch **ppDisp)
3228c2c66affSColin Finck {
3229c2c66affSColin Finck     return E_NOTIMPL;
3230c2c66affSColin Finck }
3231c2c66affSColin Finck 
get_TopLevelContainer(VARIANT_BOOL * pBool)3232c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_TopLevelContainer(VARIANT_BOOL *pBool)
3233c2c66affSColin Finck {
3234c2c66affSColin Finck     return E_NOTIMPL;
3235c2c66affSColin Finck }
3236c2c66affSColin Finck 
get_Type(BSTR * Type)3237c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Type(BSTR *Type)
3238c2c66affSColin Finck {
3239c2c66affSColin Finck     return E_NOTIMPL;
3240c2c66affSColin Finck }
3241c2c66affSColin Finck #ifdef __exdisp_h__
3242c2c66affSColin Finck #define long LONG
3243c2c66affSColin Finck #endif
get_Left(long * pl)3244c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(long *pl)
3245c2c66affSColin Finck {
3246c2c66affSColin Finck     return E_NOTIMPL;
3247c2c66affSColin Finck }
3248c2c66affSColin Finck 
put_Left(long Left)3249c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(long Left)
3250c2c66affSColin Finck {
3251c2c66affSColin Finck     return E_NOTIMPL;
3252c2c66affSColin Finck }
3253c2c66affSColin Finck 
get_Top(long * pl)3254c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(long *pl)
3255c2c66affSColin Finck {
3256c2c66affSColin Finck     return E_NOTIMPL;
3257c2c66affSColin Finck }
3258c2c66affSColin Finck 
put_Top(long Top)3259c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(long Top)
3260c2c66affSColin Finck {
3261c2c66affSColin Finck     return E_NOTIMPL;
3262c2c66affSColin Finck }
3263c2c66affSColin Finck 
get_Width(long * pl)3264c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(long *pl)
3265c2c66affSColin Finck {
3266c2c66affSColin Finck     return E_NOTIMPL;
3267c2c66affSColin Finck }
3268c2c66affSColin Finck 
put_Width(long Width)3269c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(long Width)
3270c2c66affSColin Finck {
3271c2c66affSColin Finck     return E_NOTIMPL;
3272c2c66affSColin Finck }
3273c2c66affSColin Finck 
get_Height(long * pl)3274c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(long *pl)
3275c2c66affSColin Finck {
3276c2c66affSColin Finck     return E_NOTIMPL;
3277c2c66affSColin Finck }
3278c2c66affSColin Finck 
put_Height(long Height)3279c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(long Height)
3280c2c66affSColin Finck {
3281c2c66affSColin Finck     return E_NOTIMPL;
3282c2c66affSColin Finck }
3283c2c66affSColin Finck #ifdef __exdisp_h__
3284c2c66affSColin Finck #undef long
3285c2c66affSColin Finck #endif
get_LocationName(BSTR * LocationName)3286c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName)
3287c2c66affSColin Finck {
3288c2c66affSColin Finck     return E_NOTIMPL;
3289c2c66affSColin Finck }
3290c2c66affSColin Finck 
get_LocationURL(BSTR * LocationURL)3291c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationURL(BSTR *LocationURL)
3292c2c66affSColin Finck {
3293c2c66affSColin Finck     return E_NOTIMPL;
3294c2c66affSColin Finck }
3295c2c66affSColin Finck 
get_Busy(VARIANT_BOOL * pBool)3296c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Busy(VARIANT_BOOL *pBool)
3297c2c66affSColin Finck {
3298c2c66affSColin Finck     return E_NOTIMPL;
3299c2c66affSColin Finck }
3300c2c66affSColin Finck 
Quit()3301c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Quit()
3302c2c66affSColin Finck {
3303c2c66affSColin Finck     return E_NOTIMPL;
3304c2c66affSColin Finck }
3305c2c66affSColin Finck 
ClientToWindow(int * pcx,int * pcy)3306c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ClientToWindow(int *pcx, int *pcy)
3307c2c66affSColin Finck {
3308c2c66affSColin Finck     return E_NOTIMPL;
3309c2c66affSColin Finck }
3310c2c66affSColin Finck 
PutProperty(BSTR Property,VARIANT vtValue)3311c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::PutProperty(BSTR Property, VARIANT vtValue)
3312c2c66affSColin Finck {
3313c2c66affSColin Finck     return E_NOTIMPL;
3314c2c66affSColin Finck }
3315c2c66affSColin Finck 
GetProperty(BSTR Property,VARIANT * pvtValue)3316c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetProperty(BSTR Property, VARIANT *pvtValue)
3317c2c66affSColin Finck {
3318c2c66affSColin Finck     return E_NOTIMPL;
3319c2c66affSColin Finck }
3320c2c66affSColin Finck 
get_Name(BSTR * Name)3321c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Name(BSTR *Name)
3322c2c66affSColin Finck {
3323c2c66affSColin Finck     return E_NOTIMPL;
3324c2c66affSColin Finck }
3325c2c66affSColin Finck 
get_HWND(SHANDLE_PTR * pHWND)3326c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_HWND(SHANDLE_PTR *pHWND)
3327c2c66affSColin Finck {
3328c2c66affSColin Finck     return E_NOTIMPL;
3329c2c66affSColin Finck }
3330c2c66affSColin Finck 
get_FullName(BSTR * FullName)3331c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullName(BSTR *FullName)
3332c2c66affSColin Finck {
3333c2c66affSColin Finck     return E_NOTIMPL;
3334c2c66affSColin Finck }
3335c2c66affSColin Finck 
get_Path(BSTR * Path)3336c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Path(BSTR *Path)
3337c2c66affSColin Finck {
3338c2c66affSColin Finck     return E_NOTIMPL;
3339c2c66affSColin Finck }
3340c2c66affSColin Finck 
get_Visible(VARIANT_BOOL * pBool)3341c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Visible(VARIANT_BOOL *pBool)
3342c2c66affSColin Finck {
3343c2c66affSColin Finck     return E_NOTIMPL;
3344c2c66affSColin Finck }
3345c2c66affSColin Finck 
put_Visible(VARIANT_BOOL Value)3346c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Visible(VARIANT_BOOL Value)
3347c2c66affSColin Finck {
3348c2c66affSColin Finck     return E_NOTIMPL;
3349c2c66affSColin Finck }
3350c2c66affSColin Finck 
get_StatusBar(VARIANT_BOOL * pBool)3351c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusBar(VARIANT_BOOL *pBool)
3352c2c66affSColin Finck {
3353c2c66affSColin Finck     return E_NOTIMPL;
3354c2c66affSColin Finck }
3355c2c66affSColin Finck 
put_StatusBar(VARIANT_BOOL Value)3356c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusBar(VARIANT_BOOL Value)
3357c2c66affSColin Finck {
3358c2c66affSColin Finck     return E_NOTIMPL;
3359c2c66affSColin Finck }
3360c2c66affSColin Finck 
get_StatusText(BSTR * StatusText)3361c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusText(BSTR *StatusText)
3362c2c66affSColin Finck {
3363c2c66affSColin Finck     return E_NOTIMPL;
3364c2c66affSColin Finck }
3365c2c66affSColin Finck 
put_StatusText(BSTR StatusText)3366c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusText(BSTR StatusText)
3367c2c66affSColin Finck {
3368c2c66affSColin Finck     return E_NOTIMPL;
3369c2c66affSColin Finck }
3370c2c66affSColin Finck 
get_ToolBar(int * Value)3371c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_ToolBar(int *Value)
3372c2c66affSColin Finck {
3373c2c66affSColin Finck     return E_NOTIMPL;
3374c2c66affSColin Finck }
3375c2c66affSColin Finck 
put_ToolBar(int Value)3376c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_ToolBar(int Value)
3377c2c66affSColin Finck {
3378c2c66affSColin Finck     return E_NOTIMPL;
3379c2c66affSColin Finck }
3380c2c66affSColin Finck 
get_MenuBar(VARIANT_BOOL * Value)3381c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_MenuBar(VARIANT_BOOL *Value)
3382c2c66affSColin Finck {
3383c2c66affSColin Finck     return E_NOTIMPL;
3384c2c66affSColin Finck }
3385c2c66affSColin Finck 
put_MenuBar(VARIANT_BOOL Value)3386c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_MenuBar(VARIANT_BOOL Value)
3387c2c66affSColin Finck {
3388c2c66affSColin Finck     return E_NOTIMPL;
3389c2c66affSColin Finck }
3390c2c66affSColin Finck 
get_FullScreen(VARIANT_BOOL * pbFullScreen)3391c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullScreen(VARIANT_BOOL *pbFullScreen)
3392c2c66affSColin Finck {
3393c2c66affSColin Finck     return E_NOTIMPL;
3394c2c66affSColin Finck }
3395c2c66affSColin Finck 
put_FullScreen(VARIANT_BOOL bFullScreen)3396c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_FullScreen(VARIANT_BOOL bFullScreen)
3397c2c66affSColin Finck {
3398c2c66affSColin Finck     return E_NOTIMPL;
3399c2c66affSColin Finck }
3400c2c66affSColin Finck 
Navigate2(VARIANT * URL,VARIANT * Flags,VARIANT * TargetFrameName,VARIANT * PostData,VARIANT * Headers)3401c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate2(VARIANT *URL, VARIANT *Flags,
3402c2c66affSColin Finck     VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3403c2c66affSColin Finck {
3404c2c66affSColin Finck     LPITEMIDLIST pidl = NULL;
3405c2c66affSColin Finck     HRESULT hResult;
3406c2c66affSColin Finck     // called from drive combo box to navigate to a directory
3407c2c66affSColin Finck     // Also called by search band to display shell results folder view
3408c2c66affSColin Finck 
3409c2c66affSColin Finck     if (V_VT(URL) == VT_BSTR)
3410c2c66affSColin Finck     {
3411c2c66affSColin Finck         return this->Navigate(V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
3412c2c66affSColin Finck     }
3413c2c66affSColin Finck     if (V_VT(URL) == (VT_ARRAY | VT_UI1))
3414c2c66affSColin Finck     {
3415c2c66affSColin Finck         if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
3416c2c66affSColin Finck             return E_INVALIDARG;
3417c2c66affSColin Finck 
3418c2c66affSColin Finck         pidl = static_cast<LPITEMIDLIST>(V_ARRAY(URL)->pvData);
3419c2c66affSColin Finck     }
3420c2c66affSColin Finck     hResult = BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
3421c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3422c2c66affSColin Finck         return hResult;
3423c2c66affSColin Finck     return S_OK;
3424c2c66affSColin Finck }
3425c2c66affSColin Finck 
QueryStatusWB(OLECMDID cmdID,OLECMDF * pcmdf)3426c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf)
3427c2c66affSColin Finck {
3428c2c66affSColin Finck     return E_NOTIMPL;
3429c2c66affSColin Finck }
3430c2c66affSColin Finck 
ExecWB(OLECMDID cmdID,OLECMDEXECOPT cmdexecopt,VARIANT * pvaIn,VARIANT * pvaOut)3431c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
3432c2c66affSColin Finck     VARIANT *pvaIn, VARIANT *pvaOut)
3433c2c66affSColin Finck {
3434c2c66affSColin Finck     return E_NOTIMPL;
3435c2c66affSColin Finck }
3436c2c66affSColin Finck 
ShowBrowserBar(VARIANT * pvaClsid,VARIANT * pvarShow,VARIANT * pvarSize)3437c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize)
3438c2c66affSColin Finck {
3439c2c66affSColin Finck     CLSID                                   classID;
3440c2c66affSColin Finck     bool                                    vertical;
3441c2c66affSColin Finck 
3442c2c66affSColin Finck     // called to show search bar
3443c2c66affSColin Finck     if (V_VT(pvaClsid) != VT_BSTR)
3444c2c66affSColin Finck         return E_INVALIDARG;
3445c2c66affSColin Finck     CLSIDFromString(V_BSTR(pvaClsid), &classID);
3446c2c66affSColin Finck     // TODO: properly compute the value of vertical
3447c2c66affSColin Finck     vertical = true;
3448c2c66affSColin Finck     return ShowBand(classID, vertical);
3449c2c66affSColin Finck }
3450c2c66affSColin Finck 
get_ReadyState(READYSTATE * plReadyState)3451c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_ReadyState(READYSTATE *plReadyState)
3452c2c66affSColin Finck {
3453c2c66affSColin Finck     return E_NOTIMPL;
3454c2c66affSColin Finck }
3455c2c66affSColin Finck 
get_Offline(VARIANT_BOOL * pbOffline)3456c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Offline(VARIANT_BOOL *pbOffline)
3457c2c66affSColin Finck {
3458c2c66affSColin Finck     return E_NOTIMPL;
3459c2c66affSColin Finck }
3460c2c66affSColin Finck 
put_Offline(VARIANT_BOOL bOffline)3461c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Offline(VARIANT_BOOL bOffline)
3462c2c66affSColin Finck {
3463c2c66affSColin Finck     return E_NOTIMPL;
3464c2c66affSColin Finck }
3465c2c66affSColin Finck 
get_Silent(VARIANT_BOOL * pbSilent)3466c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Silent(VARIANT_BOOL *pbSilent)
3467c2c66affSColin Finck {
3468c2c66affSColin Finck     return E_NOTIMPL;
3469c2c66affSColin Finck }
3470c2c66affSColin Finck 
put_Silent(VARIANT_BOOL bSilent)3471c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Silent(VARIANT_BOOL bSilent)
3472c2c66affSColin Finck {
3473c2c66affSColin Finck     return E_NOTIMPL;
3474c2c66affSColin Finck }
3475c2c66affSColin Finck 
get_RegisterAsBrowser(VARIANT_BOOL * pbRegister)3476c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsBrowser(VARIANT_BOOL *pbRegister)
3477c2c66affSColin Finck {
3478c2c66affSColin Finck     return E_NOTIMPL;
3479c2c66affSColin Finck }
3480c2c66affSColin Finck 
put_RegisterAsBrowser(VARIANT_BOOL bRegister)3481c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsBrowser(VARIANT_BOOL bRegister)
3482c2c66affSColin Finck {
3483c2c66affSColin Finck     return E_NOTIMPL;
3484c2c66affSColin Finck }
3485c2c66affSColin Finck 
get_RegisterAsDropTarget(VARIANT_BOOL * pbRegister)3486c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsDropTarget(VARIANT_BOOL *pbRegister)
3487c2c66affSColin Finck {
3488c2c66affSColin Finck     return E_NOTIMPL;
3489c2c66affSColin Finck }
3490c2c66affSColin Finck 
put_RegisterAsDropTarget(VARIANT_BOOL bRegister)3491c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister)
3492c2c66affSColin Finck {
3493c2c66affSColin Finck     return E_NOTIMPL;
3494c2c66affSColin Finck }
3495c2c66affSColin Finck 
get_TheaterMode(VARIANT_BOOL * pbRegister)3496c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_TheaterMode(VARIANT_BOOL *pbRegister)
3497c2c66affSColin Finck {
3498c2c66affSColin Finck     return E_NOTIMPL;
3499c2c66affSColin Finck }
3500c2c66affSColin Finck 
put_TheaterMode(VARIANT_BOOL bRegister)3501c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_TheaterMode(VARIANT_BOOL bRegister)
3502c2c66affSColin Finck {
3503c2c66affSColin Finck     return E_NOTIMPL;
3504c2c66affSColin Finck }
3505c2c66affSColin Finck 
get_AddressBar(VARIANT_BOOL * Value)3506c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_AddressBar(VARIANT_BOOL *Value)
3507c2c66affSColin Finck {
3508c2c66affSColin Finck     return E_NOTIMPL;
3509c2c66affSColin Finck }
3510c2c66affSColin Finck 
put_AddressBar(VARIANT_BOOL Value)3511c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_AddressBar(VARIANT_BOOL Value)
3512c2c66affSColin Finck {
3513c2c66affSColin Finck     return E_NOTIMPL;
3514c2c66affSColin Finck }
3515c2c66affSColin Finck 
get_Resizable(VARIANT_BOOL * Value)3516c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::get_Resizable(VARIANT_BOOL *Value)
3517c2c66affSColin Finck {
3518c2c66affSColin Finck     return E_NOTIMPL;
3519c2c66affSColin Finck }
3520c2c66affSColin Finck 
put_Resizable(VARIANT_BOOL Value)3521c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::put_Resizable(VARIANT_BOOL Value)
3522c2c66affSColin Finck {
3523c2c66affSColin Finck     return E_NOTIMPL;
3524c2c66affSColin Finck }
3525c2c66affSColin Finck 
FindWindowByIndex(DWORD dwID,IUnknown ** ppunk)3526c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::FindWindowByIndex(DWORD dwID, IUnknown **ppunk)
3527c2c66affSColin Finck {
3528c2c66affSColin Finck     return E_NOTIMPL;
3529c2c66affSColin Finck }
3530c2c66affSColin Finck 
GetWindowData(IStream * pStream,LPWINDOWDATA pWinData)3531c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindowData(IStream *pStream, LPWINDOWDATA pWinData)
3532c2c66affSColin Finck {
3533c2c66affSColin Finck     if (pWinData == NULL)
3534c2c66affSColin Finck         return E_POINTER;
3535c2c66affSColin Finck 
3536c2c66affSColin Finck     pWinData->dwWindowID = -1;
3537c2c66affSColin Finck     pWinData->uiCP = 0;
3538c2c66affSColin Finck     pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
3539c2c66affSColin Finck     pWinData->lpszUrl = NULL;
3540c2c66affSColin Finck     pWinData->lpszUrlLocation = NULL;
3541c2c66affSColin Finck     pWinData->lpszTitle = NULL;
3542c2c66affSColin Finck     return S_OK;
3543c2c66affSColin Finck }
3544c2c66affSColin Finck 
LoadHistoryPosition(LPWSTR pszUrlLocation,DWORD dwPosition)3545c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition)
3546c2c66affSColin Finck {
3547c2c66affSColin Finck     return E_NOTIMPL;
3548c2c66affSColin Finck }
3549c2c66affSColin Finck 
GetClassID(CLSID * pClassID)3550c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetClassID(CLSID *pClassID)
3551c2c66affSColin Finck {
3552c2c66affSColin Finck     return E_NOTIMPL;
3553c2c66affSColin Finck }
3554c2c66affSColin Finck 
LoadHistory(IStream * pStream,IBindCtx * pbc)3555c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistory(IStream *pStream, IBindCtx *pbc)
3556c2c66affSColin Finck {
3557c2c66affSColin Finck     CComPtr<IPersistHistory>                viewPersistHistory;
3558c2c66affSColin Finck     CComPtr<IOleObject>                     viewHistoryObject;
3559c2c66affSColin Finck     persistState                            oldState;
3560c2c66affSColin Finck     ULONG                                   numRead;
3561c2c66affSColin Finck     LPITEMIDLIST                            pidl;
3562c2c66affSColin Finck     HRESULT                                 hResult;
3563c2c66affSColin Finck 
3564c2c66affSColin Finck     hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
3565c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3566c2c66affSColin Finck         return hResult;
3567c2c66affSColin Finck     if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
3568c2c66affSColin Finck         return E_FAIL;
3569c2c66affSColin Finck     if (oldState.browseType != 2)
3570c2c66affSColin Finck         return E_FAIL;
3571c2c66affSColin Finck     pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
3572c2c66affSColin Finck     if (pidl == NULL)
3573c2c66affSColin Finck         return E_OUTOFMEMORY;
3574c2c66affSColin Finck     hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
3575c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3576c2c66affSColin Finck     {
3577c2c66affSColin Finck         ILFree(pidl);
3578c2c66affSColin Finck         return hResult;
3579c2c66affSColin Finck     }
3580c2c66affSColin Finck     if (numRead != oldState.pidlSize)
3581c2c66affSColin Finck     {
3582c2c66affSColin Finck         ILFree(pidl);
3583c2c66affSColin Finck         return E_FAIL;
3584c2c66affSColin Finck     }
3585c2c66affSColin Finck     hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
3586c2c66affSColin Finck         IID_PPV_ARG(IOleObject, &viewHistoryObject));
3587c2c66affSColin Finck     fHistoryObject = viewHistoryObject;
3588c2c66affSColin Finck     fHistoryStream = pStream;
3589c2c66affSColin Finck     fHistoryBindContext = pbc;
3590c2c66affSColin Finck     hResult = BrowseToPIDL(pidl, BTP_DONT_UPDATE_HISTORY);
3591c2c66affSColin Finck     fHistoryObject = NULL;
3592c2c66affSColin Finck     fHistoryStream = NULL;
3593c2c66affSColin Finck     fHistoryBindContext = NULL;
3594c2c66affSColin Finck     ILFree(pidl);
3595c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3596c2c66affSColin Finck         return hResult;
3597c2c66affSColin Finck     return S_OK;
3598c2c66affSColin Finck }
3599c2c66affSColin Finck 
SaveHistory(IStream * pStream)3600c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SaveHistory(IStream *pStream)
3601c2c66affSColin Finck {
3602c2c66affSColin Finck     CComPtr<IPersistHistory>                viewPersistHistory;
3603c2c66affSColin Finck     persistState                            newState;
3604c2c66affSColin Finck     HRESULT                                 hResult;
3605c2c66affSColin Finck 
3606c2c66affSColin Finck     hResult = fCurrentShellView->GetItemObject(
3607c2c66affSColin Finck         SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3608c2c66affSColin Finck     memset(&newState, 0, sizeof(newState));
3609c2c66affSColin Finck     newState.dwSize = sizeof(newState);
3610c2c66affSColin Finck     newState.browseType = 2;
3611c2c66affSColin Finck     newState.browserIndex = GetBrowserIndex();
3612c2c66affSColin Finck     if (viewPersistHistory.p != NULL)
3613c2c66affSColin Finck     {
3614c2c66affSColin Finck         hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3615c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
3616c2c66affSColin Finck             return hResult;
3617c2c66affSColin Finck     }
3618c2c66affSColin Finck     newState.pidlSize = ILGetSize(fCurrentDirectoryPIDL);
3619c2c66affSColin Finck     hResult = pStream->Write(&newState, sizeof(newState), NULL);
3620c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3621c2c66affSColin Finck         return hResult;
3622c2c66affSColin Finck     hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3623c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hResult))
3624c2c66affSColin Finck         return hResult;
3625c2c66affSColin Finck     if (viewPersistHistory.p != NULL)
3626c2c66affSColin Finck     {
3627c2c66affSColin Finck         hResult = viewPersistHistory->SaveHistory(pStream);
3628c2c66affSColin Finck         if (FAILED_UNEXPECTEDLY(hResult))
3629c2c66affSColin Finck             return hResult;
3630c2c66affSColin Finck     }
3631c2c66affSColin Finck     return S_OK;
3632c2c66affSColin Finck }
3633c2c66affSColin Finck 
SetPositionCookie(DWORD dwPositioncookie)3634c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::SetPositionCookie(DWORD dwPositioncookie)
3635c2c66affSColin Finck {
3636c2c66affSColin Finck     return E_NOTIMPL;
3637c2c66affSColin Finck }
3638c2c66affSColin Finck 
GetPositionCookie(DWORD * pdwPositioncookie)3639c2c66affSColin Finck HRESULT STDMETHODCALLTYPE CShellBrowser::GetPositionCookie(DWORD *pdwPositioncookie)
3640c2c66affSColin Finck {
3641c2c66affSColin Finck     return E_NOTIMPL;
3642c2c66affSColin Finck }
3643c2c66affSColin Finck 
OnCreate(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3644c2c66affSColin Finck LRESULT CShellBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3645c2c66affSColin Finck {
3646c2c66affSColin Finck     OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3647c2c66affSColin Finck     return 0;
3648c2c66affSColin Finck }
3649c2c66affSColin Finck 
OnDestroy(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3650c2c66affSColin Finck LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3651c2c66affSColin Finck {
3652c2c66affSColin Finck     HRESULT hr;
36536219a1abSWhindmar Saksit     SaveViewState();
3654c2c66affSColin Finck 
3655c2c66affSColin Finck     /* The current thread is about to go down so render any IDataObject that may be left in the clipboard */
3656c2c66affSColin Finck     OleFlushClipboard();
3657c2c66affSColin Finck 
3658c2c66affSColin Finck     // TODO: rip down everything
3659c2c66affSColin Finck     {
36606219a1abSWhindmar Saksit         m_Destroyed = true; // Ignore browse requests from Explorer band TreeView during destruction
3661c2c66affSColin Finck         fToolbarProxy.Destroy();
3662c2c66affSColin Finck         fCurrentShellView->DestroyViewWindow();
3663c2c66affSColin Finck         fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
3664c2c66affSColin Finck 
3665c2c66affSColin Finck         for (int i = 0; i < 3; i++)
3666c2c66affSColin Finck         {
3667c2c66affSColin Finck             CComPtr<IDockingWindow> pdw;
3668c2c66affSColin Finck             CComPtr<IDeskBar> bar;
3669c2c66affSColin Finck             CComPtr<IUnknown> pBarSite;
3670c2c66affSColin Finck             CComPtr<IDeskBarClient> pClient;
3671c2c66affSColin Finck 
3672c2c66affSColin Finck             if (fClientBars[i].clientBar == NULL)
3673c2c66affSColin Finck                 continue;
3674c2c66affSColin Finck 
3675c2c66affSColin Finck             hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
3676c2c66affSColin Finck             if (FAILED_UNEXPECTEDLY(hr))
3677c2c66affSColin Finck                 continue;
3678c2c66affSColin Finck 
3679c2c66affSColin Finck             /* We should destroy our basebarsite too */
3680c2c66affSColin Finck             hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
3681c2c66affSColin Finck             if (SUCCEEDED(hr))
3682c2c66affSColin Finck             {
3683c2c66affSColin Finck                 hr = bar->GetClient(&pBarSite);
3684c2c66affSColin Finck                 if (SUCCEEDED(hr) && pBarSite)
3685c2c66affSColin Finck                 {
3686c2c66affSColin Finck                     hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
3687c2c66affSColin Finck                     if (SUCCEEDED(hr))
3688c2c66affSColin Finck                         pClient->SetDeskBarSite(NULL);
3689c2c66affSColin Finck                 }
3690c2c66affSColin Finck             }
3691c2c66affSColin Finck             pdw->CloseDW(0);
3692c2c66affSColin Finck 
3693c2c66affSColin Finck             pClient = NULL;
3694c2c66affSColin Finck             pBarSite = NULL;
3695c2c66affSColin Finck             pdw = NULL;
3696c2c66affSColin Finck             bar = NULL;
3697c2c66affSColin Finck             ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
3698c2c66affSColin Finck         }
3699c2c66affSColin Finck         ReleaseCComPtrExpectZero(fCurrentShellView);
3700c2c66affSColin Finck         ReleaseCComPtrExpectZero(fTravelLog);
3701c2c66affSColin Finck 
3702c2c66affSColin Finck         fCurrentShellFolder.Release();
3703c2c66affSColin Finck         ILFree(fCurrentDirectoryPIDL);
3704c2c66affSColin Finck         ::DestroyWindow(fStatusBar);
3705c2c66affSColin Finck         DestroyMenu(fCurrentMenuBar);
3706c2c66affSColin Finck     }
3707c2c66affSColin Finck     PostQuitMessage(0);
3708c2c66affSColin Finck     return 0;
3709c2c66affSColin Finck }
3710c2c66affSColin Finck 
OnSize(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3711c2c66affSColin Finck LRESULT CShellBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3712c2c66affSColin Finck {
3713c2c66affSColin Finck     CComPtr<IDockingWindow>                 dockingWindow;
3714c2c66affSColin Finck     RECT                                    availableBounds;
3715bfadb22dSCarl J. Bialorucki     static const INT                        excludeItems[] = {1, 1, 1, IDC_STATUSBAR, 0, 0};
3716c2c66affSColin Finck     HRESULT                                 hResult;
3717c2c66affSColin Finck 
3718c2c66affSColin Finck     if (wParam != SIZE_MINIMIZED)
3719c2c66affSColin Finck     {
3720c2c66affSColin Finck         GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3721c2c66affSColin Finck         for (INT x = 0; x < 3; x++)
3722c2c66affSColin Finck         {
3723c2c66affSColin Finck             if (fClientBars[x].clientBar != NULL)
3724c2c66affSColin Finck             {
3725c2c66affSColin Finck                 hResult = fClientBars[x].clientBar->QueryInterface(
3726c2c66affSColin Finck                     IID_PPV_ARG(IDockingWindow, &dockingWindow));
3727c2c66affSColin Finck                 if (SUCCEEDED(hResult) && dockingWindow != NULL)
3728c2c66affSColin Finck                 {
3729c2c66affSColin Finck                     hResult = dockingWindow->ResizeBorderDW(
3730c2c66affSColin Finck                         &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3731c2c66affSColin Finck                     break;
3732c2c66affSColin Finck                 }
3733c2c66affSColin Finck             }
3734c2c66affSColin Finck         }
3735c2c66affSColin Finck         RepositionBars();
3736c2c66affSColin Finck     }
3737c2c66affSColin Finck     return 1;
3738c2c66affSColin Finck }
3739c2c66affSColin Finck 
OnInitMenuPopup(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3740c2c66affSColin Finck LRESULT CShellBrowser::OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3741c2c66affSColin Finck {
3742c2c66affSColin Finck     HMENU  theMenu;
3743c2c66affSColin Finck     LPARAM menuIndex = lParam;
3744c2c66affSColin Finck 
3745c2c66affSColin Finck     theMenu = reinterpret_cast<HMENU>(wParam);
3746c2c66affSColin Finck 
3747c2c66affSColin Finck     if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_FILE))
3748c2c66affSColin Finck     {
3749c2c66affSColin Finck         menuIndex = 0;
3750c2c66affSColin Finck     }
3751c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_EDIT))
3752c2c66affSColin Finck     {
3753c2c66affSColin Finck         menuIndex = 1;
3754c2c66affSColin Finck     }
3755c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3756c2c66affSColin Finck     {
3757c2c66affSColin Finck         UpdateViewMenu(theMenu);
3758c2c66affSColin Finck         menuIndex = 2;
3759c2c66affSColin Finck     }
3760c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_FAVORITES))
3761c2c66affSColin Finck     {
3762c2c66affSColin Finck         menuIndex = 3;
3763c2c66affSColin Finck     }
3764c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_TOOLS))
3765c2c66affSColin Finck     {
3766c2c66affSColin Finck         // FIXME: Remove once implemented
3767c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_TOOLS_MAPNETWORKDRIVE, FALSE);
3768c2c66affSColin Finck         SHEnableMenuItem(theMenu, IDM_TOOLS_SYNCHRONIZE, FALSE);
3769c2c66affSColin Finck         menuIndex = 4;
3770c2c66affSColin Finck     }
3771c2c66affSColin Finck     else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP))
3772c2c66affSColin Finck     {
3773c2c66affSColin Finck         menuIndex = 5;
3774c2c66affSColin Finck     }
3775c2c66affSColin Finck 
3776c2c66affSColin Finck     LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
3777c2c66affSColin Finck 
3778c2c66affSColin Finck     return ret;
3779c2c66affSColin Finck }
3780c2c66affSColin Finck 
OnSetFocus(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3781c2c66affSColin Finck LRESULT CShellBrowser::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3782c2c66affSColin Finck {
3783c2c66affSColin Finck     ::SetFocus(fCurrentShellViewWindow);
3784c2c66affSColin Finck     return 0;
3785c2c66affSColin Finck }
3786c2c66affSColin Finck 
RelayMsgToShellView(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3787c2c66affSColin Finck LRESULT CShellBrowser::RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3788c2c66affSColin Finck {
3789c2c66affSColin Finck     if (fCurrentShellViewWindow != NULL)
3790c2c66affSColin Finck         return SendMessage(fCurrentShellViewWindow, uMsg, wParam, lParam);
3791c2c66affSColin Finck     return 0;
3792c2c66affSColin Finck }
3793c2c66affSColin Finck 
OnSettingChange(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3794a882ec7aSKatayama Hirofumi MZ LRESULT CShellBrowser::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3795c2c66affSColin Finck {
3796f744bb29SCarl J. Bialorucki     RefreshCabinetState();
3797c2c66affSColin Finck     SHPropagateMessage(m_hWnd, uMsg, wParam, lParam, TRUE);
3798c2c66affSColin Finck     return 0;
3799c2c66affSColin Finck }
3800c2c66affSColin Finck 
OnSysColorChange(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)3801*751641c2SWhindmar Saksit LRESULT CShellBrowser::OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3802*751641c2SWhindmar Saksit {
3803*751641c2SWhindmar Saksit     SHPropagateMessage(m_hWnd, uMsg, wParam, lParam, TRUE);
3804*751641c2SWhindmar Saksit     return 0;
3805*751641c2SWhindmar Saksit }
3806*751641c2SWhindmar Saksit 
OnClose(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3807c2c66affSColin Finck LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3808c2c66affSColin Finck {
3809c2c66affSColin Finck     return SendMessage(WM_CLOSE);
3810c2c66affSColin Finck }
3811c2c66affSColin Finck 
OnFolderOptions(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3812c2c66affSColin Finck LRESULT CShellBrowser::OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3813c2c66affSColin Finck {
3814c2c66affSColin Finck     HRESULT hResult = DoFolderOptions();
3815c2c66affSColin Finck     if (FAILED(hResult))
3816c2c66affSColin Finck         TRACE("DoFolderOptions failed with hResult=%08lx\n", hResult);
3817c2c66affSColin Finck     return 0;
3818c2c66affSColin Finck }
3819c2c66affSColin Finck 
OnMapNetworkDrive(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3820c2c66affSColin Finck LRESULT CShellBrowser::OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3821c2c66affSColin Finck {
3822c2c66affSColin Finck #ifndef __REACTOS__
3823c2c66affSColin Finck     WNetConnectionDialog(m_hWnd, RESOURCETYPE_DISK);
3824c2c66affSColin Finck #endif /* __REACTOS__ */
3825c2c66affSColin Finck     return 0;
3826c2c66affSColin Finck }
3827c2c66affSColin Finck 
OnDisconnectNetworkDrive(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3828c2c66affSColin Finck LRESULT CShellBrowser::OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3829c2c66affSColin Finck {
3830c2c66affSColin Finck     WNetDisconnectDialog(m_hWnd, RESOURCETYPE_DISK);
3831c2c66affSColin Finck     return 0;
3832c2c66affSColin Finck }
3833c2c66affSColin Finck 
OnAboutReactOS(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3834c2c66affSColin Finck LRESULT CShellBrowser::OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3835c2c66affSColin Finck {
383615bc263bSHermès Bélusca-Maïto     ShellAbout(m_hWnd, _T("ReactOS"), NULL, NULL);
3837c2c66affSColin Finck     return 0;
3838c2c66affSColin Finck }
3839c2c66affSColin Finck 
OnGoBack(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3840c2c66affSColin Finck LRESULT CShellBrowser::OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3841c2c66affSColin Finck {
3842c2c66affSColin Finck     HRESULT hResult = GoBack();
3843c2c66affSColin Finck     if (FAILED(hResult))
3844c2c66affSColin Finck         TRACE("GoBack failed with hResult=%08lx\n", hResult);
3845c2c66affSColin Finck     return 0;
3846c2c66affSColin Finck }
3847c2c66affSColin Finck 
OnGoForward(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3848c2c66affSColin Finck LRESULT CShellBrowser::OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3849c2c66affSColin Finck {
3850c2c66affSColin Finck     HRESULT hResult = GoForward();
3851c2c66affSColin Finck     if (FAILED(hResult))
3852c2c66affSColin Finck         TRACE("GoForward failed with hResult=%08lx\n", hResult);
3853c2c66affSColin Finck     return 0;
3854c2c66affSColin Finck }
3855c2c66affSColin Finck 
OnGoUpLevel(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3856c2c66affSColin Finck LRESULT CShellBrowser::OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3857c2c66affSColin Finck {
3858c2c66affSColin Finck     HRESULT hResult = NavigateToParent();
3859c2c66affSColin Finck     if (FAILED(hResult))
3860c2c66affSColin Finck         TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3861c2c66affSColin Finck     return 0;
3862c2c66affSColin Finck }
3863c2c66affSColin Finck 
OnGoHome(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3864c2c66affSColin Finck LRESULT CShellBrowser::OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3865c2c66affSColin Finck {
3866c2c66affSColin Finck     HRESULT hResult = GoHome();
3867c2c66affSColin Finck     if (FAILED(hResult))
3868c2c66affSColin Finck         TRACE("GoHome failed with hResult=%08lx\n", hResult);
3869c2c66affSColin Finck     return 0;
3870c2c66affSColin Finck }
3871c2c66affSColin Finck 
OnBackspace(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3872c2c66affSColin Finck LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3873c2c66affSColin Finck {
3874c2c66affSColin Finck     // FIXME: This does not appear to be what windows does.
3875c2c66affSColin Finck     HRESULT hResult = NavigateToParent();
3876c2c66affSColin Finck     if (FAILED(hResult))
3877c2c66affSColin Finck         TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3878c2c66affSColin Finck     return 0;
3879c2c66affSColin Finck }
3880c2c66affSColin Finck 
3881281f7c4eSKatayama Hirofumi MZ static BOOL
CreateShortcut(IN LPCWSTR pszLnkFileName,IN LPCITEMIDLIST pidl,IN LPCWSTR pszDescription OPTIONAL)3882281f7c4eSKatayama Hirofumi MZ CreateShortcut(
3883281f7c4eSKatayama Hirofumi MZ     IN LPCWSTR pszLnkFileName,
3884281f7c4eSKatayama Hirofumi MZ     IN LPCITEMIDLIST pidl,
3885281f7c4eSKatayama Hirofumi MZ     IN LPCWSTR pszDescription OPTIONAL)
3886281f7c4eSKatayama Hirofumi MZ {
3887281f7c4eSKatayama Hirofumi MZ     IPersistFile *pPF;
3888281f7c4eSKatayama Hirofumi MZ     IShellLinkW *pSL;
3889281f7c4eSKatayama Hirofumi MZ     HRESULT hr = CoInitialize(NULL);
3890281f7c4eSKatayama Hirofumi MZ     if (FAILED(hr))
3891281f7c4eSKatayama Hirofumi MZ         return hr;
3892281f7c4eSKatayama Hirofumi MZ 
3893281f7c4eSKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
3894281f7c4eSKatayama Hirofumi MZ                           IID_IShellLinkW, (LPVOID*)&pSL);
3895281f7c4eSKatayama Hirofumi MZ     if (SUCCEEDED(hr))
3896281f7c4eSKatayama Hirofumi MZ     {
3897281f7c4eSKatayama Hirofumi MZ         pSL->SetIDList(pidl);
3898281f7c4eSKatayama Hirofumi MZ 
3899281f7c4eSKatayama Hirofumi MZ         if (pszDescription)
3900281f7c4eSKatayama Hirofumi MZ             pSL->SetDescription(pszDescription);
3901281f7c4eSKatayama Hirofumi MZ 
3902281f7c4eSKatayama Hirofumi MZ         hr = pSL->QueryInterface(IID_IPersistFile, (LPVOID*)&pPF);
3903281f7c4eSKatayama Hirofumi MZ         if (SUCCEEDED(hr))
3904281f7c4eSKatayama Hirofumi MZ         {
3905281f7c4eSKatayama Hirofumi MZ             hr = pPF->Save(pszLnkFileName, TRUE);
3906281f7c4eSKatayama Hirofumi MZ             pPF->Release();
3907281f7c4eSKatayama Hirofumi MZ         }
3908281f7c4eSKatayama Hirofumi MZ         pSL->Release();
3909281f7c4eSKatayama Hirofumi MZ     }
3910281f7c4eSKatayama Hirofumi MZ 
3911281f7c4eSKatayama Hirofumi MZ     CoUninitialize();
3912281f7c4eSKatayama Hirofumi MZ 
3913281f7c4eSKatayama Hirofumi MZ     return SUCCEEDED(hr);
3914281f7c4eSKatayama Hirofumi MZ }
3915281f7c4eSKatayama Hirofumi MZ 
GetFavsLocation(HWND hWnd,LPITEMIDLIST * pPidl)3916281f7c4eSKatayama Hirofumi MZ HRESULT GetFavsLocation(HWND hWnd, LPITEMIDLIST *pPidl)
3917281f7c4eSKatayama Hirofumi MZ {
3918281f7c4eSKatayama Hirofumi MZ     HRESULT hr = SHGetSpecialFolderLocation(hWnd, CSIDL_FAVORITES, pPidl);
3919281f7c4eSKatayama Hirofumi MZ     if (FAILED(hr))
3920281f7c4eSKatayama Hirofumi MZ         hr = SHGetSpecialFolderLocation(hWnd, CSIDL_COMMON_FAVORITES, pPidl);
3921281f7c4eSKatayama Hirofumi MZ 
3922281f7c4eSKatayama Hirofumi MZ     return hr;
3923281f7c4eSKatayama Hirofumi MZ }
3924281f7c4eSKatayama Hirofumi MZ 
OnAddToFavorites(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3925281f7c4eSKatayama Hirofumi MZ LRESULT CShellBrowser::OnAddToFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3926281f7c4eSKatayama Hirofumi MZ {
3927281f7c4eSKatayama Hirofumi MZ     LPITEMIDLIST pidlFavs;
3928281f7c4eSKatayama Hirofumi MZ     HRESULT hr = GetFavsLocation(m_hWnd, &pidlFavs);
3929281f7c4eSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
3930281f7c4eSKatayama Hirofumi MZ         return 0;
3931281f7c4eSKatayama Hirofumi MZ 
3932281f7c4eSKatayama Hirofumi MZ     SHFILEINFOW fileInfo = { NULL };
3933281f7c4eSKatayama Hirofumi MZ     if (!SHGetFileInfoW((LPCWSTR)fCurrentDirectoryPIDL, 0, &fileInfo, sizeof(fileInfo),
3934281f7c4eSKatayama Hirofumi MZ                         SHGFI_PIDL | SHGFI_DISPLAYNAME))
3935281f7c4eSKatayama Hirofumi MZ     {
3936281f7c4eSKatayama Hirofumi MZ         return 0;
3937281f7c4eSKatayama Hirofumi MZ     }
3938281f7c4eSKatayama Hirofumi MZ 
3939281f7c4eSKatayama Hirofumi MZ     WCHAR szPath[MAX_PATH];
3940281f7c4eSKatayama Hirofumi MZ     SHGetPathFromIDListW(pidlFavs, szPath);
3941281f7c4eSKatayama Hirofumi MZ     PathAppendW(szPath, fileInfo.szDisplayName);
3942281f7c4eSKatayama Hirofumi MZ     PathAddExtensionW(szPath, L".lnk");
3943281f7c4eSKatayama Hirofumi MZ 
3944281f7c4eSKatayama Hirofumi MZ     CreateShortcut(szPath, fCurrentDirectoryPIDL, NULL);
3945281f7c4eSKatayama Hirofumi MZ     return 0;
3946281f7c4eSKatayama Hirofumi MZ }
3947281f7c4eSKatayama Hirofumi MZ 
OnOrganizeFavorites(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3948c2c66affSColin Finck LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3949c2c66affSColin Finck {
3950c2c66affSColin Finck     CComPtr<IShellFolder> psfDesktop;
3951c2c66affSColin Finck     LPITEMIDLIST pidlFavs;
3952281f7c4eSKatayama Hirofumi MZ     HRESULT hr = GetFavsLocation(m_hWnd, &pidlFavs);
3953c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
3954c2c66affSColin Finck         return 0;
3955c2c66affSColin Finck 
3956281f7c4eSKatayama Hirofumi MZ     hr = SHGetDesktopFolder(&psfDesktop);
3957281f7c4eSKatayama Hirofumi MZ     if (FAILED_UNEXPECTEDLY(hr))
3958281f7c4eSKatayama Hirofumi MZ     {
3959281f7c4eSKatayama Hirofumi MZ         ILFree(pidlFavs);
3960281f7c4eSKatayama Hirofumi MZ         return 0;
3961281f7c4eSKatayama Hirofumi MZ     }
3962281f7c4eSKatayama Hirofumi MZ 
3963c2c66affSColin Finck     hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
3964281f7c4eSKatayama Hirofumi MZ     ILFree(pidlFavs);
3965c2c66affSColin Finck     if (FAILED_UNEXPECTEDLY(hr))
3966c2c66affSColin Finck         return 0;
3967c2c66affSColin Finck 
3968c2c66affSColin Finck     return 0;
3969c2c66affSColin Finck }
3970c2c66affSColin Finck 
OnToggleStatusBarVisible(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3971c2c66affSColin Finck LRESULT CShellBrowser::OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3972c2c66affSColin Finck {
397343b3dc20SCarl J. Bialorucki     m_settings.fStatusBarVisible = !m_settings.fStatusBarVisible;
397443b3dc20SCarl J. Bialorucki     m_settings.Save();
397543b3dc20SCarl J. Bialorucki     SendMessageW(BWM_SETTINGCHANGE, 0, (LPARAM)&m_settings);
3976c2c66affSColin Finck     return 0;
3977c2c66affSColin Finck }
3978c2c66affSColin Finck 
OnToggleToolbarLock(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3979c2c66affSColin Finck LRESULT CShellBrowser::OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3980c2c66affSColin Finck {
3981c2c66affSColin Finck     HRESULT hResult;
3982c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3983c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
3984c2c66affSColin Finck     return 0;
3985c2c66affSColin Finck }
3986c2c66affSColin Finck 
OnToggleToolbarBandVisible(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3987c2c66affSColin Finck LRESULT CShellBrowser::OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3988c2c66affSColin Finck {
3989c2c66affSColin Finck     HRESULT hResult;
3990c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3991c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
3992c2c66affSColin Finck     return 0;
3993c2c66affSColin Finck }
3994c2c66affSColin Finck 
OnToggleAddressBandVisible(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)3995c2c66affSColin Finck LRESULT CShellBrowser::OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3996c2c66affSColin Finck {
3997c2c66affSColin Finck     HRESULT hResult;
3998c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
3999c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
4000c2c66affSColin Finck     return 0;
4001c2c66affSColin Finck }
4002c2c66affSColin Finck 
OnToggleLinksBandVisible(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4003c2c66affSColin Finck LRESULT CShellBrowser::OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4004c2c66affSColin Finck {
4005c2c66affSColin Finck     HRESULT hResult;
4006c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
4007c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
4008c2c66affSColin Finck     return 0;
4009c2c66affSColin Finck }
4010c2c66affSColin Finck 
OnToggleTextLabels(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4011c2c66affSColin Finck LRESULT CShellBrowser::OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4012c2c66affSColin Finck {
4013c2c66affSColin Finck     HRESULT hResult;
4014c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
4015c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
4016c2c66affSColin Finck     return 0;
4017c2c66affSColin Finck }
4018c2c66affSColin Finck 
OnToolbarCustomize(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4019c2c66affSColin Finck LRESULT CShellBrowser::OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4020c2c66affSColin Finck {
4021c2c66affSColin Finck     HRESULT hResult;
4022c2c66affSColin Finck     hResult = IUnknown_Exec(fClientBars[BIInternetToolbar].clientBar,
4023c2c66affSColin Finck                             CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
4024c2c66affSColin Finck     return 0;
4025c2c66affSColin Finck }
4026c2c66affSColin Finck 
OnRefresh(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4027c2c66affSColin Finck LRESULT CShellBrowser::OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4028c2c66affSColin Finck {
4029c2c66affSColin Finck     if (fCurrentShellView)
4030c2c66affSColin Finck         fCurrentShellView->Refresh();
4031c2c66affSColin Finck     return 0;
4032c2c66affSColin Finck }
4033c2c66affSColin Finck 
OnGoTravel(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4034c2c66affSColin Finck LRESULT CShellBrowser::OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4035c2c66affSColin Finck {
4036c2c66affSColin Finck     return 0;
4037c2c66affSColin Finck }
4038c2c66affSColin Finck 
OnExplorerBar(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)4039c2c66affSColin Finck LRESULT CShellBrowser::OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
4040c2c66affSColin Finck {
4041c2c66affSColin Finck     // TODO: HACK ! use the proper mechanism to show the band (i.e. pass the BSTR to basebar)
4042c2c66affSColin Finck     if (wID >= IDM_EXPLORERBAND_BEGINCUSTOM && wID <= IDM_EXPLORERBAND_ENDCUSTOM)
4043c2c66affSColin Finck     {
4044c2c66affSColin Finck         MenuBandInfo *mbi;
4045c2c66affSColin Finck         mbi = (MenuBandInfo*)DSA_GetItemPtr(menuDsa, (wID - IDM_EXPLORERBAND_BEGINCUSTOM));
4046c2c66affSColin Finck         if (!mbi)
4047c2c66affSColin Finck             return 0;
4048c2c66affSColin Finck         ShowBand(mbi->barGuid, mbi->fVertical);
4049c2c66affSColin Finck         bHandled = TRUE;
4050c2c66affSColin Finck         return 1;
4051c2c66affSColin Finck     }
4052c2c66affSColin Finck     switch (wID)
4053c2c66affSColin Finck     {
4054c2c66affSColin Finck     case IDM_EXPLORERBAR_SEARCH:
40554212f4b1SBrock Mammen         ShowBand(CLSID_FileSearchBand, true);
4056c2c66affSColin Finck         break;
4057c2c66affSColin Finck     case IDM_EXPLORERBAR_FOLDERS:
4058c2c66affSColin Finck         ShowBand(CLSID_ExplorerBand, true);
4059c2c66affSColin Finck         break;
4060c2c66affSColin Finck     case IDM_EXPLORERBAR_HISTORY:
4061c2c66affSColin Finck         ShowBand(CLSID_SH_HistBand, true);
4062c2c66affSColin Finck         break;
4063c2c66affSColin Finck     case IDM_EXPLORERBAR_FAVORITES:
4064c2c66affSColin Finck         ShowBand(CLSID_SH_FavBand, true);
4065c2c66affSColin Finck         break;
4066c2c66affSColin Finck     default:
4067c2c66affSColin Finck         WARN("Unknown id %x\n", wID);
4068c2c66affSColin Finck     }
4069c2c66affSColin Finck     bHandled = TRUE;
4070c2c66affSColin Finck     return 1;
4071c2c66affSColin Finck }
4072c2c66affSColin Finck 
RelayCommands(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)4073c2c66affSColin Finck LRESULT CShellBrowser::RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
4074c2c66affSColin Finck {
4075c2c66affSColin Finck     if (HIWORD(wParam) == 0 && LOWORD(wParam) < FCIDM_SHVIEWLAST && fCurrentShellViewWindow != NULL)
4076c2c66affSColin Finck         return SendMessage(fCurrentShellViewWindow, uMsg, wParam, lParam);
4077c2c66affSColin Finck     return 0;
4078c2c66affSColin Finck }
4079c2c66affSColin Finck 
OnCabinetStateChange(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)40805b78381aSWhindmar Saksit LRESULT CShellBrowser::OnCabinetStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
40815b78381aSWhindmar Saksit {
40825b78381aSWhindmar Saksit     RefreshCabinetState();
40835b78381aSWhindmar Saksit     return 0;
40845b78381aSWhindmar Saksit }
40855b78381aSWhindmar Saksit 
OnSettingsChange(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)408643b3dc20SCarl J. Bialorucki LRESULT CShellBrowser::OnSettingsChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
408743b3dc20SCarl J. Bialorucki {
408843b3dc20SCarl J. Bialorucki     /* Refresh child windows */
408943b3dc20SCarl J. Bialorucki     ::SendMessageW(fClientBars[BIInternetToolbar].hwnd, uMsg, wParam, lParam);
409043b3dc20SCarl J. Bialorucki 
409143b3dc20SCarl J. Bialorucki     /* Refresh status bar */
409243b3dc20SCarl J. Bialorucki     if (fStatusBar)
409343b3dc20SCarl J. Bialorucki     {
409443b3dc20SCarl J. Bialorucki         ::ShowWindow(fStatusBar, m_settings.fStatusBarVisible ? SW_SHOW : SW_HIDE);
409543b3dc20SCarl J. Bialorucki         RepositionBars();
409643b3dc20SCarl J. Bialorucki     }
409743b3dc20SCarl J. Bialorucki 
409843b3dc20SCarl J. Bialorucki     return 0;
409943b3dc20SCarl J. Bialorucki }
410043b3dc20SCarl J. Bialorucki 
OnGetSettingsPtr(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)410143b3dc20SCarl J. Bialorucki LRESULT CShellBrowser::OnGetSettingsPtr(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
410243b3dc20SCarl J. Bialorucki {
410343b3dc20SCarl J. Bialorucki     if (!lParam)
410443b3dc20SCarl J. Bialorucki         return ERROR_INVALID_PARAMETER;
410543b3dc20SCarl J. Bialorucki 
410643b3dc20SCarl J. Bialorucki     *(ShellSettings**)lParam = &m_settings;
410743b3dc20SCarl J. Bialorucki     return NO_ERROR;
410843b3dc20SCarl J. Bialorucki }
410943b3dc20SCarl J. Bialorucki 
4110ff63d064SKatayama Hirofumi MZ // WM_APPCOMMAND
OnAppCommand(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)4111ff63d064SKatayama Hirofumi MZ LRESULT CShellBrowser::OnAppCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
4112ff63d064SKatayama Hirofumi MZ {
4113ff63d064SKatayama Hirofumi MZ     UINT uCmd = GET_APPCOMMAND_LPARAM(lParam);
4114ff63d064SKatayama Hirofumi MZ     switch (uCmd)
4115ff63d064SKatayama Hirofumi MZ     {
4116ff63d064SKatayama Hirofumi MZ         case APPCOMMAND_BROWSER_BACKWARD:
4117ff63d064SKatayama Hirofumi MZ             GoBack();
4118ff63d064SKatayama Hirofumi MZ             break;
4119ff63d064SKatayama Hirofumi MZ 
4120ff63d064SKatayama Hirofumi MZ         case APPCOMMAND_BROWSER_FORWARD:
4121ff63d064SKatayama Hirofumi MZ             GoForward();
4122ff63d064SKatayama Hirofumi MZ             break;
4123ff63d064SKatayama Hirofumi MZ 
4124ff63d064SKatayama Hirofumi MZ         default:
4125ff63d064SKatayama Hirofumi MZ             FIXME("uCmd: %u\n", uCmd);
4126ff63d064SKatayama Hirofumi MZ             break;
4127ff63d064SKatayama Hirofumi MZ     }
4128ff63d064SKatayama Hirofumi MZ     return 0;
4129ff63d064SKatayama Hirofumi MZ }
4130ff63d064SKatayama Hirofumi MZ 
CShellBrowser_CreateInstance(REFIID riid,void ** ppv)413162c33fbfSGiannis Adamopoulos HRESULT CShellBrowser_CreateInstance(REFIID riid, void **ppv)
4132c2c66affSColin Finck {
413362c33fbfSGiannis Adamopoulos     return ShellObjectCreatorInit<CShellBrowser>(riid, ppv);
4134c2c66affSColin Finck }
4135f744bb29SCarl J. Bialorucki 
RefreshCabinetState()4136f744bb29SCarl J. Bialorucki void CShellBrowser::RefreshCabinetState()
4137f744bb29SCarl J. Bialorucki {
4138f744bb29SCarl J. Bialorucki     gCabinetState.Load();
4139f744bb29SCarl J. Bialorucki     UpdateWindowTitle();
4140f744bb29SCarl J. Bialorucki }
4141f744bb29SCarl J. Bialorucki 
UpdateWindowTitle()4142f744bb29SCarl J. Bialorucki void CShellBrowser::UpdateWindowTitle()
4143f744bb29SCarl J. Bialorucki {
4144f744bb29SCarl J. Bialorucki     WCHAR title[MAX_PATH];
4145f744bb29SCarl J. Bialorucki     SHGDNF flags = SHGDN_FORADDRESSBAR;
4146f744bb29SCarl J. Bialorucki 
4147f744bb29SCarl J. Bialorucki     if (gCabinetState.fFullPathTitle)
4148f744bb29SCarl J. Bialorucki         flags |= SHGDN_FORPARSING;
4149f744bb29SCarl J. Bialorucki 
4150f744bb29SCarl J. Bialorucki     if (SUCCEEDED(IEGetNameAndFlags(fCurrentDirectoryPIDL, flags, title, _countof(title), NULL)))
4151f744bb29SCarl J. Bialorucki         SetWindowText(title);
4152f744bb29SCarl J. Bialorucki }
4153674136bcSWhindmar Saksit 
SaveITBarLayout()4154674136bcSWhindmar Saksit void CShellBrowser::SaveITBarLayout()
4155674136bcSWhindmar Saksit {
41565b78381aSWhindmar Saksit     if (!gCabinetState.fSaveLocalView || (m_BrowserSvcFlags & (BSF_THEATERMODE | BSF_UISETBYAUTOMATION)))
4157674136bcSWhindmar Saksit         return;
4158674136bcSWhindmar Saksit #if 0 // If CDesktopBrowser aggregates us, skip saving
4159674136bcSWhindmar Saksit     FOLDERSETTINGS fs;
4160674136bcSWhindmar Saksit     if (fCurrentShellView && SUCCEEDED(fCurrentShellView->GetCurrentInfo(&fs)) && (fs.fFlags & FWF_DESKTOP))
4161674136bcSWhindmar Saksit         return;
4162674136bcSWhindmar Saksit #endif
4163674136bcSWhindmar Saksit 
4164674136bcSWhindmar Saksit     CComPtr<IPersistStreamInit> pPSI;
4165674136bcSWhindmar Saksit     CComPtr<IStream> pITBarStream;
4166674136bcSWhindmar Saksit     if (!fClientBars[BIInternetToolbar].clientBar.p)
4167674136bcSWhindmar Saksit         return;
4168674136bcSWhindmar Saksit     HRESULT hr = fClientBars[BIInternetToolbar].clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit, &pPSI));
4169674136bcSWhindmar Saksit     if (FAILED(hr))
4170674136bcSWhindmar Saksit         return;
4171674136bcSWhindmar Saksit     if (FAILED(hr = CInternetToolbar::GetStream(ITBARSTREAM_EXPLORER, STGM_WRITE, &pITBarStream)))
4172674136bcSWhindmar Saksit         return;
4173674136bcSWhindmar Saksit     pPSI->Save(pITBarStream, TRUE);
4174674136bcSWhindmar Saksit }
4175