Sync with trunk r63502.
[reactos.git] / dll / win32 / browseui / shellbrowser.cpp
1 /*
2 * ReactOS Explorer
3 *
4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "precomp.h"
22
23 #include <shellapi.h>
24 #include <htiframe.h>
25
26 extern "C"
27 BOOL WINAPI Shell_GetImageLists(
28 _Out_ HIMAGELIST *phiml,
29 _Out_ HIMAGELIST *phimlSmall
30 );
31
32 #include "newatlinterfaces.h"
33
34 /*
35 TODO:
36 **Provide implementation of new and delete that use LocalAlloc
37 **Persist history for shell view isn't working correctly, possibly because of the mismatch between traveling and updating the travel log. The
38 view doesn't restore the selection correctly.
39 **Build explorer.exe, browseui.dll, comctl32.dll, shdocvw.dll, shell32.dll, shlwapi.dll into a directory and run them for testing...
40 **Add brand band bitmaps to shell32.dll
41 **If Go button on address bar is clicked, each time a new duplicate entry is added to travel log
42 ****The current entry is updated in travel log before doing the travel, which means when traveling back the update of the
43 current state overwrites the wrong entry's contents. This needs to be changed.
44 ****Fix close of browser window to release all objects
45 ****Given only a GUID in ShowBrowserBar, what is the correct way to determine if the bar is vertical or horizontal?
46 **When a new bar is added to base bar site, how is base bar told so it can resize?
47 **Does the base bar site have a classid?
48 **What should refresh command send to views to make them refresh?
49 **When new bar is created, what status notifications need to be fired?
50 **How does keyboard filtering dispatch?
51 **For deferred persist history load, how does the view connect up and get the state?
52 How does context menu send open, cut, rename commands to its site (the shell view)?
53 **Fix browser to implement IProfferService and hold onto brand band correctly - this will allow animations.
54
55 **Route View->Toolbars commands to internet toolbar
56 **Handle travel log items in View->Go
57 **Fix ShowBrowserBar to pass correct size on when bar is shown
58 ****Fix SetBorderSpaceDW to cascade resize to subsequent bars
59 ****Make ShowToolbar check if bar is already created before creating it again
60 ****Shell should fill in the list of explorer bars in the View submenus
61 **Add folder menu in the file menu
62 **Fix CShellBrowser::GetBorderDW to compute available size correctly
63 **When a new bar is shown, re-fire the navigate event. This makes the explorer band select the correct folder
64 **Implement support for refresh. Forward refresh to explorer bar (refresh on toolbar and in menu is dispatched different)
65 Make folders toolbar item update state appropriately
66 Read list of bands from registry on launch
67 Read list of bars from registry on launch
68 If the folders or search bars don't exist, disable the toolbar buttons
69 If the favorites or history bars don't exist, disable the toolbar butons
70 Fix Apply to all Folders in Folder Options
71 Implement close command
72 Add explorer band context menu to file menu
73 Add code to allow restore of internet toolbar from registry
74 Fix code that calls FireNavigateComplete to pass the correct new path
75
76 What are the other command ids for QueryStatus/FireCommandStateChange?
77
78 Add handler for cabinet settings change
79 Add handler for system metrics change (renegotiate border space?)
80 Add handler for theme change and forward to contained windows
81
82 When folders are shown, the status bar text should change
83 Add code to save/restore shell view settings
84 Implement tabbing between frames
85 Fix handling of focus everywhere
86 Most keyboard shortcuts don't work, such as F2 for rename, F5 for refresh (see list in "explorer keyboard shortcuts")
87
88 The status bar doesn't show help text for items owned by frame during menu tracking
89 Stub out frame command handlers
90 "Arrange icons by" group is not checked properly
91
92 When folders are hidden, icon is the same as the current shell object being displayed. When folders are shown,
93 the icon is always an open folder with magnifying glass
94 Fix bars to calculate height correctly
95 Hookup policies for everything...
96 Investigate toolbar message WM_USER+93
97 Investigate toolbar message WM_USER+100 (Adds extra padding between parts of buttons with BTNS_DROPDOWN | BTNS_SHOWTEXT style
98
99 Vertical Explorer Bar CATID_InfoBand
100 Horizontal Explorer Bar CATID_CommBand
101 Desk Band CATID_DeskBand
102
103 cache of bars
104 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}\Enum
105 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}\Enum
106
107 create key here with CLSID of bar to register tool band
108 HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Toolbar
109
110 */
111
112 #ifndef __GNUC__
113 #pragma comment(linker, \
114 "\"/manifestdependency:type='Win32' "\
115 "name='Microsoft.Windows.Common-Controls' "\
116 "version='6.0.0.0' "\
117 "processorArchitecture='*' "\
118 "publicKeyToken='6595b64144ccf1df' "\
119 "language='*'\"")
120 #endif // __GNUC__
121
122 struct categoryCacheHeader
123 {
124 long dwSize; // size of header only
125 long version; // currently 1
126 SYSTEMTIME writeTime; // time we were written to registry
127 long classCount; // number of classes following
128 };
129
130 static const unsigned int folderOptionsPageCountMax = 20;
131 static const long BTP_UPDATE_CUR_HISTORY = 1;
132 static const long BTP_UPDATE_NEXT_HISTORY = 2;
133
134 BOOL createNewStuff = false;
135
136
137 // this class is private to browseui.dll and is not registered externally?
138 //DEFINE_GUID(CLSID_ShellFldSetExt, 0x6D5313C0, 0x8C62, 0x11D1, 0xB2, 0xCD, 0x00, 0x60, 0x97, 0xDF, 0x8C, 0x11);
139
140
141 extern HRESULT CreateTravelLog(REFIID riid, void **ppv);
142 extern HRESULT CreateBaseBar(REFIID riid, void **ppv);
143 extern HRESULT CreateBaseBarSite(REFIID riid, void **ppv);
144
145 // temporary
146 extern HRESULT CreateInternetToolbar(REFIID riid, void **ppv);
147
148
149 HMENU SHGetMenuFromID(HMENU topMenu, int theID)
150 {
151 MENUITEMINFO menuItemInfo;
152
153 menuItemInfo.cbSize = sizeof(menuItemInfo);
154 menuItemInfo.fMask = MIIM_SUBMENU;
155 if (!GetMenuItemInfo(topMenu, theID, FALSE, &menuItemInfo))
156 return NULL;
157 return menuItemInfo.hSubMenu;
158 }
159
160 void SHCheckMenuItem(HMENU theMenu, int theID, BOOL checked)
161 {
162 MENUITEMINFO menuItemInfo;
163
164 menuItemInfo.cbSize = sizeof(menuItemInfo);
165 menuItemInfo.fMask = MIIM_STATE;
166 if (GetMenuItemInfo(theMenu, theID, FALSE, &menuItemInfo))
167 {
168 if (checked)
169 menuItemInfo.fState |= MF_CHECKED;
170 else
171 menuItemInfo.fState &= ~MF_CHECKED;
172 SetMenuItemInfo(theMenu, theID, FALSE, &menuItemInfo);
173 }
174 }
175
176 void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
177 {
178 MENUITEMINFO menuItemInfo;
179 int menuItemCount;
180 int curIndex;
181
182 menuItemCount = GetMenuItemCount(theMenu);
183 curIndex = 0;
184 while (curIndex < menuItemCount)
185 {
186 menuItemInfo.cbSize = sizeof(menuItemInfo);
187 menuItemInfo.fMask = MIIM_ID;
188 if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
189 menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
190 {
191 DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
192 menuItemCount--;
193 }
194 else
195 curIndex++;
196 }
197 }
198
199 HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
200 {
201 CComPtr<IShellFolder> desktop;
202
203 HRESULT hr = ::SHGetDesktopFolder(&desktop);
204 if (FAILED(hr))
205 return E_FAIL;
206 if (path == NULL || path->mkid.cb == 0)
207 {
208 *newFolder = desktop;
209 desktop.p->AddRef ();
210 return S_OK;
211 }
212 return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
213 }
214
215 static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClassX");
216 static const TCHAR szExploreWndClass[] = TEXT("ExploreWClassX");
217
218 class CDockManager;
219 class CShellBrowser;
220
221 class CToolbarProxy :
222 public CWindowImpl<CToolbarProxy, CWindow, CControlWinTraits>
223 {
224 private:
225 CComPtr<IExplorerToolbar> fExplorerToolbar;
226 public:
227 void Initialize(HWND parent, IUnknown *explorerToolbar);
228
229 private:
230
231 // message handlers
232 LRESULT OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
233 LRESULT OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
234
235 BEGIN_MSG_MAP(CToolbarProxy)
236 MESSAGE_HANDLER(TB_ADDBITMAP, OnAddBitmap)
237 MESSAGE_RANGE_HANDLER(WM_USER, 0x7fff, OnForwardMessage)
238 END_MSG_MAP()
239 };
240
241 void CToolbarProxy::Initialize(HWND parent, IUnknown *explorerToolbar)
242 {
243 HWND myWindow;
244 HRESULT hResult;
245
246 myWindow = SHCreateWorkerWindowW(0, parent, 0, WS_CHILD, NULL, 0);
247 if (myWindow != NULL)
248 {
249 SubclassWindow(myWindow);
250 SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
251 hResult = explorerToolbar->QueryInterface(
252 IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
253 }
254 }
255
256 LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
257 {
258 long int result;
259 HRESULT hResult;
260
261 result = 0;
262 if (fExplorerToolbar.p != NULL)
263 {
264 hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 1, (long)wParam,
265 reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
266 hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 2, (long)wParam,
267 reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
268 }
269 return result;
270 }
271
272 LRESULT CToolbarProxy::OnForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
273 {
274 LRESULT result;
275 HRESULT hResult;
276
277 result = 0;
278 if (fExplorerToolbar.p != NULL)
279 hResult = fExplorerToolbar->SendToolbarMsg(&CGID_ShellBrowser, uMsg, wParam, lParam, &result);
280 return result;
281 }
282
283 /*
284 Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
285 where vaIn will be a VT_UNKNOWN with the new bar. It also sends a RB_SHOWBAND to the
286 rebar
287 */
288
289 class CShellBrowser :
290 public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
291 public CComObjectRootEx<CComMultiThreadModelNoCS>,
292 public IShellBrowser,
293 public IDropTarget,
294 public IServiceProvider,
295 public IProfferServiceImpl<CShellBrowser>,
296 public IShellBrowserService,
297 public IWebBrowser2,
298 public ITravelLogClient,
299 public IPersistHistory,
300 public IDockingWindowSite,
301 public IOleCommandTarget,
302 public IBrowserService2,
303 public IConnectionPointContainerImpl<CShellBrowser>,
304 public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>,
305 public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>
306 {
307 private:
308 class barInfo
309 {
310 public:
311 RECT borderSpace;
312 CComPtr<IUnknown> clientBar;
313 HWND hwnd;
314 };
315 static const int BIInternetToolbar = 0;
316 static const int BIVerticalBaseBar = 1;
317 static const int BIHorizontalBaseBar = 2;
318
319 HWND fCurrentShellViewWindow; // our currently hosted shell view window
320 CComPtr<IShellFolder> fCurrentShellFolder; //
321 CComPtr<IShellView> fCurrentShellView; //
322 LPITEMIDLIST fCurrentDirectoryPIDL; //
323 HWND fStatusBar;
324 bool fStatusBarVisible;
325 CToolbarProxy fToolbarProxy;
326 barInfo fClientBars[3];
327 CComPtr<ITravelLog> fTravelLog;
328 HMENU fCurrentMenuBar;
329 CABINETSTATE fCabinetState;
330 // The next three fields support persisted history for shell views.
331 // They do not need to be reference counted.
332 IOleObject *fHistoryObject;
333 IStream *fHistoryStream;
334 IBindCtx *fHistoryBindContext;
335 HACCEL m_hAccel;
336 public:
337 #if 0
338 ULONG InternalAddRef()
339 {
340 OutputDebugString(_T("AddRef\n"));
341 return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalAddRef();
342 }
343 ULONG InternalRelease()
344 {
345 OutputDebugString(_T("Release\n"));
346 return CComObjectRootEx<CComMultiThreadModelNoCS>::InternalRelease();
347 }
348 #endif
349
350 CShellBrowser();
351 ~CShellBrowser();
352 HRESULT Initialize(LPITEMIDLIST pidl, long b, long c, long d);
353 public:
354 HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags);
355 HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
356 FOLDERSETTINGS *folderSettings, long flags);
357 HRESULT GetMenuBand(REFIID riid, void **shellMenu);
358 HRESULT GetBaseBar(bool vertical, IUnknown **theBaseBar);
359 HRESULT ShowBand(const CLSID &classID, bool vertical);
360 HRESULT NavigateToParent();
361 HRESULT DoFolderOptions();
362 static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
363 void RepositionBars();
364 virtual WNDPROC GetWindowProc()
365 {
366 return WindowProc;
367 }
368 HRESULT FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments);
369 HRESULT FireNavigateComplete(const wchar_t *newDirectory);
370 HRESULT FireCommandStateChange(bool newState, int commandID);
371 HRESULT FireCommandStateChangeAll();
372 HRESULT UpdateForwardBackState();
373 void UpdateGotoMenu(HMENU theMenu);
374 void UpdateViewMenu(HMENU theMenu);
375
376 /* // *** IDockingWindowFrame methods ***
377 virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags);
378 virtual HRESULT STDMETHODCALLTYPE RemoveToolbar(IUnknown *punkSrc, DWORD dwRemoveFlags);
379 virtual HRESULT STDMETHODCALLTYPE FindToolbar(LPCWSTR pwszItem, REFIID riid, void **ppv);
380 */
381
382 // *** IDockingWindowSite methods ***
383 virtual HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkObj, LPRECT prcBorder);
384 virtual HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
385 virtual HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
386
387 // *** IOleCommandTarget methods ***
388 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds,
389 OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
390 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
391 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
392
393 // *** IOleWindow methods ***
394 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
395 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
396
397 // *** IShellBrowser methods ***
398 virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
399 virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject);
400 virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared);
401 virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText);
402 virtual HRESULT STDMETHODCALLTYPE EnableModelessSB(BOOL fEnable);
403 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(MSG *pmsg, WORD wID);
404 virtual HRESULT STDMETHODCALLTYPE BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
405 virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm);
406 virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd);
407 virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret);
408 virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(IShellView **ppshv);
409 virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive(IShellView *ppshv);
410 virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags);
411
412 // *** IDropTarget methods ***
413 virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
414 virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
415 virtual HRESULT STDMETHODCALLTYPE DragLeave();
416 virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
417
418 // *** IServiceProvider methods ***
419 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
420
421 // *** IShellBowserService methods ***
422 virtual HRESULT STDMETHODCALLTYPE GetPropertyBag(long flags, REFIID riid, void **ppvObject);
423
424 // *** IDispatch methods ***
425 virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
426 virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
427 virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
428 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
429 virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
430 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
431
432 // *** IBrowserService methods ***
433 virtual HRESULT STDMETHODCALLTYPE GetParentSite(IOleInPlaceSite **ppipsite);
434 virtual HRESULT STDMETHODCALLTYPE SetTitle(IShellView *psv, LPCWSTR pszName);
435 virtual HRESULT STDMETHODCALLTYPE GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName);
436 virtual HRESULT STDMETHODCALLTYPE GetOleObject(IOleObject **ppobjv);
437 virtual HRESULT STDMETHODCALLTYPE GetTravelLog(ITravelLog **pptl);
438 virtual HRESULT STDMETHODCALLTYPE ShowControlWindow(UINT id, BOOL fShow);
439 virtual HRESULT STDMETHODCALLTYPE IsControlWindowShown(UINT id, BOOL *pfShown);
440 virtual HRESULT STDMETHODCALLTYPE IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags);
441 virtual HRESULT STDMETHODCALLTYPE IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut);
442 virtual HRESULT STDMETHODCALLTYPE DisplayParseError(HRESULT hres, LPCWSTR pwszPath);
443 virtual HRESULT STDMETHODCALLTYPE NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF);
444 virtual HRESULT STDMETHODCALLTYPE SetNavigateState(BNSTATE bnstate);
445 virtual HRESULT STDMETHODCALLTYPE GetNavigateState(BNSTATE *pbnstate);
446 virtual HRESULT STDMETHODCALLTYPE NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse);
447 virtual HRESULT STDMETHODCALLTYPE UpdateWindowList();
448 virtual HRESULT STDMETHODCALLTYPE UpdateBackForwardState();
449 virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags, DWORD dwFlagMask);
450 virtual HRESULT STDMETHODCALLTYPE GetFlags(DWORD *pdwFlags);
451 virtual HRESULT STDMETHODCALLTYPE CanNavigateNow( void);
452 virtual HRESULT STDMETHODCALLTYPE GetPidl(LPITEMIDLIST *ppidl);
453 virtual HRESULT STDMETHODCALLTYPE SetReferrer(LPCITEMIDLIST pidl);
454 virtual DWORD STDMETHODCALLTYPE GetBrowserIndex();
455 virtual HRESULT STDMETHODCALLTYPE GetBrowserByIndex(DWORD dwID, IUnknown **ppunk);
456 virtual HRESULT STDMETHODCALLTYPE GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc);
457 virtual HRESULT STDMETHODCALLTYPE SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor);
458 virtual HRESULT STDMETHODCALLTYPE CacheOLEServer(IOleObject *pole);
459 virtual HRESULT STDMETHODCALLTYPE GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut);
460 virtual HRESULT STDMETHODCALLTYPE OnHttpEquiv(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut);
461 virtual HRESULT STDMETHODCALLTYPE GetPalette(HPALETTE *hpal);
462 virtual HRESULT STDMETHODCALLTYPE RegisterWindow(BOOL fForceRegister, int swc);
463
464 // *** IBrowserService2 methods ***
465 virtual LRESULT STDMETHODCALLTYPE WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
466 virtual HRESULT STDMETHODCALLTYPE SetAsDefFolderSettings();
467 virtual HRESULT STDMETHODCALLTYPE GetViewRect(RECT *prc);
468 virtual HRESULT STDMETHODCALLTYPE OnSize(WPARAM wParam);
469 virtual HRESULT STDMETHODCALLTYPE OnCreate(struct tagCREATESTRUCTW *pcs);
470 virtual LRESULT STDMETHODCALLTYPE OnCommand(WPARAM wParam, LPARAM lParam);
471 virtual HRESULT STDMETHODCALLTYPE OnDestroy();
472 virtual LRESULT STDMETHODCALLTYPE OnNotify(struct tagNMHDR *pnm);
473 virtual HRESULT STDMETHODCALLTYPE OnSetFocus();
474 virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivateBS(BOOL fActive);
475 virtual HRESULT STDMETHODCALLTYPE ReleaseShellView();
476 virtual HRESULT STDMETHODCALLTYPE ActivatePendingView();
477 virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd);
478 virtual HRESULT STDMETHODCALLTYPE CreateBrowserPropSheetExt(REFIID riid, void **ppv);
479 virtual HRESULT STDMETHODCALLTYPE GetViewWindow(HWND *phwndView);
480 virtual HRESULT STDMETHODCALLTYPE GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd);
481 virtual LPBASEBROWSERDATA STDMETHODCALLTYPE PutBaseBrowserData( void);
482 virtual HRESULT STDMETHODCALLTYPE InitializeTravelLog(ITravelLog *ptl, DWORD dw);
483 virtual HRESULT STDMETHODCALLTYPE SetTopBrowser();
484 virtual HRESULT STDMETHODCALLTYPE Offline(int iCmd);
485 virtual HRESULT STDMETHODCALLTYPE AllowViewResize(BOOL f);
486 virtual HRESULT STDMETHODCALLTYPE SetActivateState(UINT u);
487 virtual HRESULT STDMETHODCALLTYPE UpdateSecureLockIcon(int eSecureLock);
488 virtual HRESULT STDMETHODCALLTYPE InitializeDownloadManager();
489 virtual HRESULT STDMETHODCALLTYPE InitializeTransitionSite();
490 virtual HRESULT STDMETHODCALLTYPE _Initialize(HWND hwnd, IUnknown *pauto);
491 virtual HRESULT STDMETHODCALLTYPE _CancelPendingNavigationAsync( void);
492 virtual HRESULT STDMETHODCALLTYPE _CancelPendingView();
493 virtual HRESULT STDMETHODCALLTYPE _MaySaveChanges();
494 virtual HRESULT STDMETHODCALLTYPE _PauseOrResumeView(BOOL fPaused);
495 virtual HRESULT STDMETHODCALLTYPE _DisableModeless();
496 virtual HRESULT STDMETHODCALLTYPE _NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags);
497 virtual HRESULT STDMETHODCALLTYPE _TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew);
498 virtual HRESULT STDMETHODCALLTYPE _SwitchActivationNow();
499 virtual HRESULT STDMETHODCALLTYPE _ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup,
500 DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
501 virtual HRESULT STDMETHODCALLTYPE _SendChildren(
502 HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam);
503 virtual HRESULT STDMETHODCALLTYPE GetFolderSetData(struct tagFolderSetData *pfsd);
504 virtual HRESULT STDMETHODCALLTYPE _OnFocusChange(UINT itb);
505 virtual HRESULT STDMETHODCALLTYPE v_ShowHideChildWindows(BOOL fChildOnly);
506 virtual UINT STDMETHODCALLTYPE _get_itbLastFocus();
507 virtual HRESULT STDMETHODCALLTYPE _put_itbLastFocus(UINT itbLastFocus);
508 virtual HRESULT STDMETHODCALLTYPE _UIActivateView(UINT uState);
509 virtual HRESULT STDMETHODCALLTYPE _GetViewBorderRect(RECT *prc);
510 virtual HRESULT STDMETHODCALLTYPE _UpdateViewRectSize();
511 virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorder(UINT itb);
512 virtual HRESULT STDMETHODCALLTYPE _ResizeView();
513 virtual HRESULT STDMETHODCALLTYPE _GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon);
514 virtual IStream *STDMETHODCALLTYPE v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName);
515 virtual LRESULT STDMETHODCALLTYPE ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
516 virtual HRESULT STDMETHODCALLTYPE SetAcceleratorMenu(HACCEL hacc);
517 virtual int STDMETHODCALLTYPE _GetToolbarCount();
518 virtual LPTOOLBARITEM STDMETHODCALLTYPE _GetToolbarItem(int itb);
519 virtual HRESULT STDMETHODCALLTYPE _SaveToolbars(IStream *pstm);
520 virtual HRESULT STDMETHODCALLTYPE _LoadToolbars(IStream *pstm);
521 virtual HRESULT STDMETHODCALLTYPE _CloseAndReleaseToolbars(BOOL fClose);
522 virtual HRESULT STDMETHODCALLTYPE v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext,
523 int citb, LPTOOLBARITEM *pptbi, HWND *phwnd);
524 virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor);
525 virtual UINT STDMETHODCALLTYPE _FindTBar(IUnknown *punkSrc);
526 virtual HRESULT STDMETHODCALLTYPE _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg);
527 virtual HRESULT STDMETHODCALLTYPE v_MayTranslateAccelerator(MSG *pmsg);
528 virtual HRESULT STDMETHODCALLTYPE _GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor);
529 virtual HRESULT STDMETHODCALLTYPE v_CheckZoneCrossing(LPCITEMIDLIST pidl);
530
531 // *** IWebBrowser methods ***
532 virtual HRESULT STDMETHODCALLTYPE GoBack();
533 virtual HRESULT STDMETHODCALLTYPE GoForward();
534 virtual HRESULT STDMETHODCALLTYPE GoHome();
535 virtual HRESULT STDMETHODCALLTYPE GoSearch();
536 virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName,
537 VARIANT *PostData, VARIANT *Headers);
538 virtual HRESULT STDMETHODCALLTYPE Refresh();
539 virtual HRESULT STDMETHODCALLTYPE Refresh2(VARIANT *Level);
540 virtual HRESULT STDMETHODCALLTYPE Stop();
541 virtual HRESULT STDMETHODCALLTYPE get_Application(IDispatch **ppDisp);
542 virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch **ppDisp);
543 virtual HRESULT STDMETHODCALLTYPE get_Container(IDispatch **ppDisp);
544 virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch **ppDisp);
545 virtual HRESULT STDMETHODCALLTYPE get_TopLevelContainer(VARIANT_BOOL *pBool);
546 virtual HRESULT STDMETHODCALLTYPE get_Type(BSTR *Type);
547 virtual HRESULT STDMETHODCALLTYPE get_Left(long *pl);
548 virtual HRESULT STDMETHODCALLTYPE put_Left(long Left);
549 virtual HRESULT STDMETHODCALLTYPE get_Top(long *pl);
550 virtual HRESULT STDMETHODCALLTYPE put_Top(long Top);
551 virtual HRESULT STDMETHODCALLTYPE get_Width(long *pl);
552 virtual HRESULT STDMETHODCALLTYPE put_Width(long Width);
553 virtual HRESULT STDMETHODCALLTYPE get_Height(long *pl);
554 virtual HRESULT STDMETHODCALLTYPE put_Height(long Height);
555 virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR *LocationName);
556 virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR *LocationURL);
557 virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL *pBool);
558
559 // *** IWebBrowserApp methods ***
560 virtual HRESULT STDMETHODCALLTYPE Quit();
561 virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int *pcx, int *pcy);
562 virtual HRESULT STDMETHODCALLTYPE PutProperty(BSTR Property, VARIANT vtValue);
563 virtual HRESULT STDMETHODCALLTYPE GetProperty(BSTR Property, VARIANT *pvtValue);
564 virtual HRESULT STDMETHODCALLTYPE get_Name(BSTR *Name);
565 virtual HRESULT STDMETHODCALLTYPE get_HWND(SHANDLE_PTR *pHWND);
566 virtual HRESULT STDMETHODCALLTYPE get_FullName(BSTR *FullName);
567 virtual HRESULT STDMETHODCALLTYPE get_Path(BSTR *Path);
568 virtual HRESULT STDMETHODCALLTYPE get_Visible(VARIANT_BOOL *pBool);
569 virtual HRESULT STDMETHODCALLTYPE put_Visible(VARIANT_BOOL Value);
570 virtual HRESULT STDMETHODCALLTYPE get_StatusBar(VARIANT_BOOL *pBool);
571 virtual HRESULT STDMETHODCALLTYPE put_StatusBar(VARIANT_BOOL Value);
572 virtual HRESULT STDMETHODCALLTYPE get_StatusText(BSTR *StatusText);
573 virtual HRESULT STDMETHODCALLTYPE put_StatusText(BSTR StatusText);
574 virtual HRESULT STDMETHODCALLTYPE get_ToolBar(int *Value);
575 virtual HRESULT STDMETHODCALLTYPE put_ToolBar(int Value);
576 virtual HRESULT STDMETHODCALLTYPE get_MenuBar(VARIANT_BOOL *Value);
577 virtual HRESULT STDMETHODCALLTYPE put_MenuBar(VARIANT_BOOL Value);
578 virtual HRESULT STDMETHODCALLTYPE get_FullScreen(VARIANT_BOOL *pbFullScreen);
579 virtual HRESULT STDMETHODCALLTYPE put_FullScreen(VARIANT_BOOL bFullScreen);
580
581 // *** IWebBrowser2 methods ***
582 virtual HRESULT STDMETHODCALLTYPE Navigate2(VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName,
583 VARIANT *PostData, VARIANT *Headers);
584 virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf);
585 virtual HRESULT STDMETHODCALLTYPE ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
586 VARIANT *pvaIn, VARIANT *pvaOut);
587 virtual HRESULT STDMETHODCALLTYPE ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize);
588 virtual HRESULT STDMETHODCALLTYPE get_ReadyState(READYSTATE *plReadyState);
589 virtual HRESULT STDMETHODCALLTYPE get_Offline(VARIANT_BOOL *pbOffline);
590 virtual HRESULT STDMETHODCALLTYPE put_Offline(VARIANT_BOOL bOffline);
591 virtual HRESULT STDMETHODCALLTYPE get_Silent(VARIANT_BOOL *pbSilent);
592 virtual HRESULT STDMETHODCALLTYPE put_Silent(VARIANT_BOOL bSilent);
593 virtual HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser(VARIANT_BOOL *pbRegister);
594 virtual HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser(VARIANT_BOOL bRegister);
595 virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL *pbRegister);
596 virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister);
597 virtual HRESULT STDMETHODCALLTYPE get_TheaterMode(VARIANT_BOOL *pbRegister);
598 virtual HRESULT STDMETHODCALLTYPE put_TheaterMode(VARIANT_BOOL bRegister);
599 virtual HRESULT STDMETHODCALLTYPE get_AddressBar(VARIANT_BOOL *Value);
600 virtual HRESULT STDMETHODCALLTYPE put_AddressBar(VARIANT_BOOL Value);
601 virtual HRESULT STDMETHODCALLTYPE get_Resizable(VARIANT_BOOL *Value);
602 virtual HRESULT STDMETHODCALLTYPE put_Resizable(VARIANT_BOOL Value);
603
604 // *** ITravelLogClient methods ***
605 virtual HRESULT STDMETHODCALLTYPE FindWindowByIndex(DWORD dwID, IUnknown **ppunk);
606 virtual HRESULT STDMETHODCALLTYPE GetWindowData(IStream *pStream, LPWINDOWDATA pWinData);
607 virtual HRESULT STDMETHODCALLTYPE LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition);
608
609 // *** IPersist methods ***
610 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
611
612 // *** IPersistHistory methods ***
613 virtual HRESULT STDMETHODCALLTYPE LoadHistory(IStream *pStream, IBindCtx *pbc);
614 virtual HRESULT STDMETHODCALLTYPE SaveHistory(IStream *pStream);
615 virtual HRESULT STDMETHODCALLTYPE SetPositionCookie(DWORD dwPositioncookie);
616 virtual HRESULT STDMETHODCALLTYPE GetPositionCookie(DWORD *pdwPositioncookie);
617
618 // message handlers
619 LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
620 LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
621 LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
622 LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
623 LRESULT RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
624 LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
625 LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
626 LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
627 LRESULT OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
628 LRESULT OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
629 LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
630 LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
631 LRESULT OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
632 LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
633 LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
634 LRESULT OnIsThisLegal(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
635 LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
636 LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
637 LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
638 LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
639 LRESULT OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
640 LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
641 LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
642 LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
643 LRESULT RelayCommands(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
644
645 static ATL::CWndClassInfo& GetWndClassInfo()
646 {
647 static ATL::CWndClassInfo wc =
648 {
649 { sizeof(WNDCLASSEX), CS_DBLCLKS, StartWindowProc,
650 0, 0, NULL, LoadIcon(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_CABINET)),
651 LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW + 1), NULL, szCabinetWndClass, NULL },
652 NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
653 };
654 return wc;
655 }
656
657 BEGIN_MSG_MAP(CShellBrowser)
658 MESSAGE_HANDLER(WM_CREATE, OnCreate)
659 MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
660 MESSAGE_HANDLER(WM_SIZE, OnSize)
661 MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup)
662 MESSAGE_HANDLER(WM_MEASUREITEM, RelayMsgToShellView)
663 MESSAGE_HANDLER(WM_DRAWITEM, RelayMsgToShellView)
664 MESSAGE_HANDLER(WM_MENUSELECT, RelayMsgToShellView)
665 COMMAND_ID_HANDLER(IDM_FILE_CLOSE, OnClose)
666 COMMAND_ID_HANDLER(IDM_TOOLS_FOLDEROPTIONS, OnFolderOptions)
667 COMMAND_ID_HANDLER(IDM_TOOLS_MAPNETWORKDRIVE, OnMapNetworkDrive)
668 COMMAND_ID_HANDLER(IDM_TOOLS_DISCONNECTNETWORKDRIVE, OnDisconnectNetworkDrive)
669 COMMAND_ID_HANDLER(IDM_HELP_ABOUT, OnAboutReactOS)
670 COMMAND_ID_HANDLER(IDM_GOTO_BACK, OnGoBack)
671 COMMAND_ID_HANDLER(IDM_GOTO_FORWARD, OnGoForward)
672 COMMAND_ID_HANDLER(IDM_GOTO_UPONELEVEL, OnGoUpLevel)
673 COMMAND_ID_HANDLER(IDM_GOTO_HOMEPAGE, OnGoHome)
674 COMMAND_ID_HANDLER(IDM_HELP_ISTHISCOPYLEGAL, OnIsThisLegal)
675 COMMAND_ID_HANDLER(IDM_VIEW_STATUSBAR, OnToggleStatusBarVisible)
676 COMMAND_ID_HANDLER(IDM_TOOLBARS_LOCKTOOLBARS, OnToggleToolbarLock)
677 COMMAND_ID_HANDLER(IDM_TOOLBARS_STANDARDBUTTONS, OnToggleToolbarBandVisible)
678 COMMAND_ID_HANDLER(IDM_TOOLBARS_ADDRESSBAR, OnToggleAddressBandVisible)
679 COMMAND_ID_HANDLER(IDM_TOOLBARS_LINKSBAR, OnToggleLinksBandVisible)
680 COMMAND_ID_HANDLER(IDM_TOOLBARS_TEXTLABELS, OnToggleTextLabels)
681 COMMAND_ID_HANDLER(IDM_TOOLBARS_CUSTOMIZE, OnToolbarCustomize)
682 COMMAND_ID_HANDLER(IDM_BACKSPACE, OnBackspace)
683 COMMAND_RANGE_HANDLER(IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, OnGoTravel)
684 MESSAGE_HANDLER(WM_COMMAND, RelayCommands)
685 END_MSG_MAP()
686
687 BEGIN_CONNECTION_POINT_MAP(CShellBrowser)
688 CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
689 CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
690 END_CONNECTION_POINT_MAP()
691
692 BEGIN_COM_MAP(CShellBrowser)
693 COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
694 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
695 COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
696 COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
697 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
698 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
699 COM_INTERFACE_ENTRY_IID(IID_IProfferService, IProfferService)
700 COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
701 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
702 COM_INTERFACE_ENTRY_IID(IID_IConnectionPointContainer, IConnectionPointContainer)
703 COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser)
704 COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowserApp)
705 COM_INTERFACE_ENTRY_IID(IID_IWebBrowser2, IWebBrowser2)
706 COM_INTERFACE_ENTRY_IID(IID_ITravelLogClient, ITravelLogClient)
707 COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
708 COM_INTERFACE_ENTRY_IID(IID_IPersistHistory, IPersistHistory)
709 COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
710 COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
711 END_COM_MAP()
712 };
713
714 extern HRESULT CreateProgressDialog(REFIID riid, void **ppv);
715
716 CShellBrowser::CShellBrowser()
717 {
718 fCurrentShellViewWindow = NULL;
719 fCurrentDirectoryPIDL = NULL;
720 fStatusBar = NULL;
721 fStatusBarVisible = true;
722 memset(fClientBars, 0, sizeof(fClientBars));
723 fCurrentMenuBar = NULL;
724 fHistoryObject = NULL;
725 fHistoryStream = NULL;
726 fHistoryBindContext = NULL;
727 }
728
729 CShellBrowser::~CShellBrowser()
730 {
731 }
732
733 HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
734 {
735 CComPtr<IDockingWindow> dockingWindow;
736 CComPtr<IStream> settingsStream;
737 CComPtr<IPersistStreamInit> persistStreamInit;
738 CComPtr<IOleCommandTarget> commandTarget;
739 CComPtr<IObjectWithSite> objectSite;
740 HRESULT hResult;
741
742 _AtlInitialConstruct();
743
744 fCabinetState.cLength = sizeof(fCabinetState);
745 if (ReadCabinetState(&fCabinetState, sizeof(fCabinetState)) == FALSE)
746 {
747 }
748
749 // create window
750 Create(HWND_DESKTOP);
751 if (m_hWnd == NULL)
752 return E_FAIL;
753
754 #if 0
755 hResult = CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &fClientBars[BIInternetToolbar].clientBar));
756 if (FAILED(hResult))
757 return hResult;
758 #else
759 hResult = CreateInternetToolbar(IID_PPV_ARG(IUnknown, &fClientBars[BIInternetToolbar].clientBar));
760 if (FAILED(hResult))
761 return hResult;
762 #endif
763
764 // create interfaces
765 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
766 IID_PPV_ARG(IDockingWindow, &dockingWindow));
767 if (FAILED(hResult))
768 return hResult;
769 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
770 IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
771 if (FAILED(hResult))
772 return hResult;
773 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
774 IID_PPV_ARG(IOleCommandTarget, &commandTarget));
775 if (FAILED(hResult))
776 return hResult;
777 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
778 IID_PPV_ARG(IObjectWithSite, &objectSite));
779 if (FAILED(hResult))
780 return hResult;
781
782 hResult = objectSite->SetSite(static_cast<IShellBrowser *>(this));
783 if (FAILED(hResult))
784 return hResult;
785
786 hResult = commandTarget->Exec(&CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
787 if (FAILED(hResult))
788 return hResult;
789
790 // TODO: create settingsStream from registry entry
791 if (settingsStream.p == NULL)
792 {
793 hResult = persistStreamInit->InitNew();
794 if (FAILED(hResult))
795 return hResult;
796 }
797 else
798 {
799 hResult = persistStreamInit->Load(settingsStream);
800 if (FAILED(hResult))
801 return hResult;
802 }
803 hResult = dockingWindow->ShowDW(TRUE);
804 if (FAILED(hResult))
805 return hResult;
806
807 fToolbarProxy.Initialize(m_hWnd, fClientBars[BIInternetToolbar].clientBar);
808
809 // create status bar
810 fStatusBar = CreateWindow(STATUSCLASSNAMEW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
811 SBT_NOBORDERS | SBT_TOOLTIPS, 0, 0, 500, 20, m_hWnd, (HMENU)0xa001,
812 _AtlBaseModule.GetModuleInstance(), 0);
813 fStatusBarVisible = true;
814
815 // browse
816 hResult = BrowseToPIDL(pidl, BTP_UPDATE_NEXT_HISTORY);
817 if (FAILED(hResult))
818 return hResult;
819
820 ShowWindow(SW_SHOWNORMAL);
821
822 return S_OK;
823 }
824
825 HRESULT CShellBrowser::BrowseToPIDL(LPCITEMIDLIST pidl, long flags)
826 {
827 CComPtr<IShellFolder> newFolder;
828 FOLDERSETTINGS newFolderSettings;
829 HRESULT hResult;
830
831 // called by shell view to browse to new folder
832 // also called by explorer band to navigate to new folder
833 hResult = SHBindToFolder(pidl, &newFolder);
834 if (FAILED(hResult))
835 return hResult;
836
837 newFolderSettings.ViewMode = FVM_ICON;
838 newFolderSettings.fFlags = 0;
839 hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
840 if (FAILED(hResult))
841 return hResult;
842 return S_OK;
843 }
844
845 BOOL WINAPI _ILIsDesktop(LPCITEMIDLIST pidl)
846 {
847 return (pidl == NULL || pidl->mkid.cb == 0);
848 }
849
850 BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
851 {
852 LPCITEMIDLIST pidlnext;
853 WORD length;
854 BOOL ret;
855
856 ret = TRUE;
857 if (! _ILIsDesktop(pidl))
858 {
859 length = pidl->mkid.cb;
860 pidlnext =
861 reinterpret_cast<LPCITEMIDLIST>(
862 reinterpret_cast<const BYTE *>(pidl) + length);
863 if (pidlnext->mkid.cb != 0)
864 ret = FALSE;
865 }
866 return ret;
867 }
868
869 HRESULT WINAPI SHBindToFolderIDListParent(IShellFolder *unused, LPCITEMIDLIST pidl,
870 const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
871 {
872 CComPtr<IShellFolder> psf;
873 LPITEMIDLIST pidlChild;
874 LPITEMIDLIST pidlParent;
875 HRESULT hResult;
876
877 hResult = E_FAIL;
878 if (ppv == NULL)
879 return E_POINTER;
880 *ppv = NULL;
881 if (ppidlLast != NULL)
882 *ppidlLast = NULL;
883 if (_ILIsPidlSimple(pidl))
884 {
885 if (ppidlLast != NULL)
886 *ppidlLast = ILClone(pidl);
887 hResult = SHGetDesktopFolder((IShellFolder **)ppv);
888 }
889 else
890 {
891 pidlChild = ILClone(ILFindLastID(pidl));
892 pidlParent = ILClone(pidl);
893 ILRemoveLastID(pidlParent);
894 hResult = SHGetDesktopFolder(&psf);
895 if (SUCCEEDED(hResult))
896 hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
897 if (SUCCEEDED(hResult) && ppidlLast != NULL)
898 *ppidlLast = pidlChild;
899 else
900 ILFree(pidlChild);
901 ILFree(pidlParent);
902 }
903 return hResult;
904 }
905
906 HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10,
907 LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
908 {
909 CComPtr<IShellFolder> parentFolder;
910 LPITEMIDLIST childPIDL;
911 STRRET L108;
912 HRESULT hResult;
913
914 hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
915 hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
916 StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
917 if (rgfInOut)
918 hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
919 ILFree(childPIDL);
920 return S_OK;
921 }
922
923 long IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
924 {
925 return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
926 }
927
928 HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
929 LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
930 {
931 CComPtr<IObjectWithSite> objectWithSite;
932 CComPtr<IShellFolder> saveCurrentShellFolder;
933 CComPtr<IShellView> saveCurrentShellView;
934 CComPtr<IShellView> newShellView;
935 CComPtr<ITravelLog> travelLog;
936 HWND newShellViewWindow;
937 BOOL windowUpdateIsLocked;
938 RECT shellViewWindowBounds;
939 HWND previousView;
940 HCURSOR saveCursor;
941 wchar_t newTitle[MAX_PATH];
942 SHGDNF nameFlags;
943 HRESULT hResult;
944
945 if (newShellFolder == NULL)
946 return E_INVALIDARG;
947
948 hResult = GetTravelLog(&travelLog);
949 if (FAILED(hResult))
950 return hResult;
951
952 // update history
953 if (flags & BTP_UPDATE_CUR_HISTORY)
954 {
955 if (travelLog->CountEntries(static_cast<IDropTarget *>(this)) > 0)
956 hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
957 // what to do with error? Do we want to halt browse because state save failed?
958 }
959
960 if (fCurrentShellView)
961 {
962 fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
963 }
964
965 // create view object
966 hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
967 if (FAILED(hResult))
968 return hResult;
969 previousView = fCurrentShellViewWindow;
970
971 // enter updating section
972 saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
973 windowUpdateIsLocked = LockWindowUpdate(TRUE);
974 if (fCurrentShellView != NULL)
975 ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0);
976
977 // set site
978 hResult = newShellView->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
979 if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
980 hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
981
982 // update folder and view
983 saveCurrentShellFolder = fCurrentShellFolder;
984 saveCurrentShellView = fCurrentShellView;
985 fCurrentShellFolder = newShellFolder;
986 fCurrentShellView = newShellView;
987
988 // get boundary
989 if (previousView != NULL)
990 ::GetWindowRect(previousView, &shellViewWindowBounds);
991 else
992 ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
993 ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
994
995 // create view window
996 hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
997 this, &shellViewWindowBounds, &newShellViewWindow);
998 if (FAILED(hResult) || newShellViewWindow == NULL)
999 {
1000 fCurrentShellView = saveCurrentShellView;
1001 fCurrentShellFolder = saveCurrentShellFolder;
1002 ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 1, 0);
1003 if (windowUpdateIsLocked)
1004 LockWindowUpdate(FALSE);
1005 SetCursor(saveCursor);
1006 return hResult;
1007 }
1008
1009 if (objectWithSite.p != NULL)
1010 hResult = objectWithSite->SetSite(NULL);
1011
1012 // update current pidl
1013 ILFree(fCurrentDirectoryPIDL);
1014 fCurrentDirectoryPIDL = ILClone(absolutePIDL);
1015
1016 // update view window
1017 if (saveCurrentShellView != NULL)
1018 saveCurrentShellView->DestroyViewWindow();
1019 fCurrentShellViewWindow = newShellViewWindow;
1020
1021 // no use
1022 saveCurrentShellView.Release();
1023 saveCurrentShellFolder.Release();
1024
1025 hResult = newShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
1026
1027 // leave updating section
1028 if (windowUpdateIsLocked)
1029 LockWindowUpdate(FALSE);
1030 SetCursor(saveCursor);
1031
1032 // update history
1033 if (flags & BTP_UPDATE_NEXT_HISTORY)
1034 {
1035 hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1036 hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1037 }
1038
1039 // completed
1040 nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1041 hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1042 sizeof(newTitle) / sizeof(wchar_t), NULL);
1043 if (SUCCEEDED(hResult))
1044 {
1045 FireNavigateComplete(newTitle);
1046 }
1047 else
1048 {
1049 FireNavigateComplete(L"ERROR");
1050 }
1051
1052 if (fCabinetState.fFullPathTitle)
1053 nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1054 else
1055 nameFlags = SHGDN_FORADDRESSBAR;
1056 hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1057 sizeof(newTitle) / sizeof(wchar_t), NULL);
1058 if (SUCCEEDED(hResult))
1059 {
1060 SetWindowText(newTitle);
1061
1062 LPCITEMIDLIST pidlChild;
1063 INT index, indexOpen;
1064 HIMAGELIST himlSmall, himlLarge;
1065
1066 CComPtr<IShellFolder> sf;
1067 SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1068
1069 index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1070
1071 Shell_GetImageLists(&himlLarge, &himlSmall);
1072
1073 HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1074 HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1075
1076 SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1077 SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge));
1078 }
1079
1080 // TODO: Update the window icon
1081
1082 FireCommandStateChangeAll();
1083 hResult = UpdateForwardBackState();
1084 return S_OK;
1085 }
1086
1087 HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
1088 {
1089 CComPtr<IServiceProvider> serviceProvider;
1090 CComPtr<IBandSite> bandSite;
1091 CComPtr<IDeskBand> deskBand;
1092 HRESULT hResult;
1093
1094 if (fClientBars[BIInternetToolbar].clientBar.p == NULL)
1095 return E_FAIL;
1096 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
1097 IID_PPV_ARG(IServiceProvider, &serviceProvider));
1098 if (FAILED(hResult))
1099 return hResult;
1100 hResult = serviceProvider->QueryService(SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
1101 if (FAILED(hResult))
1102 return hResult;
1103 hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1104 if (FAILED(hResult))
1105 return hResult;
1106 return deskBand->QueryInterface(riid, shellMenu);
1107 }
1108
1109 HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
1110 {
1111 CComPtr<IUnknown> newBaseBar;
1112 CComPtr<IDeskBar> deskBar;
1113 CComPtr<IUnknown> newBaseBarSite;
1114 CComPtr<IObjectWithSite> objectWithSite;
1115 CComPtr<IDeskBarClient> deskBarClient;
1116 IUnknown **cache;
1117 HRESULT hResult;
1118
1119 if (vertical)
1120 cache = &fClientBars[BIVerticalBaseBar].clientBar.p;
1121 else
1122 cache = &fClientBars[BIHorizontalBaseBar].clientBar.p;
1123 if (*cache == NULL)
1124 {
1125 hResult = CreateBaseBar(IID_PPV_ARG(IUnknown, &newBaseBar));
1126 if (FAILED(hResult))
1127 return hResult;
1128 hResult = CreateBaseBarSite(IID_PPV_ARG(IUnknown, &newBaseBarSite));
1129 if (FAILED(hResult))
1130 return hResult;
1131
1132 // tell the new base bar about the shell browser
1133 hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1134 if (FAILED(hResult))
1135 return hResult;
1136 hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
1137 if (FAILED(hResult))
1138 return hResult;
1139
1140 // tell the new base bar about the new base bar site
1141 hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1142 if (FAILED(hResult))
1143 return hResult;
1144 hResult = deskBar->SetClient(newBaseBarSite);
1145 if (FAILED(hResult))
1146 return hResult;
1147
1148 // tell the new base bar site about the new base bar
1149 hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1150 if (FAILED(hResult))
1151 return hResult;
1152 hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1153 if (FAILED(hResult))
1154 return hResult;
1155
1156 *cache = newBaseBar.Detach();
1157 }
1158 return (*cache)->QueryInterface(IID_PPV_ARG(IUnknown, theBaseBar));
1159 }
1160
1161 HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1162 {
1163 CComPtr<IDockingWindow> dockingWindow;
1164 CComPtr<IOleCommandTarget> oleCommandTarget;
1165 CComPtr<IUnknown> baseBarSite;
1166 CComPtr<IUnknown> newBand;
1167 CComPtr<IUnknown> theBaseBar;
1168 CComPtr<IDeskBar> deskBar;
1169 VARIANT vaIn;
1170 HRESULT hResult;
1171
1172 __debugbreak();
1173
1174 hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
1175 if (FAILED(hResult))
1176 return hResult;
1177 hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1178 if (FAILED(hResult))
1179 return hResult;
1180 hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1181 if (FAILED(hResult))
1182 return hResult;
1183 hResult = deskBar->GetClient(&baseBarSite);
1184 if (FAILED(hResult))
1185 return hResult;
1186 hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1187 if (FAILED(hResult))
1188 return hResult;
1189 hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
1190 if (FAILED(hResult))
1191 return hResult;
1192 V_VT(&vaIn) = VT_UNKNOWN;
1193 V_UNKNOWN(&vaIn) = newBand.p;
1194 hResult = oleCommandTarget->Exec(&CGID_IDeskBand, 1, 1, &vaIn, NULL);
1195 if (FAILED(hResult))
1196 return hResult;
1197 hResult = dockingWindow->ShowDW(TRUE);
1198 if (FAILED(hResult))
1199 return hResult;
1200 return S_OK;
1201 }
1202
1203 HRESULT CShellBrowser::NavigateToParent()
1204 {
1205 LPITEMIDLIST newDirectory;
1206 HRESULT hResult;
1207
1208 newDirectory = ILClone(fCurrentDirectoryPIDL);
1209 if (newDirectory == NULL)
1210 return E_OUTOFMEMORY;
1211 ILRemoveLastID(newDirectory);
1212 hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1213 ILFree(newDirectory);
1214 if (FAILED(hResult))
1215 return hResult;
1216 return S_OK;
1217 }
1218
1219 BOOL CALLBACK AddFolderOptionsPage(HPROPSHEETPAGE thePage, LPARAM lParam)
1220 {
1221 PROPSHEETHEADER *sheetInfo;
1222
1223 sheetInfo = (PROPSHEETHEADER *)lParam;
1224 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1225 return FALSE;
1226 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1227 sheetInfo->nPages++;
1228 return TRUE;
1229 }
1230
1231 HRESULT CShellBrowser::DoFolderOptions()
1232 {
1233 CComPtr<IShellPropSheetExt> folderOptionsSheet;
1234 CComPtr<IObjectWithSite> objectWithSite;
1235 PROPSHEETHEADER m_PropSheet;
1236 HPROPSHEETPAGE m_psp[folderOptionsPageCountMax];
1237 // CComPtr<IGlobalFolderSettings> globalSettings;
1238 // SHELLSTATE2 shellState;
1239 HRESULT hResult;
1240
1241 memset(m_psp, 0, sizeof(m_psp));
1242 memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1243
1244 // create sheet object
1245 hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1246 IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1247 if (FAILED(hResult))
1248 return E_FAIL;
1249
1250 // must set site in order for Apply to all Folders on Advanced page to be enabled
1251 hResult = folderOptionsSheet->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1252 if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
1253 hResult = objectWithSite->SetSite(static_cast<IDispatch *>(this));
1254 m_PropSheet.phpage = m_psp;
1255
1256 #if 0
1257 hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1258 if (FAILED(hResult))
1259 return E_FAIL;
1260 hResult = globalSettings->Get(&shellState, sizeof(shellState));
1261 if (FAILED(hResult))
1262 return E_FAIL;
1263 #endif
1264
1265 // add pages
1266 hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1267 if (FAILED(hResult))
1268 return E_FAIL;
1269
1270 if (fCurrentShellView != NULL)
1271 {
1272 hResult = fCurrentShellView->AddPropertySheetPages(
1273 0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1274 if (FAILED(hResult))
1275 return E_FAIL;
1276 }
1277
1278 // show sheet
1279 m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1280 m_PropSheet.dwFlags = 0;
1281 m_PropSheet.hwndParent = m_hWnd;
1282 m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1283 m_PropSheet.pszCaption = _T("Folder Options");
1284 m_PropSheet.nStartPage = 0;
1285 PropertySheet(&m_PropSheet);
1286 return S_OK;
1287 }
1288
1289 LRESULT CALLBACK CShellBrowser::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1290 {
1291 CShellBrowser *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1292 _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1293 LRESULT lResult;
1294 CComPtr<IMenuBand> menuBand;
1295 const _ATL_MSG *previousMessage;
1296 BOOL handled;
1297 WNDPROC saveWindowProc;
1298 HRESULT hResult;
1299
1300 hWnd = pThis->m_hWnd;
1301 previousMessage = pThis->m_pCurrentMsg;
1302 pThis->m_pCurrentMsg = &msg;
1303
1304 hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1305 if (SUCCEEDED(hResult) && menuBand.p != NULL)
1306 {
1307 hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1308 if (hResult == S_OK)
1309 return lResult;
1310 uMsg = msg.message;
1311 wParam = msg.wParam;
1312 lParam = msg.lParam;
1313 }
1314
1315 handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1316 ATLASSERT(pThis->m_pCurrentMsg == &msg);
1317 if (handled == FALSE)
1318 {
1319 if (uMsg == WM_NCDESTROY)
1320 {
1321 saveWindowProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWL_WNDPROC));
1322 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1323 if (saveWindowProc == reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWL_WNDPROC)))
1324 SetWindowLongPtr(hWnd, GWL_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc);
1325 pThis->m_dwState |= WINSTATE_DESTROYED;
1326 }
1327 else
1328 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1329 }
1330 pThis->m_pCurrentMsg = previousMessage;
1331 if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1332 {
1333 pThis->m_dwState &= ~WINSTATE_DESTROYED;
1334 pThis->m_hWnd = NULL;
1335 pThis->OnFinalMessage(hWnd);
1336 }
1337 return lResult;
1338 }
1339
1340 void CShellBrowser::RepositionBars()
1341 {
1342 RECT clientRect;
1343 RECT statusRect;
1344 int x;
1345
1346 GetClientRect(&clientRect);
1347
1348 if (fStatusBarVisible && fStatusBar)
1349 {
1350 ::GetWindowRect(fStatusBar, &statusRect);
1351 ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1352 clientRect.right - clientRect.left,
1353 statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1354 clientRect.bottom -= statusRect.bottom - statusRect.top;
1355 }
1356
1357 for (x = 0; x < 3; x++)
1358 {
1359 HWND hwnd = fClientBars[x].hwnd;
1360 RECT borderSpace = fClientBars[x].borderSpace;
1361 if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1362 {
1363 IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1364 fClientBars[x].hwnd = hwnd;
1365 }
1366 if (hwnd != NULL)
1367 {
1368 RECT toolbarRect = clientRect;
1369 if (borderSpace.top != 0)
1370 {
1371 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1372 }
1373 else if (borderSpace.bottom != 0)
1374 {
1375 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1376 }
1377 else if (borderSpace.left != 0)
1378 {
1379 toolbarRect.right = toolbarRect.left + borderSpace.left;
1380 }
1381 else if (borderSpace.right != 0)
1382 {
1383 toolbarRect.left = toolbarRect.right - borderSpace.right;
1384 }
1385
1386 ::SetWindowPos(hwnd, NULL,
1387 toolbarRect.left,
1388 toolbarRect.top,
1389 toolbarRect.right - toolbarRect.left,
1390 toolbarRect.bottom - toolbarRect.top,
1391 SWP_NOOWNERZORDER | SWP_NOZORDER);
1392
1393 if (borderSpace.top != 0)
1394 {
1395 clientRect.top = toolbarRect.bottom;
1396 }
1397 else if (borderSpace.bottom != 0)
1398 {
1399 clientRect.bottom = toolbarRect.top;
1400 }
1401 else if (borderSpace.left != 0)
1402 {
1403 clientRect.left = toolbarRect.right;
1404 }
1405 else if (borderSpace.right != 0)
1406 {
1407 clientRect.right = toolbarRect.left;
1408 }
1409 }
1410 }
1411 ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1412 clientRect.right - clientRect.left,
1413 clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1414 }
1415
1416 HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1417 {
1418 DISPPARAMS params;
1419 CComDynamicUnkArray &vec = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>::m_vec;
1420 CComDynamicUnkArray &vec2 = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>::m_vec;
1421 HRESULT hResult;
1422
1423 params.rgvarg = arguments;
1424 params.rgdispidNamedArgs = NULL;
1425 params.cArgs = argCount;
1426 params.cNamedArgs = 0;
1427 IUnknown** pp = vec.begin();
1428 while (pp < vec.end())
1429 {
1430 if (*pp != NULL)
1431 {
1432 CComPtr<IDispatch> theDispatch;
1433
1434 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1435 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1436 }
1437 pp++;
1438 }
1439 pp = vec2.begin();
1440 while (pp < vec2.end())
1441 {
1442 if (*pp != NULL)
1443 {
1444 CComPtr<IDispatch> theDispatch;
1445
1446 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1447 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1448 }
1449 pp++;
1450 }
1451 return S_OK;
1452 }
1453
1454 HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1455 {
1456 // these two variants intentionally to do use CComVariant because it would double free/release
1457 // or does not need to dispose at all
1458 VARIANT varArg[2];
1459 VARIANT varArgs;
1460 CComBSTR tempString(newDirectory);
1461
1462 V_VT(&varArgs) = VT_BSTR;
1463 V_BSTR(&varArgs) = tempString.m_str;
1464
1465 V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1466 V_VARIANTREF(&varArg[0]) = &varArgs;
1467 V_VT(&varArg[1]) = VT_DISPATCH;
1468 V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1469
1470 return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1471 }
1472
1473 HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1474 {
1475 VARIANT varArg[2];
1476
1477 V_VT(&varArg[0]) = VT_BOOL;
1478 V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1479 V_VT(&varArg[1]) = VT_I4;
1480 V_I4(&varArg[1]) = commandID;
1481
1482 return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1483 }
1484
1485 HRESULT CShellBrowser::FireCommandStateChangeAll()
1486 {
1487 return FireCommandStateChange(false, -1);
1488 }
1489
1490 HRESULT CShellBrowser::UpdateForwardBackState()
1491 {
1492 CComPtr<ITravelLog> travelLog;
1493 CComPtr<ITravelEntry> unusedEntry;
1494 bool canGoBack;
1495 bool canGoForward;
1496 HRESULT hResult;
1497
1498 canGoBack = false;
1499 canGoForward = false;
1500 hResult = GetTravelLog(&travelLog);
1501 if (FAILED(hResult))
1502 return hResult;
1503 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1504 if (SUCCEEDED(hResult))
1505 {
1506 canGoBack = true;
1507 unusedEntry.Release();
1508 }
1509 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1510 if (SUCCEEDED(hResult))
1511 {
1512 canGoForward = true;
1513 unusedEntry.Release();
1514 }
1515 hResult = FireCommandStateChange(canGoBack, 2);
1516 hResult = FireCommandStateChange(canGoForward, 1);
1517 return S_OK;
1518 }
1519
1520 void CShellBrowser::UpdateGotoMenu(HMENU theMenu)
1521 {
1522 CComPtr<ITravelLog> travelLog;
1523 int position;
1524 MENUITEMINFO menuItemInfo;
1525 HRESULT hResult;
1526
1527 DeleteMenuItems(theMenu, IDM_GOTO_TRAVEL_FIRST, IDM_GOTO_TRAVEL_LAST);
1528
1529 position = GetMenuItemCount(theMenu);
1530 hResult = GetTravelLog(&travelLog);
1531 if (FAILED(hResult))
1532 return;
1533 hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1534 IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, TLMENUF_BACKANDFORTH | TLMENUF_CHECKCURRENT);
1535 if (SUCCEEDED(hResult))
1536 {
1537 menuItemInfo.cbSize = sizeof(menuItemInfo);
1538 menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1539 menuItemInfo.fType = MF_SEPARATOR;
1540 menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1541 InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1542 }
1543 }
1544
1545 void CShellBrowser::UpdateViewMenu(HMENU theMenu)
1546 {
1547 CComPtr<IOleCommandTarget> oleCommandTarget;
1548 CComPtr<ITravelLog> travelLog;
1549 HMENU gotoMenu;
1550 OLECMD commandList[5];
1551 HMENU toolbarMenuBar;
1552 HMENU toolbarMenu;
1553 MENUITEMINFO menuItemInfo;
1554 HRESULT hResult;
1555
1556 gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1557 if (gotoMenu != NULL)
1558 UpdateGotoMenu(gotoMenu);
1559
1560 commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1561 commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1562 commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1563 commandList[3].cmdID = ITID_TOOLBARLOCKED;
1564 commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1565
1566 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
1567 IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
1568 if (SUCCEEDED(hResult))
1569 hResult = oleCommandTarget->QueryStatus(&CGID_PrivCITCommands, 5, commandList, NULL);
1570 if (FAILED(hResult))
1571 DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND);
1572 else
1573 {
1574 toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1575 toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1576
1577 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf);
1578 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1579 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1580 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_ENABLED);
1581 if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1582 DeleteMenu(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
1583 DeleteMenu(toolbarMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
1584 DeleteMenu(toolbarMenu, IDM_TOOLBARS_GOBUTTON, MF_BYCOMMAND);
1585
1586 menuItemInfo.cbSize = sizeof(menuItemInfo);
1587 menuItemInfo.fMask = MIIM_SUBMENU;
1588 menuItemInfo.hSubMenu = toolbarMenu;
1589 SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1590 }
1591 SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, fStatusBarVisible ? TRUE : FALSE);
1592 }
1593
1594 bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
1595 {
1596 CComPtr<IUnknown> int1Retry;
1597 CComPtr<IUnknown> int2Retry;
1598 HRESULT hResult;
1599
1600 if (int1 == int2)
1601 return true;
1602 if (int1 == NULL || int2 == NULL)
1603 return false;
1604 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1605 if (FAILED(hResult))
1606 return false;
1607 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1608 if (FAILED(hResult))
1609 return false;
1610 if (int1Retry == int2Retry)
1611 return true;
1612 return false;
1613 }
1614
1615 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
1616 {
1617 static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
1618
1619 RECT availableBounds;
1620
1621 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1622 for (INT x = 0; x < 3; x++)
1623 {
1624 if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1625 {
1626 availableBounds.top += fClientBars[x].borderSpace.top;
1627 availableBounds.left += fClientBars[x].borderSpace.left;
1628 availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1629 availableBounds.right -= fClientBars[x].borderSpace.right;
1630 }
1631 }
1632 *prcBorder = availableBounds;
1633 return S_OK;
1634 }
1635
1636 HRESULT STDMETHODCALLTYPE CShellBrowser::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1637 {
1638 return S_OK;
1639 }
1640
1641 HRESULT STDMETHODCALLTYPE CShellBrowser::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1642 {
1643 for (INT x = 0; x < 3; x++)
1644 {
1645 if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1646 {
1647 fClientBars[x].borderSpace = *pbw;
1648 // if this bar changed size, it cascades and forces all subsequent bars to resize
1649 RepositionBars();
1650 return S_OK;
1651 }
1652 }
1653 return E_INVALIDARG;
1654 }
1655
1656 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
1657 ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
1658 {
1659 CComPtr<IOleCommandTarget> commandTarget;
1660 HRESULT hResult;
1661
1662 if (prgCmds == NULL)
1663 return E_INVALIDARG;
1664 if (pguidCmdGroup == NULL)
1665 {
1666 if (fCurrentShellView.p != NULL)
1667 {
1668 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
1669 if (SUCCEEDED(hResult) && commandTarget.p != NULL)
1670 return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
1671 }
1672 while (cCmds != 0)
1673 {
1674 prgCmds->cmdf = 0;
1675 prgCmds++;
1676 cCmds--;
1677 }
1678 }
1679 else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1680 {
1681 while (cCmds != 0)
1682 {
1683 switch (prgCmds->cmdID)
1684 {
1685 case 0x1c: // search
1686 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1687 break;
1688 case 0x1d: // history
1689 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1690 break;
1691 case 0x1e: // favorites
1692 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1693 break;
1694 case 0x23: // folders
1695 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED | OLECMDF_LATCHED;
1696 break;
1697 default:
1698 prgCmds->cmdf = 0;
1699 break;
1700 }
1701 prgCmds++;
1702 cCmds--;
1703 }
1704 }
1705 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1706 {
1707 while (cCmds != 0)
1708 {
1709 switch (prgCmds->cmdID)
1710 {
1711 case 0xa022: // up level
1712 prgCmds->cmdf = OLECMDF_SUPPORTED;
1713 if (fCurrentDirectoryPIDL->mkid.cb != 0)
1714 prgCmds->cmdf |= OLECMDF_ENABLED;
1715 break;
1716 }
1717 prgCmds++;
1718 cCmds--;
1719 }
1720 }
1721 return S_OK;
1722 }
1723
1724 HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
1725 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
1726 {
1727 HRESULT hResult;
1728
1729 if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1730 {
1731 switch (nCmdID)
1732 {
1733 case 0x23:
1734 hResult = ShowBand(CLSID_ExplorerBand, true);
1735 return S_OK;
1736 case 0x27:
1737 if (nCmdexecopt == 1)
1738 {
1739 // pvaIn is a VT_UNKNOWN with a band that is being hidden
1740 }
1741 else
1742 {
1743 // update zones part of the status bar
1744 }
1745 return S_OK;
1746 case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
1747 V_VT(pvaOut) = VT_INT_PTR;
1748 V_INTREF(pvaOut) = reinterpret_cast<INT *>(
1749 LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
1750 return S_OK;
1751 case 0x38:
1752 // indicate if this cabinet was opened as a browser
1753 return S_FALSE;
1754 default:
1755 return E_NOTIMPL;
1756 }
1757 }
1758 else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
1759 {
1760 switch (nCmdID)
1761 {
1762 case 0x23:
1763 // placeholder
1764 return S_OK;
1765 }
1766 }
1767 else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
1768 {
1769 switch (nCmdID)
1770 {
1771 case 6:
1772 // what is theater mode and why do we receive this?
1773 return E_NOTIMPL;
1774 }
1775 }
1776 else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
1777 {
1778 switch (nCmdID)
1779 {
1780 case 14:
1781 // initialize favorites menu
1782 return S_OK;
1783 }
1784 }
1785 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
1786 {
1787 switch (nCmdID)
1788 {
1789 case 0x12:
1790 // refresh on toolbar clicked
1791 return S_OK;
1792 case 0x4d:
1793 // tell the view if it should hide the task pane or not
1794 return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
1795 }
1796 }
1797 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1798 {
1799 switch (nCmdID)
1800 {
1801 case 40994:
1802 return NavigateToParent();
1803 }
1804 }
1805 else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
1806 {
1807 switch (nCmdID)
1808 {
1809 case 0x7063:
1810 return DoFolderOptions();
1811 }
1812 }
1813 else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
1814 {
1815 switch (nCmdID)
1816 {
1817 case 1:
1818 // Reset All Folders option in Folder Options
1819 break;
1820 }
1821 }
1822 else
1823 {
1824 return E_NOTIMPL;
1825 }
1826 return E_NOTIMPL;
1827 }
1828
1829 HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindow(HWND *lphwnd)
1830 {
1831 if (lphwnd == NULL)
1832 return E_POINTER;
1833 *lphwnd = m_hWnd;
1834 return S_OK;
1835 }
1836
1837 HRESULT STDMETHODCALLTYPE CShellBrowser::ContextSensitiveHelp(BOOL fEnterMode)
1838 {
1839 return E_NOTIMPL;
1840 }
1841
1842 HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
1843 {
1844 HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
1845 Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
1846
1847 int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
1848 Unused(itemCount3);
1849
1850 lpMenuWidths->width[0] = 2;
1851 lpMenuWidths->width[2] = 3;
1852 lpMenuWidths->width[4] = 1;
1853 return S_OK;
1854 }
1855
1856 HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
1857 {
1858 CComPtr<IShellMenu> shellMenu;
1859 HRESULT hResult;
1860
1861 if (IsMenu(hmenuShared) == FALSE)
1862 return E_FAIL;
1863 hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
1864 if (FAILED(hResult))
1865 return hResult;
1866 hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
1867 if (FAILED(hResult))
1868 return hResult;
1869 fCurrentMenuBar = hmenuShared;
1870 return S_OK;
1871 }
1872
1873 HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
1874 {
1875 if (hmenuShared == fCurrentMenuBar)
1876 fCurrentMenuBar = NULL;
1877 return S_OK;
1878 }
1879
1880 HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
1881 {
1882 //
1883 if (pszStatusText)
1884 {
1885 ::SetWindowText(fStatusBar, pszStatusText);
1886 }
1887 else
1888 {
1889
1890 }
1891 return E_NOTIMPL;
1892 }
1893
1894 HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
1895 {
1896 return E_NOTIMPL;
1897 }
1898
1899 HRESULT STDMETHODCALLTYPE CShellBrowser::TranslateAcceleratorSB(MSG *pmsg, WORD wID)
1900 {
1901 if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
1902 return S_FALSE;
1903 return S_OK;
1904 }
1905
1906 HRESULT STDMETHODCALLTYPE CShellBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
1907 {
1908 return BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1909 }
1910
1911 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
1912 {
1913 return E_NOTIMPL;
1914 }
1915
1916 HRESULT STDMETHODCALLTYPE CShellBrowser::GetControlWindow(UINT id, HWND *lphwnd)
1917 {
1918 if (lphwnd == NULL)
1919 return E_POINTER;
1920 *lphwnd = NULL;
1921 switch(id)
1922 {
1923 case FCW_TOOLBAR:
1924 *lphwnd = fToolbarProxy.m_hWnd;
1925 return S_OK;
1926 case FCW_STATUS:
1927 *lphwnd = fStatusBar;
1928 return S_OK;
1929 case FCW_TREE:
1930 // find the directory browser and return it
1931 // this should be used only to determine if a tree is present
1932 return S_OK;
1933 case FCW_PROGRESS:
1934 // is this a progress dialog?
1935 return S_OK;
1936 }
1937 return S_OK;
1938 }
1939
1940 HRESULT STDMETHODCALLTYPE CShellBrowser::SendControlMsg(
1941 UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
1942 {
1943 LPARAM result;
1944
1945 if (pret != NULL)
1946 *pret = 0;
1947 switch(id)
1948 {
1949 case FCW_TOOLBAR:
1950 result = fToolbarProxy.SendMessage(uMsg, wParam, lParam);
1951 if (pret != NULL)
1952 *pret = result;
1953 break;
1954 case FCW_STATUS:
1955 result = SendMessage(fStatusBar, uMsg, wParam, lParam);
1956 if (pret != NULL)
1957 *pret = result;
1958 break;
1959 }
1960 return S_OK;
1961 }
1962
1963 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryActiveShellView(IShellView **ppshv)
1964 {
1965 if (ppshv == NULL)
1966 return E_POINTER;
1967 *ppshv = fCurrentShellView;
1968 if (fCurrentShellView.p != NULL)
1969 fCurrentShellView.p->AddRef();
1970 return S_OK;
1971 }
1972
1973 HRESULT STDMETHODCALLTYPE CShellBrowser::OnViewWindowActive(IShellView *ppshv)
1974 {
1975 return E_NOTIMPL;
1976 }
1977
1978 HRESULT STDMETHODCALLTYPE CShellBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
1979 {
1980 return E_NOTIMPL;
1981 }
1982
1983 HRESULT STDMETHODCALLTYPE CShellBrowser::DragEnter(
1984 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
1985 {
1986 return E_NOTIMPL;
1987 }
1988
1989 HRESULT STDMETHODCALLTYPE CShellBrowser::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
1990 {
1991 return E_NOTIMPL;
1992 }
1993
1994 HRESULT STDMETHODCALLTYPE CShellBrowser::DragLeave()
1995 {
1996 return E_NOTIMPL;
1997 }
1998
1999 HRESULT STDMETHODCALLTYPE CShellBrowser::Drop(
2000 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2001 {
2002 return E_NOTIMPL;
2003 }
2004
2005 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
2006 {
2007 // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2008 // the returned interface has a method GetPropertyBag on it
2009 if (IsEqualIID(guidService, SID_STopLevelBrowser))
2010 return this->QueryInterface(riid, ppvObject);
2011 if (IsEqualIID(guidService, SID_SShellBrowser))
2012 return this->QueryInterface(riid, ppvObject);
2013 if (IsEqualIID(guidService, SID_ITargetFrame2))
2014 return this->QueryInterface(riid, ppvObject);
2015 if (IsEqualIID(guidService, SID_IWebBrowserApp)) // without this, the internet toolbar won't reflect notifications
2016 return this->QueryInterface(riid, ppvObject);
2017 if (IsEqualIID(guidService, SID_SProxyBrowser))
2018 return this->QueryInterface(riid, ppvObject);
2019 if (IsEqualIID(guidService, SID_IExplorerToolbar))
2020 return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2021 if (IsEqualIID(riid, IID_IShellBrowser))
2022 return this->QueryInterface(riid, ppvObject);
2023 return E_NOINTERFACE;
2024 }
2025
2026 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPropertyBag(long flags, REFIID riid, void **ppvObject)
2027 {
2028 if (ppvObject == NULL)
2029 return E_POINTER;
2030 *ppvObject = NULL;
2031 return E_NOTIMPL;
2032 }
2033
2034 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfoCount(UINT *pctinfo)
2035 {
2036 return E_NOTIMPL;
2037 }
2038
2039 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
2040 {
2041 return E_NOTIMPL;
2042 }
2043
2044 HRESULT STDMETHODCALLTYPE CShellBrowser::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
2045 UINT cNames, LCID lcid, DISPID *rgDispId)
2046 {
2047 return E_NOTIMPL;
2048 }
2049
2050 HRESULT STDMETHODCALLTYPE CShellBrowser::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
2051 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2052 {
2053 return E_NOTIMPL;
2054 }
2055
2056 HRESULT STDMETHODCALLTYPE CShellBrowser::GetParentSite(IOleInPlaceSite **ppipsite)
2057 {
2058 return E_NOTIMPL;
2059 }
2060
2061 HRESULT STDMETHODCALLTYPE CShellBrowser::SetTitle(IShellView *psv, LPCWSTR pszName)
2062 {
2063 return E_NOTIMPL;
2064 }
2065
2066 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName)
2067 {
2068 return E_NOTIMPL;
2069 }
2070
2071 HRESULT STDMETHODCALLTYPE CShellBrowser::GetOleObject(IOleObject **ppobjv)
2072 {
2073 return E_NOTIMPL;
2074 }
2075
2076 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
2077 {
2078 HRESULT hResult;
2079
2080 // called by toolbar when displaying tooltips
2081 if (pptl == NULL)
2082 return E_FAIL;
2083
2084 *pptl = NULL;
2085 if (fTravelLog.p == NULL)
2086 {
2087 hResult = CreateTravelLog(IID_PPV_ARG(ITravelLog, &fTravelLog));
2088 if (FAILED(hResult))
2089 return hResult;
2090 }
2091 *pptl = fTravelLog.p;
2092 fTravelLog.p->AddRef();
2093 return S_OK;
2094 }
2095
2096 HRESULT STDMETHODCALLTYPE CShellBrowser::ShowControlWindow(UINT id, BOOL fShow)
2097 {
2098 return E_NOTIMPL;
2099 }
2100
2101 HRESULT STDMETHODCALLTYPE CShellBrowser::IsControlWindowShown(UINT id, BOOL *pfShown)
2102 {
2103 return E_NOTIMPL;
2104 }
2105
2106 HRESULT STDMETHODCALLTYPE CShellBrowser::IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
2107 {
2108 return E_NOTIMPL;
2109 }
2110
2111 HRESULT STDMETHODCALLTYPE CShellBrowser::IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut)
2112 {
2113 return E_NOTIMPL;
2114 }
2115
2116 HRESULT STDMETHODCALLTYPE CShellBrowser::DisplayParseError(HRESULT hres, LPCWSTR pwszPath)
2117 {
2118 return E_NOTIMPL;
2119 }
2120
2121 HRESULT STDMETHODCALLTYPE CShellBrowser::NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF)
2122 {
2123 return E_NOTIMPL;
2124 }
2125
2126 HRESULT STDMETHODCALLTYPE CShellBrowser::SetNavigateState(BNSTATE bnstate)
2127 {
2128 return E_NOTIMPL;
2129 }
2130
2131 HRESULT STDMETHODCALLTYPE CShellBrowser::GetNavigateState(BNSTATE *pbnstate)
2132 {
2133 return E_NOTIMPL;
2134 }
2135
2136 HRESULT STDMETHODCALLTYPE CShellBrowser::NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse)
2137 {
2138 return E_NOTIMPL;
2139 }
2140
2141 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateWindowList()
2142 {
2143 return E_NOTIMPL;
2144 }
2145
2146 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateBackForwardState()
2147 {
2148 return E_NOTIMPL;
2149 }
2150
2151 HRESULT STDMETHODCALLTYPE CShellBrowser::SetFlags(DWORD dwFlags, DWORD dwFlagMask)
2152 {
2153 return E_NOTIMPL;
2154 }
2155
2156 HRESULT STDMETHODCALLTYPE CShellBrowser::GetFlags(DWORD *pdwFlags)
2157 {
2158 return E_NOTIMPL;
2159 }
2160
2161 HRESULT STDMETHODCALLTYPE CShellBrowser::CanNavigateNow()
2162 {
2163 return E_NOTIMPL;
2164 }
2165
2166 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPidl(LPITEMIDLIST *ppidl)
2167 {
2168 // called by explorer bar to get current pidl
2169 if (ppidl == NULL)
2170 return E_POINTER;
2171 *ppidl = ILClone(fCurrentDirectoryPIDL);
2172 return S_OK;
2173 }
2174
2175 HRESULT STDMETHODCALLTYPE CShellBrowser::SetReferrer(LPCITEMIDLIST pidl)
2176 {
2177 return E_NOTIMPL;
2178 }
2179
2180 DWORD STDMETHODCALLTYPE CShellBrowser::GetBrowserIndex()
2181 {
2182 return -1;
2183 }
2184
2185 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
2186 {
2187 return E_NOTIMPL;
2188 }
2189
2190 HRESULT STDMETHODCALLTYPE CShellBrowser::GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc)
2191 {
2192 if (ppole == NULL || pstm == NULL || ppbc == NULL)
2193 return E_INVALIDARG;
2194 *ppole = fHistoryObject;
2195 if (fHistoryObject != NULL)
2196 fHistoryObject->AddRef();
2197 *pstm = fHistoryStream;
2198 if (fHistoryStream != NULL)
2199 fHistoryStream->AddRef();
2200 *ppbc = fHistoryBindContext;
2201 if (fHistoryBindContext != NULL)
2202 fHistoryBindContext->AddRef();
2203 fHistoryObject = NULL;
2204 fHistoryStream = NULL;
2205 fHistoryBindContext = NULL;
2206 if (*ppole == NULL)
2207 return E_FAIL;
2208 return S_OK;
2209 }
2210
2211 HRESULT STDMETHODCALLTYPE CShellBrowser::SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor)
2212 {
2213 return E_NOTIMPL;
2214 }
2215
2216 HRESULT STDMETHODCALLTYPE CShellBrowser::CacheOLEServer(IOleObject *pole)
2217 {
2218 return E_NOTIMPL;
2219 }
2220
2221 HRESULT STDMETHODCALLTYPE CShellBrowser::GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut)
2222 {
2223 return E_NOTIMPL;
2224 }
2225
2226 HRESULT STDMETHODCALLTYPE CShellBrowser::OnHttpEquiv(
2227 IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2228 {
2229 return E_NOTIMPL;
2230 }
2231
2232 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPalette(HPALETTE *hpal)
2233 {
2234 return E_NOTIMPL;
2235 }
2236
2237 HRESULT STDMETHODCALLTYPE CShellBrowser::RegisterWindow(BOOL fForceRegister, int swc)
2238 {
2239 return E_NOTIMPL;
2240 }
2241
2242 LRESULT STDMETHODCALLTYPE CShellBrowser::WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2243 {
2244 return E_NOTIMPL;
2245 }
2246
2247 HRESULT STDMETHODCALLTYPE CShellBrowser::SetAsDefFolderSettings()
2248 {
2249 return E_NOTIMPL;
2250 }
2251
2252 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewRect(RECT *prc)
2253 {
2254 return E_NOTIMPL;
2255 }
2256
2257 HRESULT STDMETHODCALLTYPE CShellBrowser::OnSize(WPARAM wParam)
2258 {
2259 return E_NOTIMPL;
2260 }
2261
2262 HRESULT STDMETHODCALLTYPE CShellBrowser::OnCreate(struct tagCREATESTRUCTW *pcs)
2263 {
2264 m_hAccel = LoadAcceleratorsW(GetModuleHandle(L"browseui.dll"), MAKEINTRESOURCEW(256));
2265 return S_OK;
2266 }
2267
2268 LRESULT STDMETHODCALLTYPE CShellBrowser::OnCommand(WPARAM wParam, LPARAM lParam)
2269 {
2270 return 0;
2271 }
2272
2273 HRESULT STDMETHODCALLTYPE CShellBrowser::OnDestroy()
2274 {
2275 return E_NOTIMPL;
2276 }
2277
2278 LRESULT STDMETHODCALLTYPE CShellBrowser::OnNotify(struct tagNMHDR *pnm)
2279 {
2280 return 0;
2281 }
2282
2283 HRESULT STDMETHODCALLTYPE CShellBrowser::OnSetFocus()
2284 {
2285 return E_NOTIMPL;
2286 }
2287
2288 HRESULT STDMETHODCALLTYPE CShellBrowser::OnFrameWindowActivateBS(BOOL fActive)
2289 {
2290 return E_NOTIMPL;
2291 }
2292
2293 HRESULT STDMETHODCALLTYPE CShellBrowser::ReleaseShellView()
2294 {
2295 return E_NOTIMPL;
2296 }
2297
2298 HRESULT STDMETHODCALLTYPE CShellBrowser::ActivatePendingView()
2299 {
2300 return E_NOTIMPL;
2301 }
2302
2303 HRESULT STDMETHODCALLTYPE CShellBrowser::CreateViewWindow(
2304 IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2305 {
2306 return E_NOTIMPL;
2307 }
2308
2309 HRESULT STDMETHODCALLTYPE CShellBrowser::CreateBrowserPropSheetExt(REFIID riid, void **ppv)
2310 {
2311 return E_NOTIMPL;
2312 }
2313
2314 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewWindow(HWND *phwndView)
2315 {
2316 return E_NOTIMPL;
2317 }
2318
2319 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd)
2320 {
2321 return E_NOTIMPL;
2322 }
2323
2324 LPBASEBROWSERDATA STDMETHODCALLTYPE CShellBrowser::PutBaseBrowserData()
2325 {
2326 return NULL;
2327 }
2328
2329 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTravelLog(ITravelLog *ptl, DWORD dw)
2330 {
2331 return E_NOTIMPL;
2332 }
2333
2334 HRESULT STDMETHODCALLTYPE CShellBrowser::SetTopBrowser()
2335 {
2336 return E_NOTIMPL;
2337 }
2338
2339 HRESULT STDMETHODCALLTYPE CShellBrowser::Offline(int iCmd)
2340 {
2341 return E_NOTIMPL;
2342 }
2343
2344 HRESULT STDMETHODCALLTYPE CShellBrowser::AllowViewResize(BOOL f)
2345 {
2346 return E_NOTIMPL;
2347 }
2348
2349 HRESULT STDMETHODCALLTYPE CShellBrowser::SetActivateState(UINT u)
2350 {
2351 return E_NOTIMPL;
2352 }
2353
2354 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateSecureLockIcon(int eSecureLock)
2355 {
2356 return E_NOTIMPL;
2357 }
2358
2359 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeDownloadManager()
2360 {
2361 return E_NOTIMPL;
2362 }
2363
2364 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTransitionSite()
2365 {
2366 return E_NOTIMPL;
2367 }
2368
2369 HRESULT STDMETHODCALLTYPE CShellBrowser::_Initialize(HWND hwnd, IUnknown *pauto)
2370 {
2371 return E_NOTIMPL;
2372 }
2373
2374 HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingNavigationAsync()
2375 {
2376 return E_NOTIMPL;
2377 }
2378
2379 HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingView()
2380 {
2381 return E_NOTIMPL;
2382 }
2383
2384 HRESULT STDMETHODCALLTYPE CShellBrowser::_MaySaveChanges()
2385 {
2386 return E_NOTIMPL;
2387 }
2388
2389 HRESULT STDMETHODCALLTYPE CShellBrowser::_PauseOrResumeView(BOOL fPaused)
2390 {
2391 return E_NOTIMPL;
2392 }
2393
2394 HRESULT STDMETHODCALLTYPE CShellBrowser::_DisableModeless()
2395 {
2396 return E_NOTIMPL;
2397 }
2398
2399 HRESULT STDMETHODCALLTYPE CShellBrowser::_NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags)
2400 {
2401 return E_NOTIMPL;
2402 }
2403
2404 HRESULT STDMETHODCALLTYPE CShellBrowser::_TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew)
2405 {
2406 return E_NOTIMPL;
2407 }
2408
2409 HRESULT STDMETHODCALLTYPE CShellBrowser::_SwitchActivationNow()
2410 {
2411 return E_NOTIMPL;
2412 }
2413
2414 HRESULT STDMETHODCALLTYPE CShellBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
2415 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2416 {
2417 return E_NOTIMPL;
2418 }
2419
2420 HRESULT STDMETHODCALLTYPE CShellBrowser::_SendChildren(
2421 HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2422 {
2423 return E_NOTIMPL;
2424 }
2425
2426 HRESULT STDMETHODCALLTYPE CShellBrowser::GetFolderSetData(struct tagFolderSetData *pfsd)
2427 {
2428 return E_NOTIMPL;
2429 }
2430
2431 HRESULT STDMETHODCALLTYPE CShellBrowser::_OnFocusChange(UINT itb)
2432 {
2433 return E_NOTIMPL;
2434 }
2435
2436 HRESULT STDMETHODCALLTYPE CShellBrowser::v_ShowHideChildWindows(BOOL fChildOnly)
2437 {
2438 return E_NOTIMPL;
2439 }
2440
2441 UINT STDMETHODCALLTYPE CShellBrowser::_get_itbLastFocus()
2442 {
2443 return 0;
2444 }
2445
2446 HRESULT STDMETHODCALLTYPE CShellBrowser::_put_itbLastFocus(UINT itbLastFocus)
2447 {
2448 return E_NOTIMPL;
2449 }
2450
2451 HRESULT STDMETHODCALLTYPE CShellBrowser::_UIActivateView(UINT uState)
2452 {
2453 return E_NOTIMPL;
2454 }
2455
2456 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetViewBorderRect(RECT *prc)
2457 {
2458 return E_NOTIMPL;
2459 }
2460
2461 HRESULT STDMETHODCALLTYPE CShellBrowser::_UpdateViewRectSize()
2462 {
2463 return E_NOTIMPL;
2464 }
2465
2466 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorder(UINT itb)
2467 {
2468 return E_NOTIMPL;
2469 }
2470
2471 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeView()
2472 {
2473 return E_NOTIMPL;
2474 }
2475
2476 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon)
2477 {
2478 return E_NOTIMPL;
2479 }
2480
2481 IStream *STDMETHODCALLTYPE CShellBrowser::v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName)
2482 {
2483 return NULL;
2484 }
2485
2486 LRESULT STDMETHODCALLTYPE CShellBrowser::ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
2487 {
2488 return 0;
2489 }
2490
2491 HRESULT STDMETHODCALLTYPE CShellBrowser::SetAcceleratorMenu(HACCEL hacc)
2492 {
2493 return E_NOTIMPL;
2494 }
2495
2496 int STDMETHODCALLTYPE CShellBrowser::_GetToolbarCount()
2497 {
2498 return 0;
2499 }
2500
2501 LPTOOLBARITEM STDMETHODCALLTYPE CShellBrowser::_GetToolbarItem(int itb)
2502 {
2503 return NULL;
2504 }
2505
2506 HRESULT STDMETHODCALLTYPE CShellBrowser::_SaveToolbars(IStream *pstm)
2507 {
2508 return E_NOTIMPL;
2509 }
2510
2511 HRESULT STDMETHODCALLTYPE CShellBrowser::_LoadToolbars(IStream *pstm)
2512 {
2513 return E_NOTIMPL;
2514 }
2515
2516 HRESULT STDMETHODCALLTYPE CShellBrowser::_CloseAndReleaseToolbars(BOOL fClose)
2517 {
2518 return E_NOTIMPL;
2519 }
2520
2521 HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayGetNextToolbarFocus(
2522 LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
2523 {
2524 return E_NOTIMPL;
2525 }
2526
2527 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor)
2528 {
2529 return E_NOTIMPL;
2530 }
2531
2532 UINT STDMETHODCALLTYPE CShellBrowser::_FindTBar(IUnknown *punkSrc)
2533 {
2534 return 0;
2535 }
2536
2537 HRESULT STDMETHODCALLTYPE CShellBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
2538 {
2539 return E_NOTIMPL;
2540 }
2541
2542 HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg)
2543 {
2544 if (fCurrentShellView->TranslateAcceleratorW(pmsg) != S_OK)
2545 {
2546 if (TranslateAcceleratorSB(pmsg, 0) != S_OK)
2547 return S_FALSE;
2548 return S_OK;
2549 }
2550 return S_OK;
2551 }
2552
2553 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor)
2554 {
2555 return E_NOTIMPL;
2556 }
2557
2558 HRESULT STDMETHODCALLTYPE CShellBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
2559 {
2560 return E_NOTIMPL;
2561 }
2562
2563 HRESULT STDMETHODCALLTYPE CShellBrowser::GoBack()
2564 {
2565 CComPtr<ITravelLog> travelLog;
2566 HRESULT hResult;
2567
2568 hResult = GetTravelLog(&travelLog);
2569 if (FAILED(hResult))
2570 return hResult;
2571 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
2572 }
2573
2574 HRESULT STDMETHODCALLTYPE CShellBrowser::GoForward()
2575 {
2576 CComPtr<ITravelLog> travelLog;
2577 HRESULT hResult;
2578
2579 hResult = GetTravelLog(&travelLog);
2580 if (FAILED(hResult))
2581 return hResult;
2582 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
2583 }
2584
2585 HRESULT STDMETHODCALLTYPE CShellBrowser::GoHome()
2586 {
2587 return E_NOTIMPL;
2588 }
2589
2590 HRESULT STDMETHODCALLTYPE CShellBrowser::GoSearch()
2591 {
2592 return E_NOTIMPL;
2593 }
2594
2595 HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate(BSTR URL, VARIANT *Flags,
2596 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2597 {
2598 return E_NOTIMPL;
2599 }
2600
2601 HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh()
2602 {
2603 VARIANT level;
2604
2605 V_VT(&level) = VT_I4;
2606 V_I4(&level) = 4;
2607 return Refresh2(&level);
2608 }
2609
2610 HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh2(VARIANT *Level)
2611 {
2612 CComPtr<IOleCommandTarget> oleCommandTarget;
2613 HRESULT hResult;
2614
2615 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
2616 if (FAILED(hResult))
2617 return hResult;
2618 return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
2619 }
2620
2621 HRESULT STDMETHODCALLTYPE CShellBrowser::Stop()
2622 {
2623 return E_NOTIMPL;
2624 }
2625
2626 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Application(IDispatch **ppDisp)
2627 {
2628 return E_NOTIMPL;
2629 }
2630
2631 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Parent(IDispatch **ppDisp)
2632 {
2633 return E_NOTIMPL;
2634 }
2635
2636 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Container(IDispatch **ppDisp)
2637 {
2638 return E_NOTIMPL;
2639 }
2640
2641 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Document(IDispatch **ppDisp)
2642 {
2643 return E_NOTIMPL;
2644 }
2645
2646 HRESULT STDMETHODCALLTYPE CShellBrowser::get_TopLevelContainer(VARIANT_BOOL *pBool)
2647 {
2648 return E_NOTIMPL;
2649 }
2650
2651 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Type(BSTR *Type)
2652 {
2653 return E_NOTIMPL;
2654 }
2655 #ifdef __exdisp_h__
2656 #define long LONG
2657 #endif
2658 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(long *pl)
2659 {
2660 return E_NOTIMPL;
2661 }
2662
2663 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(long Left)
2664 {
2665 return E_NOTIMPL;
2666 }
2667
2668 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(long *pl)
2669 {
2670 return E_NOTIMPL;
2671 }
2672
2673 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(long Top)
2674 {
2675 return E_NOTIMPL;
2676 }
2677
2678 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(long *pl)
2679 {
2680 return E_NOTIMPL;
2681 }
2682
2683 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(long Width)
2684 {
2685 return E_NOTIMPL;
2686 }
2687
2688 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(long *pl)
2689 {
2690 return E_NOTIMPL;
2691 }
2692
2693 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(long Height)
2694 {
2695 return E_NOTIMPL;
2696 }
2697 #ifdef __exdisp_h__
2698 #undef long
2699 #endif
2700 HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName)
2701 {
2702 return E_NOTIMPL;
2703 }
2704
2705 HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationURL(BSTR *LocationURL)
2706 {
2707 return E_NOTIMPL;
2708 }
2709
2710 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Busy(VARIANT_BOOL *pBool)
2711 {
2712 return E_NOTIMPL;
2713 }
2714
2715 HRESULT STDMETHODCALLTYPE CShellBrowser::Quit()
2716 {
2717 return E_NOTIMPL;
2718 }
2719
2720 HRESULT STDMETHODCALLTYPE CShellBrowser::ClientToWindow(int *pcx, int *pcy)
2721 {
2722 return E_NOTIMPL;
2723 }
2724
2725 HRESULT STDMETHODCALLTYPE CShellBrowser::PutProperty(BSTR Property, VARIANT vtValue)
2726 {
2727 return E_NOTIMPL;
2728 }
2729
2730 HRESULT STDMETHODCALLTYPE CShellBrowser::GetProperty(BSTR Property, VARIANT *pvtValue)
2731 {
2732 return E_NOTIMPL;
2733 }
2734
2735 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Name(BSTR *Name)
2736 {
2737 return E_NOTIMPL;
2738 }
2739
2740 HRESULT STDMETHODCALLTYPE CShellBrowser::get_HWND(SHANDLE_PTR *pHWND)
2741 {
2742 return E_NOTIMPL;
2743 }
2744
2745 HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullName(BSTR *FullName)
2746 {
2747 return E_NOTIMPL;
2748 }
2749
2750 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Path(BSTR *Path)
2751 {
2752 return E_NOTIMPL;
2753 }
2754
2755 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Visible(VARIANT_BOOL *pBool)
2756 {
2757 return E_NOTIMPL;
2758 }
2759
2760 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Visible(VARIANT_BOOL Value)
2761 {
2762 return E_NOTIMPL;
2763 }
2764
2765 HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusBar(VARIANT_BOOL *pBool)
2766 {
2767 return E_NOTIMPL;
2768 }
2769
2770 HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusBar(VARIANT_BOOL Value)
2771 {
2772 return E_NOTIMPL;
2773 }
2774
2775 HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusText(BSTR *StatusText)
2776 {
2777 return E_NOTIMPL;
2778 }
2779
2780 HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusText(BSTR StatusText)
2781 {
2782 return E_NOTIMPL;
2783 }
2784
2785 HRESULT STDMETHODCALLTYPE CShellBrowser::get_ToolBar(int *Value)
2786 {
2787 return E_NOTIMPL;
2788 }
2789
2790 HRESULT STDMETHODCALLTYPE CShellBrowser::put_ToolBar(int Value)
2791 {
2792 return E_NOTIMPL;
2793 }
2794
2795 HRESULT STDMETHODCALLTYPE CShellBrowser::get_MenuBar(VARIANT_BOOL *Value)
2796 {
2797 return E_NOTIMPL;
2798 }
2799
2800 HRESULT STDMETHODCALLTYPE CShellBrowser::put_MenuBar(VARIANT_BOOL Value)
2801 {
2802 return E_NOTIMPL;
2803 }
2804
2805 HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullScreen(VARIANT_BOOL *pbFullScreen)
2806 {
2807 return E_NOTIMPL;
2808 }
2809
2810 HRESULT STDMETHODCALLTYPE CShellBrowser::put_FullScreen(VARIANT_BOOL bFullScreen)
2811 {
2812 return E_NOTIMPL;
2813 }
2814
2815 HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate2(VARIANT *URL, VARIANT *Flags,
2816 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2817 {
2818 LPITEMIDLIST pidl;
2819 HRESULT hResult;
2820
2821 // called from drive combo box to navigate to a directory
2822 if (V_VT(URL) != (VT_ARRAY | VT_UI1))
2823 return E_INVALIDARG;
2824 if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
2825 return E_INVALIDARG;
2826 pidl = (LPITEMIDLIST)V_ARRAY(URL)->pvData;
2827 hResult = BrowseToPIDL((LPITEMIDLIST)pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
2828 if (FAILED(hResult))
2829 return hResult;
2830 return S_OK;
2831 }
2832
2833 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf)
2834 {
2835 return E_NOTIMPL;
2836 }
2837
2838 HRESULT STDMETHODCALLTYPE CShellBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
2839 VARIANT *pvaIn, VARIANT *pvaOut)
2840 {
2841 return E_NOTIMPL;
2842 }
2843
2844 HRESULT STDMETHODCALLTYPE CShellBrowser::ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize)
2845 {
2846 CLSID classID;
2847 bool vertical;
2848
2849 // called to show search bar
2850 if (V_VT(pvaClsid) != VT_BSTR)
2851 return E_INVALIDARG;
2852 CLSIDFromString(V_BSTR(pvaClsid), &classID);
2853 // TODO: properly compute the value of vertical
2854 vertical = true;
2855 return ShowBand(classID, vertical);
2856 }
2857
2858 HRESULT STDMETHODCALLTYPE CShellBrowser::get_ReadyState(READYSTATE *plReadyState)
2859 {
2860 return E_NOTIMPL;
2861 }
2862
2863 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Offline(VARIANT_BOOL *pbOffline)
2864 {
2865 return E_NOTIMPL;
2866 }
2867
2868 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Offline(VARIANT_BOOL bOffline)
2869 {
2870 return E_NOTIMPL;
2871 }
2872
2873 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Silent(VARIANT_BOOL *pbSilent)
2874 {
2875 return E_NOTIMPL;
2876 }
2877
2878 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Silent(VARIANT_BOOL bSilent)
2879 {
2880 return E_NOTIMPL;
2881 }
2882
2883 HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsBrowser(VARIANT_BOOL *pbRegister)
2884 {
2885 return E_NOTIMPL;
2886 }
2887
2888 HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsBrowser(VARIANT_BOOL bRegister)
2889 {
2890 return E_NOTIMPL;
2891 }
2892
2893 HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsDropTarget(VARIANT_BOOL *pbRegister)
2894 {
2895 return E_NOTIMPL;
2896 }
2897
2898 HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister)
2899 {
2900 return E_NOTIMPL;
2901 }
2902
2903 HRESULT STDMETHODCALLTYPE CShellBrowser::get_TheaterMode(VARIANT_BOOL *pbRegister)
2904 {
2905 return E_NOTIMPL;
2906 }
2907
2908 HRESULT STDMETHODCALLTYPE CShellBrowser::put_TheaterMode(VARIANT_BOOL bRegister)
2909 {
2910 return E_NOTIMPL;
2911 }
2912
2913 HRESULT STDMETHODCALLTYPE CShellBrowser::get_AddressBar(VARIANT_BOOL *Value)
2914 {
2915 return E_NOTIMPL;
2916 }
2917
2918 HRESULT STDMETHODCALLTYPE CShellBrowser::put_AddressBar(VARIANT_BOOL Value)
2919 {
2920 return E_NOTIMPL;
2921 }
2922
2923 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Resizable(VARIANT_BOOL *Value)
2924 {
2925 return E_NOTIMPL;
2926 }
2927
2928 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Resizable(VARIANT_BOOL Value)
2929 {
2930 return E_NOTIMPL;
2931 }
2932
2933 HRESULT STDMETHODCALLTYPE CShellBrowser::FindWindowByIndex(DWORD dwID, IUnknown **ppunk)
2934 {
2935 return E_NOTIMPL;
2936 }
2937
2938 HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindowData(IStream *pStream, LPWINDOWDATA pWinData)
2939 {
2940 if (pWinData == NULL)
2941 return E_POINTER;
2942
2943 pWinData->dwWindowID = -1;
2944 pWinData->uiCP = 0;
2945 pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
2946 pWinData->lpszUrl = NULL;
2947 pWinData->lpszUrlLocation = NULL;
2948 pWinData->lpszTitle = NULL;
2949 return S_OK;
2950 }
2951
2952 HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition)
2953 {
2954 return E_NOTIMPL;
2955 }
2956
2957 HRESULT STDMETHODCALLTYPE CShellBrowser::GetClassID(CLSID *pClassID)
2958 {
2959 return E_NOTIMPL;
2960 }
2961
2962 HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistory(IStream *pStream, IBindCtx *pbc)
2963 {
2964 CComPtr<IPersistHistory> viewPersistHistory;
2965 CComPtr<IOleObject> viewHistoryObject;
2966 persistState oldState;
2967 ULONG numRead;
2968 LPITEMIDLIST pidl;
2969 HRESULT hResult;
2970
2971 hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
2972 if (FAILED(hResult))
2973 return hResult;
2974 if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
2975 return E_FAIL;
2976 if (oldState.browseType != 2)
2977 return E_FAIL;
2978 pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
2979 if (pidl == NULL)
2980 return E_OUTOFMEMORY;
2981 hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
2982 if (FAILED(hResult))
2983 {
2984 ILFree(pidl);
2985 return hResult;
2986 }
2987 if (numRead != oldState.pidlSize)
2988 {
2989 ILFree(pidl);
2990 return E_FAIL;
2991 }
2992 hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
2993 IID_PPV_ARG(IOleObject, &viewHistoryObject));
2994 fHistoryObject = viewHistoryObject;
2995 fHistoryStream = pStream;
2996 fHistoryBindContext = pbc;
2997 hResult = BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY);
2998 fHistoryObject = NULL;
2999 fHistoryStream = NULL;
3000 fHistoryBindContext = NULL;
3001 ILFree(pidl);
3002 if (FAILED(hResult))
3003 return hResult;
3004 return S_OK;
3005 }
3006
3007 HRESULT STDMETHODCALLTYPE CShellBrowser::SaveHistory(IStream *pStream)
3008 {
3009 CComPtr<IPersistHistory> viewPersistHistory;
3010 persistState newState;
3011 HRESULT hResult;
3012
3013 hResult = fCurrentShellView->GetItemObject(
3014 SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3015 memset(&newState, 0, sizeof(newState));
3016 newState.dwSize = sizeof(newState);
3017 newState.browseType = 2;
3018 newState.browserIndex = GetBrowserIndex();
3019 if (viewPersistHistory.p != NULL)
3020 {
3021 hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3022 if (FAILED(hResult))
3023 return hResult;
3024 }
3025 newState.pidlSize = ILGetSize(fCurrentDirectoryPIDL);
3026 hResult = pStream->Write(&newState, sizeof(newState), NULL);
3027 if (FAILED(hResult))
3028 return hResult;
3029 hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3030 if (FAILED(hResult))
3031 return hResult;
3032 if (viewPersistHistory.p != NULL)
3033 {
3034 hResult = viewPersistHistory->SaveHistory(pStream);
3035 if (FAILED(hResult))
3036 return hResult;
3037 }
3038 return S_OK;
3039 }
3040
3041 HRESULT STDMETHODCALLTYPE CShellBrowser::SetPositionCookie(DWORD dwPositioncookie)
3042 {
3043 return E_NOTIMPL;
3044 }
3045
3046 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPositionCookie(DWORD *pdwPositioncookie)
3047 {
3048 return E_NOTIMPL;
3049 }
3050
3051 LRESULT CShellBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3052 {
3053 OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3054 return 0;
3055 }
3056
3057 LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3058 {
3059 // TODO: rip down everything
3060 PostQuitMessage(0);
3061 return 0;
3062 }
3063
3064 LRESULT CShellBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3065 {
3066 CComPtr<IDockingWindow> dockingWindow;
3067 RECT availableBounds;
3068 static const INT excludeItems[] = {1, 1, 1, 0xa001, 0, 0};
3069 HRESULT hResult;
3070
3071 if (wParam != SIZE_MINIMIZED)
3072 {
3073 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3074 for (INT x = 0; x < 3; x++)
3075 {
3076 if (fClientBars[x].clientBar != NULL)
3077 {
3078 hResult = fClientBars[x].clientBar->QueryInterface(
3079 IID_PPV_ARG(IDockingWindow, &dockingWindow));
3080 if (SUCCEEDED(hResult) && dockingWindow != NULL)
3081 {
3082 hResult = dockingWindow->ResizeBorderDW(
3083 &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3084 break;
3085 }
3086 }
3087 }
3088 RepositionBars();
3089 }
3090 return 1;
3091 }
3092
3093 LRESULT CShellBrowser::OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3094 {
3095 HMENU theMenu;
3096
3097 theMenu = reinterpret_cast<HMENU>(wParam);
3098 if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3099 UpdateViewMenu(theMenu);
3100 return RelayMsgToShellView(uMsg, wParam, lParam, bHandled);
3101 }
3102