ReactOS 0.4.15-dev-8390-g075894b
shellbrowser.cpp
Go to the documentation of this file.
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#include <strsafe.h>
26
27extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
28
29#include "newatlinterfaces.h"
30
31/*
32TODO:
33 **Provide implementation of new and delete that use LocalAlloc
34 **Persist history for shell view isn't working correctly, possibly because of the mismatch between traveling and updating the travel log. The
35 view doesn't restore the selection correctly.
36 **Build explorer.exe, browseui.dll, comctl32.dll, shdocvw.dll, shell32.dll, shlwapi.dll into a directory and run them for testing...
37 **Add brand band bitmaps to shell32.dll
38 **If Go button on address bar is clicked, each time a new duplicate entry is added to travel log
39****The current entry is updated in travel log before doing the travel, which means when traveling back the update of the
40 current state overwrites the wrong entry's contents. This needs to be changed.
41****Fix close of browser window to release all objects
42****Given only a GUID in ShowBrowserBar, what is the correct way to determine if the bar is vertical or horizontal?
43 **When a new bar is added to base bar site, how is base bar told so it can resize?
44 **Does the base bar site have a classid?
45 **What should refresh command send to views to make them refresh?
46 **When new bar is created, what status notifications need to be fired?
47 **How does keyboard filtering dispatch?
48 **For deferred persist history load, how does the view connect up and get the state?
49 How does context menu send open, cut, rename commands to its site (the shell view)?
50 **Fix browser to implement IProfferService and hold onto brand band correctly - this will allow animations.
51
52 **Route View->Toolbars commands to internet toolbar
53 **Handle travel log items in View->Go
54 **Fix ShowBrowserBar to pass correct size on when bar is shown
55****Fix SetBorderSpaceDW to cascade resize to subsequent bars
56****Make ShowToolbar check if bar is already created before creating it again
57****Shell should fill in the list of explorer bars in the View submenus
58 **Add folder menu in the file menu
59 **Fix CShellBrowser::GetBorderDW to compute available size correctly
60 **When a new bar is shown, re-fire the navigate event. This makes the explorer band select the correct folder
61 **Implement support for refresh. Forward refresh to explorer bar (refresh on toolbar and in menu is dispatched different)
62 Make folders toolbar item update state appropriately
63 Read list of bands from registry on launch
64 Read list of bars from registry on launch
65 If the folders or search bars don't exist, disable the toolbar buttons
66 If the favorites or history bars don't exist, disable the toolbar butons
67 Fix Apply to all Folders in Folder Options
68 Implement close command
69 Add explorer band context menu to file menu
70 Add code to allow restore of internet toolbar from registry
71 Fix code that calls FireNavigateComplete to pass the correct new path
72
73 What are the other command ids for QueryStatus/FireCommandStateChange?
74
75 Add handler for cabinet settings change
76 Add handler for system metrics change (renegotiate border space?)
77 Add handler for theme change and forward to contained windows
78
79 When folders are shown, the status bar text should change
80 Add code to save/restore shell view settings
81 Implement tabbing between frames
82 Fix handling of focus everywhere
83 Most keyboard shortcuts don't work, such as F2 for rename, F5 for refresh (see list in "explorer keyboard shortcuts")
84
85 The status bar doesn't show help text for items owned by frame during menu tracking
86 Stub out frame command handlers
87 "Arrange icons by" group is not checked properly
88
89 When folders are hidden, icon is the same as the current shell object being displayed. When folders are shown,
90 the icon is always an open folder with magnifying glass
91 Fix bars to calculate height correctly
92 Hookup policies for everything...
93 Investigate toolbar message WM_USER+93
94 Investigate toolbar message WM_USER+100 (Adds extra padding between parts of buttons with BTNS_DROPDOWN | BTNS_SHOWTEXT style
95
96 Vertical Explorer Bar CATID_InfoBand
97 Horizontal Explorer Bar CATID_CommBand
98 Desk Band CATID_DeskBand
99
100 cache of bars
101 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}\Enum
102 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}\Enum
103
104 create key here with CLSID of bar to register tool band
105 HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Toolbar
106
107*/
108
109#ifndef __GNUC__
110#pragma comment(linker, \
111 "\"/manifestdependency:type='Win32' "\
112 "name='Microsoft.Windows.Common-Controls' "\
113 "version='6.0.0.0' "\
114 "processorArchitecture='*' "\
115 "publicKeyToken='6595b64144ccf1df' "\
116 "language='*'\"")
117#endif // __GNUC__
118
119static const unsigned int folderOptionsPageCountMax = 20;
120static const long BTP_DONT_UPDATE_HISTORY = 0;
121static const long BTP_UPDATE_CUR_HISTORY = 1;
122static const long BTP_UPDATE_NEXT_HISTORY = 2;
123static const long BTP_ACTIVATE_NOFOCUS = 0x04;
124
126
127
128// this class is private to browseui.dll and is not registered externally?
129//DEFINE_GUID(CLSID_ShellFldSetExt, 0x6D5313C0, 0x8C62, 0x11D1, 0xB2, 0xCD, 0x00, 0x60, 0x97, 0xDF, 0x8C, 0x11);
130
131void DeleteMenuItems(HMENU theMenu, unsigned int firstIDToDelete, unsigned int lastIDToDelete)
132{
133 MENUITEMINFO menuItemInfo;
134 int menuItemCount;
135 int curIndex;
136
137 menuItemCount = GetMenuItemCount(theMenu);
138 curIndex = 0;
139 while (curIndex < menuItemCount)
140 {
141 menuItemInfo.cbSize = sizeof(menuItemInfo);
142 menuItemInfo.fMask = MIIM_ID;
143 if (GetMenuItemInfo(theMenu, curIndex, TRUE, &menuItemInfo) &&
144 menuItemInfo.wID >= firstIDToDelete && menuItemInfo.wID <= lastIDToDelete)
145 {
146 DeleteMenu(theMenu, curIndex, MF_BYPOSITION);
147 menuItemCount--;
148 }
149 else
150 curIndex++;
151 }
152}
153
155{
156 CComPtr<IShellFolder> desktop;
157
158 HRESULT hr = ::SHGetDesktopFolder(&desktop);
160 return E_FAIL;
161 if (path == NULL || path->mkid.cb == 0)
162 {
163 *newFolder = desktop;
164 desktop.p->AddRef ();
165 return S_OK;
166 }
167 return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
168}
169
170static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClass");
171//static const TCHAR szExploreWndClass[] = TEXT("ExploreWClass");
172
173class CDockManager;
174class CShellBrowser;
175
177 public CWindowImpl<CToolbarProxy, CWindow, CControlWinTraits>
178{
179private:
181public:
182 void Initialize(HWND parent, IUnknown *explorerToolbar);
183 void Destroy();
184private:
185
186 // message handlers
189
194};
195
197{
198 HWND myWindow;
199 HRESULT hResult;
200
201 myWindow = SHCreateWorkerWindowW(0, parent, 0, WS_CHILD, NULL, 0);
202 if (myWindow != NULL)
203 {
204 SubclassWindow(myWindow);
205 SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
206 hResult = explorerToolbar->QueryInterface(
207 IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
208 }
209}
210
212{
215}
216
218{
219 long int result;
220 HRESULT hResult;
221
222 result = 0;
223 if (fExplorerToolbar.p != NULL)
224 {
225 hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 1, (long)wParam,
226 reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
227 hResult = fExplorerToolbar->AddBitmap(&CGID_ShellBrowser, 2, (long)wParam,
228 reinterpret_cast<TBADDBITMAP *>(lParam), &result, RGB(192, 192, 192));
229 }
230 return result;
231}
232
234{
236 HRESULT hResult;
237
238 result = 0;
239 if (fExplorerToolbar.p != NULL)
240 hResult = fExplorerToolbar->SendToolbarMsg(&CGID_ShellBrowser, uMsg, wParam, lParam, &result);
241 return result;
242}
243
244/*
245Switch to a new bar when it receives an Exec(CGID_IDeskBand, 1, 1, vaIn, NULL);
246 where vaIn will be a VT_UNKNOWN with the new bar. It also sends a RB_SHOWBAND to the
247 rebar
248*/
249
253};
254
256 public CWindowImpl<CShellBrowser, CWindow, CFrameWinTraits>,
257 public CComObjectRootEx<CComMultiThreadModelNoCS>,
258 public IShellBrowser,
259 public IDropTarget,
260 public IServiceProvider,
261 public IProfferServiceImpl<CShellBrowser>,
262 public IShellBrowserService,
263 public IWebBrowser2,
264 public ITravelLogClient,
265 public IPersistHistory,
266 public IDockingWindowSite,
267 public IOleCommandTarget,
268 public IBrowserService2,
269 public IConnectionPointContainerImpl<CShellBrowser>,
270 public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>,
271 public MyIConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>
272{
273private:
275 {
276 public:
278 {
279 memset(&borderSpace, 0, sizeof(borderSpace));
280 hwnd = NULL;
281 }
282
286 };
287 static const int BIInternetToolbar = 0;
288 static const int BIVerticalBaseBar = 1;
289 static const int BIHorizontalBaseBar = 2;
290
291 HWND fCurrentShellViewWindow; // our currently hosted shell view window
300 GUID fCurrentVertBar; //The guid of the built in vertical bar that is being shown
301 // The next three fields support persisted history for shell views.
302 // They do not need to be reference counted.
307 HACCEL m_hAccel;
311public:
312#if 0
314 {
315 OutputDebugString(_T("AddRef\n"));
317 }
319 {
320 OutputDebugString(_T("Release\n"));
322 }
323#endif
324
328public:
333 HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL,
334 FOLDERSETTINGS *folderSettings, long flags);
335 HRESULT GetMenuBand(REFIID riid, void **shellMenu);
336 HRESULT GetBaseBar(bool vertical, REFIID riid, void **theBaseBar);
337 BOOL IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID);
338 HRESULT ShowBand(const CLSID &classID, bool vertical);
343 void RepositionBars();
345 HRESULT BuildExplorerBandCategory(HMENU hBandsMenu, CATID category, DWORD dwPos, UINT *nbFound);
346 BOOL IsBuiltinBand(CLSID &bandID);
348 {
349 return WindowProc;
350 }
351 HRESULT FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments);
352 HRESULT FireNavigateComplete(const wchar_t *newDirectory);
353 HRESULT FireCommandStateChange(bool newState, int commandID);
357 void UpdateGotoMenu(HMENU theMenu);
358 void UpdateViewMenu(HMENU theMenu);
360 void RefreshCabinetState();
361 void UpdateWindowTitle();
362 void SaveITBarLayout();
363
364/* // *** IDockingWindowFrame methods ***
365 STDMETHOD(AddToolbar)(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags) override;
366 STDMETHOD(RemoveToolbar)(IUnknown *punkSrc, DWORD dwRemoveFlags) override;
367 STDMETHOD(FindToolbar)(LPCWSTR pwszItem, REFIID riid, void **ppv) override;
368 */
369
370 // *** IDockingWindowSite methods ***
371 STDMETHOD(GetBorderDW)(IUnknown* punkObj, LPRECT prcBorder) override;
372 STDMETHOD(RequestBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
373 STDMETHOD(SetBorderSpaceDW)(IUnknown* punkObj, LPCBORDERWIDTHS pbw) override;
374
375 // *** IOleCommandTarget methods ***
376 STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds,
377 OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) override;
378 STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID,
379 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
380
381 // *** IOleWindow methods ***
382 STDMETHOD(GetWindow)(HWND *lphwnd) override;
383 STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) override;
384
385 // *** IShellBrowser methods ***
386 STDMETHOD(InsertMenusSB)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) override;
387 STDMETHOD(SetMenuSB)(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) override;
388 STDMETHOD(RemoveMenusSB)(HMENU hmenuShared) override;
389 STDMETHOD(SetStatusTextSB)(LPCOLESTR pszStatusText) override;
390 STDMETHOD(EnableModelessSB)(BOOL fEnable) override;
391 STDMETHOD(TranslateAcceleratorSB)(MSG *pmsg, WORD wID) override;
393 STDMETHOD(GetViewStateStream)(DWORD grfMode, IStream **ppStrm) override;
394 STDMETHOD(GetControlWindow)(UINT id, HWND *lphwnd) override;
396 STDMETHOD(QueryActiveShellView)(IShellView **ppshv) override;
397 STDMETHOD(OnViewWindowActive)(IShellView *ppshv) override;
398 STDMETHOD(SetToolbarItems)(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) override;
399
400 // *** IDropTarget methods ***
401 STDMETHOD(DragEnter)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
402 STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
403 STDMETHOD(DragLeave)() override;
404 STDMETHOD(Drop)(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override;
405
406 // *** IServiceProvider methods ***
407 STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppvObject) override;
408
409 // *** IShellBowserService methods ***
410 STDMETHOD(GetPropertyBag)(long flags, REFIID riid, void **ppvObject) override;
411
412 // *** IDispatch methods ***
413 STDMETHOD(GetTypeInfoCount)(UINT *pctinfo) override;
414 STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override;
416 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override;
417 STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
418 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
419
420 // *** IBrowserService methods ***
421 STDMETHOD(GetParentSite)(IOleInPlaceSite **ppipsite) override;
422 STDMETHOD(SetTitle)(IShellView *psv, LPCWSTR pszName) override;
423 STDMETHOD(GetTitle)(IShellView *psv, LPWSTR pszName, DWORD cchName) override;
424 STDMETHOD(GetOleObject)(IOleObject **ppobjv) override;
426 STDMETHOD(ShowControlWindow)(UINT id, BOOL fShow) override;
427 STDMETHOD(IsControlWindowShown)(UINT id, BOOL *pfShown) override;
428 STDMETHOD(IEGetDisplayName)(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags) override;
429 STDMETHOD(IEParseDisplayName)(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut) override;
430 STDMETHOD(DisplayParseError)(HRESULT hres, LPCWSTR pwszPath) override;
431 STDMETHOD(NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF) override;
432 STDMETHOD(SetNavigateState)(BNSTATE bnstate) override;
433 STDMETHOD(GetNavigateState)(BNSTATE *pbnstate) override;
434 STDMETHOD(NotifyRedirect)(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse) override;
435 STDMETHOD(UpdateWindowList)() override;
437 STDMETHOD(SetFlags)(DWORD dwFlags, DWORD dwFlagMask) override;
438 STDMETHOD(GetFlags)(DWORD *pdwFlags) override;
439 STDMETHOD(CanNavigateNow)( void) override;
440 STDMETHOD(GetPidl)(LPITEMIDLIST *ppidl) override;
441 STDMETHOD(SetReferrer)(LPCITEMIDLIST pidl) override;
443 STDMETHOD(GetBrowserByIndex)(DWORD dwID, IUnknown **ppunk) override;
444 STDMETHOD(GetHistoryObject)(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc) override;
445 STDMETHOD(SetHistoryObject)(IOleObject *pole, BOOL fIsLocalAnchor) override;
446 STDMETHOD(CacheOLEServer)(IOleObject *pole) override;
447 STDMETHOD(GetSetCodePage)(VARIANT *pvarIn, VARIANT *pvarOut) override;
448 STDMETHOD(OnHttpEquiv)(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut) override;
449 STDMETHOD(GetPalette)(HPALETTE *hpal) override;
450 STDMETHOD(RegisterWindow)(BOOL fForceRegister, int swc) override;
451
452 // *** IBrowserService2 methods ***
455 STDMETHOD(GetViewRect)(RECT *prc) override;
456 STDMETHOD(OnSize)(WPARAM wParam) override;
457 STDMETHOD(OnCreate)(struct tagCREATESTRUCTW *pcs) override;
459 STDMETHOD(OnDestroy)() override;
460 STDMETHOD_(LRESULT, OnNotify)(struct tagNMHDR *pnm) override;
461 STDMETHOD(OnSetFocus)() override;
462 STDMETHOD(OnFrameWindowActivateBS)(BOOL fActive) override;
463 STDMETHOD(ReleaseShellView)() override;
464 STDMETHOD(ActivatePendingView)() override;
465 STDMETHOD(CreateViewWindow)(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd) override;
467 STDMETHOD(GetViewWindow)(HWND *phwndView) override;
471 STDMETHOD(SetTopBrowser)() override;
472 STDMETHOD(Offline)(int iCmd) override;
473 STDMETHOD(AllowViewResize)(BOOL f) override;
474 STDMETHOD(SetActivateState)(UINT u) override;
475 STDMETHOD(UpdateSecureLockIcon)(int eSecureLock) override;
478 STDMETHOD(_Initialize)(HWND hwnd, IUnknown *pauto) override;
480 STDMETHOD(_CancelPendingView)() override;
481 STDMETHOD(_MaySaveChanges)() override;
482 STDMETHOD(_PauseOrResumeView)(BOOL fPaused) override;
483 STDMETHOD(_DisableModeless)() override;
484 STDMETHOD(_NavigateToPidl)(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags) override;
485 STDMETHOD(_TryShell2Rename)(IShellView *psv, LPCITEMIDLIST pidlNew) override;
487 STDMETHOD(_ExecChildren)(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup,
488 DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut) override;
490 HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
491 STDMETHOD(GetFolderSetData)(struct tagFolderSetData *pfsd) override;
492 STDMETHOD(_OnFocusChange)(UINT itb) override;
493 STDMETHOD(v_ShowHideChildWindows)(BOOL fChildOnly) override;
495 STDMETHOD(_put_itbLastFocus)(UINT itbLastFocus) override;
496 STDMETHOD(_UIActivateView)(UINT uState) override;
498 STDMETHOD(_UpdateViewRectSize)() override;
499 STDMETHOD(_ResizeNextBorder)(UINT itb) override;
500 STDMETHOD(_ResizeView)() override;
501 STDMETHOD(_GetEffectiveClientArea)(LPRECT lprectBorder, HMONITOR hmon) override;
504 STDMETHOD(SetAcceleratorMenu)(HACCEL hacc) override;
505 STDMETHOD_(int, _GetToolbarCount)() override;
507 STDMETHOD(_SaveToolbars)(IStream *pstm) override;
508 STDMETHOD(_LoadToolbars)(IStream *pstm) override;
509 STDMETHOD(_CloseAndReleaseToolbars)(BOOL fClose) override;
511 int citb, LPTOOLBARITEM *pptbi, HWND *phwnd) override;
512 STDMETHOD(_ResizeNextBorderHelper)(UINT itb, BOOL bUseHmonitor) override;
513 STDMETHOD_(UINT, _FindTBar)(IUnknown *punkSrc) override;
514 STDMETHOD(_SetFocus)(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg) override;
515 STDMETHOD(v_MayTranslateAccelerator)(MSG *pmsg) override;
516 STDMETHOD(_GetBorderDWHelper)(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor) override;
518
519 // *** IWebBrowser methods ***
520 STDMETHOD(GoBack)() override;
521 STDMETHOD(GoForward)() override;
522 STDMETHOD(GoHome)() override;
523 STDMETHOD(GoSearch)() override;
524 STDMETHOD(Navigate)(BSTR URL, VARIANT *Flags, VARIANT *TargetFrameName,
525 VARIANT *PostData, VARIANT *Headers) override;
526 STDMETHOD(Refresh)() override;
527 STDMETHOD(Refresh2)(VARIANT *Level) override;
528 STDMETHOD(Stop)() override;
529 STDMETHOD(get_Application)(IDispatch **ppDisp) override;
530 STDMETHOD(get_Parent)(IDispatch **ppDisp) override;
531 STDMETHOD(get_Container)(IDispatch **ppDisp) override;
532 STDMETHOD(get_Document)(IDispatch **ppDisp) override;
534 STDMETHOD(get_Type)(BSTR *Type) override;
535 STDMETHOD(get_Left)(long *pl) override;
536 STDMETHOD(put_Left)(long Left) override;
537 STDMETHOD(get_Top)(long *pl) override;
538 STDMETHOD(put_Top)(long Top) override;
539 STDMETHOD(get_Width)(long *pl) override;
540 STDMETHOD(put_Width)(long Width) override;
541 STDMETHOD(get_Height)(long *pl) override;
542 STDMETHOD(put_Height)(long Height) override;
543 STDMETHOD(get_LocationName)(BSTR *LocationName) override;
544 STDMETHOD(get_LocationURL)(BSTR *LocationURL) override;
545 STDMETHOD(get_Busy)(VARIANT_BOOL *pBool) override;
546
547 // *** IWebBrowserApp methods ***
548 STDMETHOD(Quit)() override;
549 STDMETHOD(ClientToWindow)(int *pcx, int *pcy) override;
550 STDMETHOD(PutProperty)(BSTR Property, VARIANT vtValue) override;
551 STDMETHOD(GetProperty)(BSTR Property, VARIANT *pvtValue) override;
552 STDMETHOD(get_Name)(BSTR *Name) override;
553 STDMETHOD(get_HWND)(SHANDLE_PTR *pHWND) override;
555 STDMETHOD(get_Path)(BSTR *Path) override;
556 STDMETHOD(get_Visible)(VARIANT_BOOL *pBool) override;
558 STDMETHOD(get_StatusBar)(VARIANT_BOOL *pBool) override;
560 STDMETHOD(get_StatusText)(BSTR *StatusText) override;
561 STDMETHOD(put_StatusText)(BSTR StatusText) override;
562 STDMETHOD(get_ToolBar)(int *Value) override;
563 STDMETHOD(put_ToolBar)(int Value) override;
566 STDMETHOD(get_FullScreen)(VARIANT_BOOL *pbFullScreen) override;
567 STDMETHOD(put_FullScreen)(VARIANT_BOOL bFullScreen) override;
568
569 // *** IWebBrowser2 methods ***
570 STDMETHOD(Navigate2)(VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName,
571 VARIANT *PostData, VARIANT *Headers) override;
572 STDMETHOD(QueryStatusWB)(OLECMDID cmdID, OLECMDF *pcmdf) override;
573 STDMETHOD(ExecWB)(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
574 VARIANT *pvaIn, VARIANT *pvaOut) override;
575 STDMETHOD(ShowBrowserBar)(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize) override;
576 STDMETHOD(get_ReadyState)(READYSTATE *plReadyState) override;
577 STDMETHOD(get_Offline)(VARIANT_BOOL *pbOffline) override;
578 STDMETHOD(put_Offline)(VARIANT_BOOL bOffline) override;
579 STDMETHOD(get_Silent)(VARIANT_BOOL *pbSilent) override;
580 STDMETHOD(put_Silent)(VARIANT_BOOL bSilent) override;
581 STDMETHOD(get_RegisterAsBrowser)(VARIANT_BOOL *pbRegister) override;
582 STDMETHOD(put_RegisterAsBrowser)(VARIANT_BOOL bRegister) override;
583 STDMETHOD(get_RegisterAsDropTarget)(VARIANT_BOOL *pbRegister) override;
585 STDMETHOD(get_TheaterMode)(VARIANT_BOOL *pbRegister) override;
586 STDMETHOD(put_TheaterMode)(VARIANT_BOOL bRegister) override;
591
592 // *** ITravelLogClient methods ***
593 STDMETHOD(FindWindowByIndex)(DWORD dwID, IUnknown **ppunk) override;
594 STDMETHOD(GetWindowData)(IStream *pStream, LPWINDOWDATA pWinData) override;
595 STDMETHOD(LoadHistoryPosition)(LPWSTR pszUrlLocation, DWORD dwPosition) override;
596
597 // *** IPersist methods ***
598 STDMETHOD(GetClassID)(CLSID *pClassID) override;
599
600 // *** IPersistHistory methods ***
601 STDMETHOD(LoadHistory)(IStream *pStream, IBindCtx *pbc) override;
602 STDMETHOD(SaveHistory)(IStream *pStream) override;
603 STDMETHOD(SetPositionCookie)(DWORD dwPositioncookie) override;
604 STDMETHOD(GetPositionCookie)(DWORD *pdwPositioncookie) override;
605
606 // message handlers
614 LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
615 LRESULT OnFolderOptions(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
616 LRESULT OnMapNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
617 LRESULT OnDisconnectNetworkDrive(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
618 LRESULT OnAboutReactOS(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
619 LRESULT OnGoBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
620 LRESULT OnGoForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
621 LRESULT OnGoUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
622 LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
623 LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
624 LRESULT OnAddToFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
625 LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
626 LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
627 LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
628 LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
629 LRESULT OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
630 LRESULT OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
631 LRESULT OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
632 LRESULT OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
633 LRESULT OnGoTravel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
634 LRESULT OnRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
635 LRESULT OnExplorerBar(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
642
644 {
645 static ATL::CWndClassInfo wc =
646 {
648 0, 0, NULL, LoadIcon(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDI_CABINET)),
650 NULL, NULL, IDC_ARROW, TRUE, 0, _T("")
651 };
652 return wc;
653 }
654
697
699 CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
700 CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
702
704 COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
705 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
707 COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
708 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
709 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
710 COM_INTERFACE_ENTRY_IID(IID_IProfferService, IProfferService)
711 COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
714 COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser)
715 COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowserApp)
716 COM_INTERFACE_ENTRY_IID(IID_IWebBrowser2, IWebBrowser2)
717 COM_INTERFACE_ENTRY_IID(IID_ITravelLogClient, ITravelLogClient)
719 COM_INTERFACE_ENTRY_IID(IID_IPersistHistory, IPersistHistory)
720 COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
721 COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
723};
724
726
728{
729 m_BrowserSvcFlags = BSF_RESIZABLE | BSF_CANMAXIMIZE;
741}
742
744{
745 if (menuDsa)
747}
748
750{
751 CComPtr<IPersistStreamInit> persistStreamInit;
752 HRESULT hResult;
753 CComPtr<IUnknown> clientBar;
754
756
757 menuDsa = DSA_Create(sizeof(MenuBandInfo), 5);
758 if (!menuDsa)
759 return E_OUTOFMEMORY;
760
761 // create window
763 if (m_hWnd == NULL)
764 return E_FAIL;
765
767 if (FAILED_UNEXPECTEDLY(hResult))
768 return hResult;
769
771
772 // create interfaces
773 hResult = clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
774 if (FAILED_UNEXPECTEDLY(hResult))
775 return hResult;
776
777 hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
778 if (FAILED_UNEXPECTEDLY(hResult))
779 return hResult;
780
781 hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL, NULL);
782 if (FAILED_UNEXPECTEDLY(hResult))
783 return hResult;
784
785 CComPtr<IStream> pITBarStream;
787 hResult = SUCCEEDED(hResult) ? persistStreamInit->Load(pITBarStream) : persistStreamInit->InitNew();
788 if (FAILED_UNEXPECTEDLY(hResult))
789 return hResult;
790
791 hResult = IUnknown_ShowDW(clientBar, TRUE);
792 if (FAILED_UNEXPECTEDLY(hResult))
793 return hResult;
794
795 fToolbarProxy.Initialize(m_hWnd, clientBar);
796
797 // create status bar
800 dwStatusStyle |= WS_VISIBLE;
802 0, 0, 500, 20, m_hWnd, (HMENU)IDC_STATUSBAR,
803 _AtlBaseModule.GetModuleInstance(), 0);
804
806 UpdateWindow();
807
808 return S_OK;
809}
810
812{
813 HRESULT hr;
814 if (pvs)
815 {
817 SBFOLDERSETTINGS &sbfs = m_deffoldersettings, defsbfs;
818 if (FAILED(pvs->GetCurrentInfo(&sbfs.FolderSettings)))
819 {
820 defsbfs.InitializeDefaults();
821 sbfs = defsbfs;
822 }
824 }
825 else
826 {
829 }
830 return hr;
831}
832
834{
835 if ((Flags & (SBSP_SAMEBROWSER | SBSP_NEWBROWSER)) == SBSP_DEFBROWSER)
836 {
838 Flags |= SBSP_SAMEBROWSER; // Force if this is the first navigation or the folder tree is present
839 else
840 Flags |= (!!gCabinetState.fNewWindowMode) ^ (GetAsyncKeyState(VK_CONTROL) < 0) ? SBSP_NEWBROWSER : SBSP_SAMEBROWSER;
841 }
842 if (Flags & (SBSP_NAVIGATEBACK | SBSP_NAVIGATEFORWARD))
843 Flags = (Flags & ~SBSP_NEWBROWSER) | SBSP_SAMEBROWSER; // Force same browser for now
844 return Flags;
845}
846
848{
849 SaveITBarLayout(); // Do this now so the new window inherits the current layout
850 // TODO: www.geoffchappell.com/studies/windows/ie/shdocvw/interfaces/inotifyappstart.htm
851 DWORD flags = (SbspFlags & SBSP_EXPLOREMODE) ? SH_EXPLORER_CMDLINE_FLAG_E : 0;
852 if ((SbspFlags & (SBSP_OPENMODE | SBSP_EXPLOREMODE)) == SBSP_DEFMODE)
854 LPITEMIDLIST pidlDir;
855 HRESULT hr = SHILClone(pidl, &pidlDir);
856 if (FAILED(hr))
857 return hr;
858 // TODO: !SBSP_NOTRANSFERHIST means we are supposed to pass the history here somehow?
860}
861
863{
864 if (SbspFlags & SBSP_RELATIVE)
865 return SHILCombine(fCurrentDirectoryPIDL, relative, ppidl);
866
867 if (SbspFlags & SBSP_PARENT)
868 {
869 HRESULT hr = GetPidl(ppidl);
870 if (FAILED(hr))
871 return hr;
872 ILRemoveLastID(*ppidl);
873 return S_OK;
874 }
875 // TODO: SBSP_NAVIGATEBACK and SBSP_NAVIGATEFORWARD?
876 return E_UNEXPECTED;
877}
878
880{
881 CComPtr<IShellFolder> newFolder;
883 HRESULT hResult;
884 CLSID clsid;
885 BOOL HasIconViewType;
886
887 // called by shell view to browse to new folder
888 // also called by explorer band to navigate to new folder
889 hResult = SHBindToFolder(pidl, &newFolder);
890 if (FAILED_UNEXPECTEDLY(hResult))
891 return hResult;
892 // HACK & FIXME: Get view mode from shellbag when fully implemented.
893 IUnknown_GetClassID(newFolder, &clsid);
894 HasIconViewType = clsid == CLSID_MyComputer || clsid == CLSID_ControlPanel ||
895 clsid == CLSID_ShellDesktop;
896
897 if (HasIconViewType)
898 newFolderSettings.ViewMode = FVM_ICON;
899 hResult = BrowseToPath(newFolder, pidl, &newFolderSettings, flags);
900 if (FAILED_UNEXPECTEDLY(hResult))
901 return hResult;
902 return S_OK;
903}
904
906{
907 LPCITEMIDLIST pidlnext;
908 WORD length;
909 BOOL ret;
910
911 ret = TRUE;
912 if (! _ILIsDesktop(pidl))
913 {
914 length = pidl->mkid.cb;
915 pidlnext =
916 reinterpret_cast<LPCITEMIDLIST>(
917 reinterpret_cast<const BYTE *>(pidl) + length);
918 if (pidlnext->mkid.cb != 0)
919 ret = FALSE;
920 }
921 return ret;
922}
923
925 const IID *riid, LPVOID *ppv, LPITEMIDLIST *ppidlLast)
926{
928 LPITEMIDLIST pidlChild;
929 LPITEMIDLIST pidlParent;
930 HRESULT hResult;
931
932 hResult = E_FAIL;
933 if (ppv == NULL)
934 return E_POINTER;
935 *ppv = NULL;
936 if (ppidlLast != NULL)
937 *ppidlLast = NULL;
938 if (_ILIsPidlSimple(pidl))
939 {
940 if (ppidlLast != NULL)
941 *ppidlLast = ILClone(pidl);
942 hResult = SHGetDesktopFolder((IShellFolder **)ppv);
943 }
944 else
945 {
946 pidlChild = ILClone(ILFindLastID(pidl));
947 pidlParent = ILClone(pidl);
948 ILRemoveLastID(pidlParent);
949 hResult = SHGetDesktopFolder(&psf);
950 if (SUCCEEDED(hResult))
951 hResult = psf->BindToObject(pidlParent, NULL, *riid, ppv);
952 if (SUCCEEDED(hResult) && ppidlLast != NULL)
953 *ppidlLast = pidlChild;
954 else
955 ILFree(pidlChild);
956 ILFree(pidlParent);
957 }
958 return hResult;
959}
960
962 LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
963{
964 CComPtr<IShellFolder> parentFolder;
965 LPITEMIDLIST childPIDL = NULL;
966 STRRET L108;
967 HRESULT hResult;
968
969 hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
970 if (FAILED(hResult))
971 goto cleanup;
972
973 hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
974 if (FAILED(hResult))
975 goto cleanup;
976
977 StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
978 if (rgfInOut)
979 {
980 hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
981 if (FAILED(hResult))
982 goto cleanup;
983 }
984
985 hResult = S_OK;
986
987cleanup:
988 if (childPIDL)
989 ILFree(childPIDL);
990 return hResult;
991}
992
993HRESULT IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
994{
995 return IEGetNameAndFlagsEx(pidl, uFlags, 0, pszBuf, cchBuf, rgfInOut);
996}
997
999 LPCITEMIDLIST absolutePIDL, FOLDERSETTINGS *folderSettings, long flags)
1000{
1001 CComPtr<IShellFolder> saveCurrentShellFolder;
1002 CComPtr<IShellView> saveCurrentShellView;
1003 CComPtr<IShellView> newShellView;
1004 CComPtr<ITravelLog> travelLog;
1005 HWND newShellViewWindow;
1006 BOOL windowUpdateIsLocked;
1007 RECT shellViewWindowBounds;
1008 HWND previousView;
1009 HCURSOR saveCursor;
1010 wchar_t newTitle[MAX_PATH];
1011 SHGDNF nameFlags;
1012 HRESULT hResult;
1013 //TODO: BOOL nohistory = m_BrowserSvcFlags & BSF_NAVNOHISTORY;
1014
1015 if (newShellFolder == NULL)
1016 return E_INVALIDARG;
1017
1018 hResult = GetTravelLog(&travelLog);
1019 if (FAILED_UNEXPECTEDLY(hResult))
1020 return hResult;
1021
1022 // update history
1024 {
1025 if (travelLog->CountEntries(static_cast<IDropTarget *>(this)) > 0)
1026 hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1027 // what to do with error? Do we want to halt browse because state save failed?
1028 }
1029
1031 {
1032 fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
1033 }
1034
1035 // create view object
1036 hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
1037 if (FAILED_UNEXPECTEDLY(hResult))
1038 return hResult;
1039 previousView = fCurrentShellViewWindow;
1040
1041 // enter updating section
1042 saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
1043 windowUpdateIsLocked = LockWindowUpdate(TRUE);
1044 if (fCurrentShellView != NULL)
1046
1047 // set site
1048 hResult = IUnknown_SetSite(newShellView, static_cast<IDropTarget *>(this));
1049
1050 // update folder and view
1051 saveCurrentShellFolder = fCurrentShellFolder;
1052 saveCurrentShellView = fCurrentShellView;
1053 fCurrentShellFolder = newShellFolder;
1054 fCurrentShellView = newShellView;
1055
1056 // get boundary
1057 if (previousView != NULL)
1058 ::GetWindowRect(previousView, &shellViewWindowBounds);
1059 else
1060 ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
1061 ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
1062
1063 // update current pidl
1065 fCurrentDirectoryPIDL = ILClone(absolutePIDL);
1066
1067 // create view window
1068 hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
1069 this, &shellViewWindowBounds, &newShellViewWindow);
1070 if (FAILED_UNEXPECTEDLY(hResult) || newShellViewWindow == NULL)
1071 {
1072 fCurrentShellView = saveCurrentShellView;
1073 fCurrentShellFolder = saveCurrentShellFolder;
1075 if (windowUpdateIsLocked)
1077 SetCursor(saveCursor);
1078 return hResult;
1079 }
1080
1081 // update view window
1082 if (saveCurrentShellView != NULL)
1083 saveCurrentShellView->DestroyViewWindow();
1084 fCurrentShellViewWindow = newShellViewWindow;
1085
1086 if (previousView == NULL)
1087 {
1089 }
1090
1091 // no use
1092 saveCurrentShellView.Release();
1093 saveCurrentShellFolder.Release();
1094
1095 hResult = newShellView->UIActivate((flags & BTP_ACTIVATE_NOFOCUS) ? SVUIA_ACTIVATE_NOFOCUS : SVUIA_ACTIVATE_FOCUS);
1096
1097 // leave updating section
1098 if (windowUpdateIsLocked)
1100 SetCursor(saveCursor);
1101
1102 // update history
1104 {
1105 hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1106 hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1107 }
1108
1109 // completed
1110 nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1111 hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1112 sizeof(newTitle) / sizeof(wchar_t), NULL);
1113 if (SUCCEEDED(hResult))
1114 {
1115 FireNavigateComplete(newTitle);
1116 }
1117 else
1118 {
1119 FireNavigateComplete(L"ERROR");
1120 }
1121
1123
1124 LPCITEMIDLIST pidlChild;
1125 INT index, indexOpen;
1126 HIMAGELIST himlSmall, himlLarge;
1127
1129 hResult = SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1130 if (SUCCEEDED(hResult))
1131 {
1132 index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1133
1134 Shell_GetImageLists(&himlLarge, &himlSmall);
1135
1136 HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1137 HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1138
1139 /* Hack to make it possible to release the old icons */
1140 /* Something seems to go wrong with WM_SETICON */
1141 HICON oldSmall = (HICON)SendMessage(WM_GETICON, ICON_SMALL, 0);
1142 HICON oldLarge = (HICON)SendMessage(WM_GETICON, ICON_BIG, 0);
1143
1144 SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1145 SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge));
1146
1147 DestroyIcon(oldSmall);
1148 DestroyIcon(oldLarge);
1149 }
1150
1152 hResult = UpdateForwardBackState();
1153 hResult = UpdateUpState();
1154 return S_OK;
1155}
1156
1158{
1159 CComPtr<IBandSite> bandSite;
1160 CComPtr<IDeskBand> deskBand;
1161 HRESULT hResult;
1162
1163 if (!fClientBars[BIInternetToolbar].clientBar)
1164 return E_FAIL;
1165
1167 if (FAILED_UNEXPECTEDLY(hResult))
1168 return hResult;
1169
1170 hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1171 if (FAILED_UNEXPECTEDLY(hResult))
1172 return hResult;
1173
1174 return deskBand->QueryInterface(riid, shellMenu);
1175}
1176
1177HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
1178{
1179 CComPtr<IUnknown> newBaseBar;
1180 CComPtr<IDeskBar> deskBar;
1181 CComPtr<IUnknown> newBaseBarSite;
1182 CComPtr<IDeskBarClient> deskBarClient;
1183 IUnknown **cache;
1184 HRESULT hResult;
1185
1186 if (vertical)
1188 else
1190 if (*cache == NULL)
1191 {
1192 hResult = CBaseBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBar), vertical);
1193 if (FAILED_UNEXPECTEDLY(hResult))
1194 return hResult;
1195 hResult = CBaseBarSite_CreateInstance(IID_PPV_ARG(IUnknown, &newBaseBarSite), vertical);
1196 if (FAILED_UNEXPECTEDLY(hResult))
1197 return hResult;
1198
1199 // we have to store our basebar into cache now
1200 *cache = newBaseBar;
1201 (*cache)->AddRef();
1202
1203 // tell the new base bar about the shell browser
1204 hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
1205 if (FAILED_UNEXPECTEDLY(hResult))
1206 return hResult;
1207
1208 // tell the new base bar about the new base bar site
1209 hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1210 if (FAILED_UNEXPECTEDLY(hResult))
1211 return hResult;
1212 hResult = deskBar->SetClient(newBaseBarSite);
1213 if (FAILED_UNEXPECTEDLY(hResult))
1214 return hResult;
1215
1216 // tell the new base bar site about the new base bar
1217 hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1218 if (FAILED_UNEXPECTEDLY(hResult))
1219 return hResult;
1220 hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1221 if (FAILED_UNEXPECTEDLY(hResult))
1222 return hResult;
1223
1224 }
1225 return (*cache)->QueryInterface(riid, theBaseBar);
1226}
1227
1228BOOL CShellBrowser::IsBandLoaded(const CLSID clsidBand, bool vertical, DWORD *pdwBandID)
1229{
1230 HRESULT hResult;
1231 CComPtr<IDeskBar> deskBar;
1232 CComPtr<IUnknown> baseBarSite;
1233 CComPtr<IBandSite> bandSite;
1234 CLSID clsidTmp;
1235 DWORD numBands;
1236 DWORD dwBandID;
1237 DWORD i;
1238
1239 /* Get our basebarsite to be able to enumerate bands */
1240 hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1241 if (FAILED_UNEXPECTEDLY(hResult))
1242 return FALSE;
1243 hResult = deskBar->GetClient(&baseBarSite);
1244 if (FAILED_UNEXPECTEDLY(hResult))
1245 return FALSE;
1246 hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &bandSite));
1247 if (FAILED_UNEXPECTEDLY(hResult))
1248 return FALSE;
1249
1250 hResult = bandSite->EnumBands(-1, &numBands);
1251 if (FAILED_UNEXPECTEDLY(hResult))
1252 return FALSE;
1253
1254 for(i = 0; i < numBands; i++)
1255 {
1256 CComPtr<IPersist> bandPersist;
1257
1258 hResult = bandSite->EnumBands(i, &dwBandID);
1259 if (FAILED_UNEXPECTEDLY(hResult))
1260 return FALSE;
1261
1262 hResult = bandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &bandPersist));
1263 if (FAILED_UNEXPECTEDLY(hResult))
1264 return FALSE;
1265 hResult = bandPersist->GetClassID(&clsidTmp);
1266 if (FAILED_UNEXPECTEDLY(hResult))
1267 return FALSE;
1268 if (IsEqualGUID(clsidBand, clsidTmp))
1269 {
1270 if (pdwBandID) *pdwBandID = dwBandID;
1271 return TRUE;
1272 }
1273 }
1274 return FALSE;
1275}
1276
1277HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1278{
1279 CComPtr<IDockingWindow> dockingWindow;
1280 CComPtr<IUnknown> baseBarSite;
1281 CComPtr<IUnknown> newBand;
1282 CComPtr<IDeskBar> deskBar;
1283 VARIANT vaIn;
1284 HRESULT hResult;
1285 DWORD dwBandID;
1286
1287 hResult = GetBaseBar(vertical, IID_PPV_ARG(IDeskBar, &deskBar));
1288 if (FAILED_UNEXPECTEDLY(hResult))
1289 return hResult;
1290
1291 hResult = deskBar->GetClient(&baseBarSite);
1292 if (FAILED_UNEXPECTEDLY(hResult))
1293 return hResult;
1294
1295 hResult = deskBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1296 if (FAILED_UNEXPECTEDLY(hResult))
1297 return hResult;
1298
1299 if (!IsBandLoaded(classID, vertical, &dwBandID))
1300 {
1301 TRACE("ShowBand called for CLSID %s, vertical=%d...\n", wine_dbgstr_guid(&classID), vertical);
1302 if (IsEqualCLSID(CLSID_ExplorerBand, classID))
1303 {
1304 TRACE("CLSID_ExplorerBand requested, building internal band.\n");
1306 if (FAILED_UNEXPECTEDLY(hResult))
1307 return hResult;
1308 }
1309 else if (IsEqualCLSID(classID, CLSID_FileSearchBand))
1310 {
1311 TRACE("CLSID_FileSearchBand requested, building internal band.\n");
1312 hResult = CSearchBar_CreateInstance(IID_PPV_ARG(IUnknown, &newBand));
1313 if (FAILED_UNEXPECTEDLY(hResult))
1314 return hResult;
1315 }
1316 else
1317 {
1318 TRACE("A different CLSID requested, using CoCreateInstance.\n");
1319 hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1320 if (FAILED_UNEXPECTEDLY(hResult))
1321 return hResult;
1322 }
1323 }
1324 else
1325 {
1326 CComPtr<IBandSite> pBandSite;
1327
1328 hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IBandSite, &pBandSite));
1329 if (!SUCCEEDED(hResult))
1330 {
1331 ERR("Can't get IBandSite interface\n");
1332 return E_FAIL;
1333 }
1334 hResult = pBandSite->GetBandObject(dwBandID, IID_PPV_ARG(IUnknown, &newBand));
1335 if (!SUCCEEDED(hResult))
1336 {
1337 ERR("Can't find band object\n");
1338 return E_FAIL;
1339 }
1340
1341 // It's hackish, but we should be able to show the wanted band until we
1342 // find the proper way to do this (but it seems to work to add a new band)
1343 // Here we'll just re-add the existing band to the site, causing it to display.
1344 }
1345 V_VT(&vaIn) = VT_UNKNOWN;
1346 V_UNKNOWN(&vaIn) = newBand.p;
1347 hResult = IUnknown_Exec(baseBarSite, CGID_IDeskBand, 1, 1, &vaIn, NULL);
1348 if (FAILED_UNEXPECTEDLY(hResult))
1349 {
1350 return hResult;
1351 }
1352
1353 hResult = dockingWindow->ShowDW(TRUE);
1354 if (FAILED_UNEXPECTEDLY(hResult))
1355 return hResult;
1356
1357 if (vertical)
1358 {
1359 fCurrentVertBar = classID;
1361 }
1362
1363 return S_OK;
1364}
1365
1367{
1369 if (newDirectory == NULL)
1370 return E_OUTOFMEMORY;
1371 if (_ILIsDesktop(newDirectory))
1372 {
1373 ILFree(newDirectory);
1374 return E_INVALIDARG;
1375 }
1376 ILRemoveLastID(newDirectory);
1378 ILFree(newDirectory);
1379 if (FAILED_UNEXPECTEDLY(hResult))
1380 return hResult;
1381 return S_OK;
1382}
1383
1385{
1386 PROPSHEETHEADER* sheetInfo = reinterpret_cast<PROPSHEETHEADER*>(lParam);
1387 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1388 return FALSE;
1389 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1390 sheetInfo->nPages++;
1391 return TRUE;
1392}
1393
1395{
1396 CComPtr<IShellPropSheetExt> folderOptionsSheet;
1397 PROPSHEETHEADER m_PropSheet;
1399// CComPtr<IGlobalFolderSettings> globalSettings;
1400// SHELLSTATE2 shellState;
1401 HRESULT hResult;
1402
1403 memset(m_psp, 0, sizeof(m_psp));
1404 memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1405
1406 // create sheet object
1407 hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1408 IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1409 if (FAILED_UNEXPECTEDLY(hResult))
1410 return E_FAIL;
1411
1412 // must set site in order for Apply to all Folders on Advanced page to be enabled
1413 hResult = IUnknown_SetSite(folderOptionsSheet, static_cast<IDispatch *>(this));
1414 m_PropSheet.phpage = m_psp;
1415
1416#if 0
1417 hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1418 if (FAILED_UNEXPECTEDLY(hResult))
1419 return E_FAIL;
1420 hResult = globalSettings->Get(&shellState, sizeof(shellState));
1421 if (FAILED_UNEXPECTEDLY(hResult))
1422 return E_FAIL;
1423#endif
1424
1425 // add pages
1426 hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1427 if (FAILED_UNEXPECTEDLY(hResult))
1428 return E_FAIL;
1429
1431 {
1432 hResult = fCurrentShellView->AddPropertySheetPages(
1433 0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1434 if (FAILED_UNEXPECTEDLY(hResult))
1435 return E_FAIL;
1436 }
1437
1438 // show sheet
1439 CStringW strFolderOptions(MAKEINTRESOURCEW(IDS_FOLDER_OPTIONS));
1440 m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1441 m_PropSheet.dwFlags = 0;
1442 m_PropSheet.hwndParent = m_hWnd;
1443 m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1444 m_PropSheet.pszCaption = strFolderOptions;
1445 m_PropSheet.nStartPage = 0;
1446 PropertySheet(&m_PropSheet);
1447 return S_OK;
1448}
1449
1451{
1452 CShellBrowser *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1453 _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1454 LRESULT lResult;
1455 const _ATL_MSG *previousMessage;
1456 BOOL handled;
1457 WNDPROC saveWindowProc;
1458 HRESULT hResult;
1459
1460 hWnd = pThis->m_hWnd;
1461 previousMessage = pThis->m_pCurrentMsg;
1462 pThis->m_pCurrentMsg = &msg;
1463
1464 /* If the shell browser is initialized, let the menu band preprocess the messages */
1465 if (pThis->fCurrentDirectoryPIDL)
1466 {
1467 CComPtr<IMenuBand> menuBand;
1468 hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1469 if (SUCCEEDED(hResult) && menuBand.p != NULL)
1470 {
1471 hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1472 if (hResult == S_OK)
1473 return lResult;
1474 uMsg = msg.message;
1475 wParam = msg.wParam;
1476 lParam = msg.lParam;
1477 }
1478 menuBand.Release();
1479 }
1480
1481 handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1482 ATLASSERT(pThis->m_pCurrentMsg == &msg);
1483 if (handled == FALSE)
1484 {
1485 if (uMsg == WM_NCDESTROY)
1486 {
1487 saveWindowProc = reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC));
1488 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1489 if (saveWindowProc == reinterpret_cast<WNDPROC>(::GetWindowLongPtr(hWnd, GWLP_WNDPROC)))
1491 pThis->m_dwState |= WINSTATE_DESTROYED;
1492 }
1493 else
1494 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1495 }
1496 pThis->m_pCurrentMsg = previousMessage;
1497 if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1498 {
1499 pThis->m_dwState &= ~WINSTATE_DESTROYED;
1500 pThis->m_hWnd = NULL;
1501 pThis->OnFinalMessage(hWnd);
1502 }
1503 return lResult;
1504}
1505
1507{
1508 RECT clientRect;
1509 RECT statusRect;
1510 int x;
1511
1512 GetClientRect(&clientRect);
1513
1515 {
1516 ::GetWindowRect(fStatusBar, &statusRect);
1517 ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1518 clientRect.right - clientRect.left,
1519 statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1520 clientRect.bottom -= statusRect.bottom - statusRect.top;
1521 }
1522
1523 for (x = 0; x < 3; x++)
1524 {
1526 RECT borderSpace = fClientBars[x].borderSpace;
1527 if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1528 {
1529 IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1531 }
1532 if (hwnd != NULL)
1533 {
1534 RECT toolbarRect = clientRect;
1535 if (borderSpace.top != 0)
1536 {
1537 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1538 }
1539 else if (borderSpace.bottom != 0)
1540 {
1541 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1542 }
1543 else if (borderSpace.left != 0)
1544 {
1545 toolbarRect.right = toolbarRect.left + borderSpace.left;
1546 }
1547 else if (borderSpace.right != 0)
1548 {
1549 toolbarRect.left = toolbarRect.right - borderSpace.right;
1550 }
1551
1553 toolbarRect.left,
1554 toolbarRect.top,
1555 toolbarRect.right - toolbarRect.left,
1556 toolbarRect.bottom - toolbarRect.top,
1558
1559 if (borderSpace.top != 0)
1560 {
1561 clientRect.top = toolbarRect.bottom;
1562 }
1563 else if (borderSpace.bottom != 0)
1564 {
1565 clientRect.bottom = toolbarRect.top;
1566 }
1567 else if (borderSpace.left != 0)
1568 {
1569 clientRect.left = toolbarRect.right;
1570 }
1571 else if (borderSpace.right != 0)
1572 {
1573 clientRect.right = toolbarRect.left;
1574 }
1575 }
1576 }
1577 ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1578 clientRect.right - clientRect.left,
1579 clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1580}
1581
1582HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1583{
1584 DISPPARAMS params;
1587 HRESULT hResult;
1588
1589 params.rgvarg = arguments;
1590 params.rgdispidNamedArgs = NULL;
1591 params.cArgs = argCount;
1592 params.cNamedArgs = 0;
1593 IUnknown** pp = vec.begin();
1594 while (pp < vec.end())
1595 {
1596 if (*pp != NULL)
1597 {
1598 CComPtr<IDispatch> theDispatch;
1599
1600 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1601 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1602 }
1603 pp++;
1604 }
1605 pp = vec2.begin();
1606 while (pp < vec2.end())
1607 {
1608 if (*pp != NULL)
1609 {
1610 CComPtr<IDispatch> theDispatch;
1611
1612 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1613 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1614 }
1615 pp++;
1616 }
1617 return S_OK;
1618}
1619
1621{
1622 // these two variants intentionally to do use CComVariant because it would double free/release
1623 // or does not need to dispose at all
1624 VARIANT varArg[2];
1625 VARIANT varArgs;
1626 CComBSTR tempString(newDirectory);
1627
1628 V_VT(&varArgs) = VT_BSTR;
1629 V_BSTR(&varArgs) = tempString.m_str;
1630
1631 V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1632 V_VARIANTREF(&varArg[0]) = &varArgs;
1633 V_VT(&varArg[1]) = VT_DISPATCH;
1634 V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1635
1636 return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1637}
1638
1640{
1641 VARIANT varArg[2];
1642
1643 V_VT(&varArg[0]) = VT_BOOL;
1644 V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1645 V_VT(&varArg[1]) = VT_I4;
1646 V_I4(&varArg[1]) = commandID;
1647
1648 return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1649}
1650
1652{
1653 return FireCommandStateChange(false, -1);
1654}
1655
1657{
1658 CComPtr<ITravelLog> travelLog;
1659 CComPtr<ITravelEntry> unusedEntry;
1660 bool canGoBack;
1661 bool canGoForward;
1662 HRESULT hResult;
1663
1664 canGoBack = false;
1665 canGoForward = false;
1666 hResult = GetTravelLog(&travelLog);
1667 if (FAILED_UNEXPECTEDLY(hResult))
1668 return hResult;
1669 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1670 if (SUCCEEDED(hResult))
1671 {
1672 canGoBack = true;
1673 unusedEntry.Release();
1674 }
1675 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1676 if (SUCCEEDED(hResult))
1677 {
1678 canGoForward = true;
1679 unusedEntry.Release();
1680 }
1681 hResult = FireCommandStateChange(canGoBack, 2);
1682 hResult = FireCommandStateChange(canGoForward, 1);
1683 return S_OK;
1684}
1685
1687{
1688 bool canGoUp;
1689 HRESULT hResult;
1690
1691 canGoUp = true;
1693 canGoUp = false;
1694 hResult = FireCommandStateChange(canGoUp, 3);
1695 return S_OK;
1696}
1697
1699{
1700 CComPtr<ITravelLog> travelLog;
1701 CComPtr<ITravelEntry> unusedEntry;
1702 int position;
1703 MENUITEMINFO menuItemInfo;
1704 HRESULT hResult;
1705
1707
1708 position = GetMenuItemCount(theMenu);
1709 hResult = GetTravelLog(&travelLog);
1710 if (FAILED_UNEXPECTEDLY(hResult))
1711 return;
1712
1713 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1714 TLOG_BACK,
1715 &unusedEntry);
1716
1717 if (SUCCEEDED(hResult))
1718 {
1720 unusedEntry.Release();
1721 }
1722 else
1724
1725 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this),
1726 TLOG_FORE,
1727 &unusedEntry);
1728
1729 if (SUCCEEDED(hResult))
1730 {
1732 unusedEntry.Release();
1733 }
1734 else
1736
1737 SHEnableMenuItem(theMenu,
1740
1741 hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1743 if (SUCCEEDED(hResult))
1744 {
1745 menuItemInfo.cbSize = sizeof(menuItemInfo);
1746 menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1747 menuItemInfo.fType = MF_SEPARATOR;
1748 menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1749 InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1750 }
1751}
1752
1754{
1755 CComPtr<ITravelLog> travelLog;
1756 HMENU gotoMenu;
1757 OLECMD commandList[5];
1758 HMENU toolbarMenuBar;
1759 HMENU toolbarMenu;
1760 MENUITEMINFO menuItemInfo;
1761 HRESULT hResult;
1762
1763 gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1764 if (gotoMenu != NULL)
1765 UpdateGotoMenu(gotoMenu);
1766
1767 commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1768 commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1769 commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1770 commandList[3].cmdID = ITID_TOOLBARLOCKED;
1771 commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1772
1774 CGID_PrivCITCommands, 5, commandList, NULL);
1775 if (FAILED_UNEXPECTEDLY(hResult))
1777 else
1778 {
1779 menuItemInfo.cbSize = sizeof(menuItemInfo);
1780 menuItemInfo.fMask = MIIM_SUBMENU;
1781 GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1782 DestroyMenu(menuItemInfo.hSubMenu);
1783
1784 toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1785 toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1786 RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION);
1787 DestroyMenu(toolbarMenuBar);
1788
1789 // TODO: Implement
1790 SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_ENABLED);
1791 SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1792 SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1793 SHEnableMenuItem(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, commandList[4].cmdf & OLECMDF_ENABLED);
1794
1795 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf & OLECMDF_LATCHED);
1796 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_LATCHED);
1797 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_LATCHED);
1798 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_LATCHED);
1799 if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1803
1804 menuItemInfo.cbSize = sizeof(menuItemInfo);
1805 menuItemInfo.fMask = MIIM_SUBMENU;
1806 menuItemInfo.hSubMenu = toolbarMenu;
1807 SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1808 }
1810}
1811
1813{
1814 HMENU hBandsMenu;
1815 UINT nbFound;
1816
1818 if (!hBandsMenu)
1819 {
1820 OutputDebugString(L"No menu !\n");
1821 return E_FAIL;
1822 }
1824 BuildExplorerBandCategory(hBandsMenu, CATID_InfoBand, 4, NULL);
1825 BuildExplorerBandCategory(hBandsMenu, CATID_CommBand, 20, &nbFound);
1826 if (!nbFound)
1827 {
1828 // Remove separator
1830 }
1831 // Remove media menu since XP does it (according to API Monitor)
1833 return S_OK;
1834}
1835
1837{
1838 HRESULT hr;
1839 CComPtr<IEnumGUID> pEnumGUID;
1840 WCHAR wszBandName[MAX_PATH];
1841 WCHAR wszBandGUID[MAX_PATH];
1842 WCHAR wRegKey[MAX_PATH];
1843 UINT cBands;
1844 DWORD dwRead;
1845 DWORD dwDataSize;
1846 GUID iter;
1847 MenuBandInfo mbi;
1848
1849 mbi.fVertical = IsEqualGUID(category, CATID_InfoBand);
1850 cBands = 0;
1851 hr = SHEnumClassesOfCategories(1, &category, 0, NULL, &pEnumGUID);
1853 {
1854 return hr;
1855 }
1856 do
1857 {
1858 pEnumGUID->Next(1, &iter, &dwRead);
1859 if (dwRead)
1860 {
1861 // Get the band name
1862 if (IsBuiltinBand(iter))
1863 continue;
1864 if (!StringFromGUID2(iter, wszBandGUID, MAX_PATH))
1865 continue;
1866 StringCchPrintfW(wRegKey, MAX_PATH, L"CLSID\\%s", wszBandGUID);
1867 dwDataSize = MAX_PATH;
1868 SHGetValue(HKEY_CLASSES_ROOT, wRegKey, NULL, NULL, wszBandName, &dwDataSize);
1869
1870 mbi.barGuid = iter;
1871 InsertMenu(hBandsMenu, dwPos + cBands, MF_BYPOSITION, IDM_EXPLORERBAND_BEGINCUSTOM + DSA_GetItemCount(menuDsa), wszBandName);
1872 DSA_AppendItem(menuDsa, &mbi);
1873 cBands++;
1874 }
1875 }
1876 while (dwRead > 0);
1877 if (nbFound)
1878 *nbFound = cBands;
1879 return S_OK;
1880}
1881
1883{
1884 if (IsEqualCLSID(bandID, CLSID_ExplorerBand))
1885 return TRUE;
1886 if (IsEqualCLSID(bandID, CLSID_SH_SearchBand) || IsEqualCLSID(bandID, CLSID_SearchBand))
1887 return TRUE;
1888 if (IsEqualCLSID(bandID, CLSID_IE_SearchBand) || IsEqualCLSID(bandID, CLSID_FileSearchBand))
1889 return TRUE;
1890 if (IsEqualCLSID(bandID, CLSID_SH_HistBand))
1891 return TRUE;
1892 if (IsEqualCLSID(bandID, CLSID_SH_FavBand))
1893 return TRUE;
1894 if (IsEqualCLSID(bandID, CLSID_ChannelsBand))
1895 return TRUE;
1896 return FALSE;
1897}
1898
1900{
1901 CComPtr<IObjectWithSite> objectWithSite;
1902 CComPtr<IContextMenu> contextMenu;
1903 CMINVOKECOMMANDINFO commandInfo;
1904 const char *searchGUID = "{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
1905 HRESULT hResult;
1906
1907 // TODO: Query shell if this command is enabled first
1908
1909 memset(&commandInfo, 0, sizeof(commandInfo));
1910 commandInfo.cbSize = sizeof(commandInfo);
1911 commandInfo.hwnd = m_hWnd;
1912 commandInfo.lpParameters = searchGUID;
1913 commandInfo.nShow = SW_SHOWNORMAL;
1914
1915 hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
1916 IID_PPV_ARG(IContextMenu, &contextMenu));
1917 if (FAILED_UNEXPECTEDLY(hResult))
1918 return 0;
1919 hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1920 if (FAILED_UNEXPECTEDLY(hResult))
1921 return 0;
1922 hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
1923 if (FAILED_UNEXPECTEDLY(hResult))
1924 return 0;
1925 hResult = contextMenu->InvokeCommand(&commandInfo);
1926 hResult = objectWithSite->SetSite(NULL);
1927 return hResult;
1928}
1929
1931{
1932 CComPtr<IUnknown> int1Retry;
1933 CComPtr<IUnknown> int2Retry;
1934 HRESULT hResult;
1935
1936 if (int1 == int2)
1937 return true;
1938 if (int1 == NULL || int2 == NULL)
1939 return false;
1940 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1941 if (FAILED_UNEXPECTEDLY(hResult))
1942 return false;
1943 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1944 if (FAILED_UNEXPECTEDLY(hResult))
1945 return false;
1946 if (int1Retry == int2Retry)
1947 return true;
1948 return false;
1949}
1950
1952{
1953 static const INT excludeItems[] = { 1, 1, 1, IDC_STATUSBAR, 0, 0 };
1954
1955 RECT availableBounds;
1956
1957 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1958 for (INT x = 0; x < 3; x++)
1959 {
1960 if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1961 {
1962 availableBounds.top += fClientBars[x].borderSpace.top;
1963 availableBounds.left += fClientBars[x].borderSpace.left;
1964 availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1965 availableBounds.right -= fClientBars[x].borderSpace.right;
1966 }
1967 }
1968 *prcBorder = availableBounds;
1969 return S_OK;
1970}
1971
1973{
1974 return S_OK;
1975}
1976
1978{
1979 for (INT x = 0; x < 3; x++)
1980 {
1981 if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1982 {
1983 fClientBars[x].borderSpace = *pbw;
1984 // if this bar changed size, it cascades and forces all subsequent bars to resize
1986 return S_OK;
1987 }
1988 }
1989 return E_INVALIDARG;
1990}
1991
1993 ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
1994{
1995 CComPtr<IOleCommandTarget> commandTarget;
1996 HRESULT hResult;
1997
1998 if (prgCmds == NULL)
1999 return E_INVALIDARG;
2000 if (pguidCmdGroup == NULL)
2001 {
2002 if (fCurrentShellView.p != NULL)
2003 {
2004 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
2005 if (SUCCEEDED(hResult) && commandTarget.p != NULL)
2006 return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
2007 }
2008 while (cCmds != 0)
2009 {
2010 prgCmds->cmdf = 0;
2011 prgCmds++;
2012 cCmds--;
2013 }
2014 }
2015 else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2016 {
2017 while (cCmds != 0)
2018 {
2019 switch (prgCmds->cmdID)
2020 {
2021 case 0x1c: // search
2023 if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
2024 IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
2025 IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
2026 IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
2027 {
2028 prgCmds->cmdf |= OLECMDF_LATCHED;
2029 }
2030 break;
2031 case 0x1d: // history
2033 if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
2034 prgCmds->cmdf |= OLECMDF_LATCHED;
2035 break;
2036 case 0x1e: // favorites
2038 if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
2039 prgCmds->cmdf |= OLECMDF_LATCHED;
2040 break;
2041 case SBCMDID_EXPLORERBARFOLDERS: // folders
2043 if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
2044 prgCmds->cmdf |= OLECMDF_LATCHED;
2045 break;
2046 default:
2047 prgCmds->cmdf = 0;
2048 break;
2049 }
2050 prgCmds++;
2051 cCmds--;
2052 }
2053 }
2054 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2055 {
2056 while (cCmds != 0)
2057 {
2058 switch (prgCmds->cmdID)
2059 {
2061 prgCmds->cmdf = OLECMDF_SUPPORTED;
2062 if (fCurrentDirectoryPIDL->mkid.cb != 0)
2063 prgCmds->cmdf |= OLECMDF_ENABLED;
2064 break;
2065 }
2066 prgCmds++;
2067 cCmds--;
2068 }
2069 }
2070 return S_OK;
2071}
2072
2074 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2075{
2076 HRESULT hResult;
2077
2078 if (!pguidCmdGroup)
2079 {
2080 TRACE("Unhandled null CGID %d %d %p %p\n", nCmdID, nCmdexecopt, pvaIn, pvaOut);
2081 return E_NOTIMPL;
2082 }
2083 if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
2084 {
2085 switch (nCmdID)
2086 {
2087 case 0x1c: //Toggle Search
2088 case 0x1d: //Toggle History
2089 case 0x1e: //Toggle Favorites
2090 case SBCMDID_EXPLORERBARFOLDERS: //Toggle Folders
2091 const GUID* pclsid;
2092 if (nCmdID == 0x1c) pclsid = &CLSID_FileSearchBand;
2093 else if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
2094 else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
2095 else pclsid = &CLSID_ExplorerBand;
2096
2097 if (IsEqualCLSID(*pclsid, fCurrentVertBar))
2098 {
2099 hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
2102 }
2103 else
2104 {
2105 hResult = ShowBand(*pclsid, true);
2106 }
2107 return S_OK;
2108 case 0x22:
2109 //Sent when a band closes
2110 if (V_VT(pvaIn) != VT_UNKNOWN)
2111 return E_INVALIDARG;
2112
2113 if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
2114 {
2117 }
2118 return S_OK;
2119 case 0x27:
2120 if (nCmdexecopt == 1)
2121 {
2122 // pvaIn is a VT_UNKNOWN with a band that is being hidden
2123 }
2124 else
2125 {
2126 // update zones part of the status bar
2127 }
2128 return S_OK;
2129 case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
2130 V_VT(pvaOut) = VT_INT_PTR;
2131 V_INTREF(pvaOut) = reinterpret_cast<INT *>(
2132 LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
2133 return S_OK;
2134 case 0x38:
2135 // indicate if this cabinet was opened as a browser
2136 return S_FALSE;
2137 default:
2138 return E_NOTIMPL;
2139 }
2140 }
2141 else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
2142 {
2143 switch (nCmdID)
2144 {
2145 case 0x23:
2146 // placeholder
2147 return S_OK;
2148 }
2149 }
2150 else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
2151 {
2152 switch (nCmdID)
2153 {
2154 case 6:
2155 // what is theater mode and why do we receive this?
2156 return E_NOTIMPL;
2157 }
2158 }
2159 else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
2160 {
2161 switch (nCmdID)
2162 {
2163 case 14:
2164 // initialize favorites menu
2165 return S_OK;
2166 }
2167 }
2168 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
2169 {
2170 switch (nCmdID)
2171 {
2172 case 0x12:
2173 // refresh on toolbar clicked
2174 return S_OK;
2175 case 0x26:
2176 // called for unknown bands ?
2177 return S_OK;
2178 case 0x4d:
2179 // tell the view if it should hide the task pane or not
2180 return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
2181 }
2182 }
2183 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
2184 {
2185 switch (nCmdID)
2186 {
2187 case 40994:
2188 return NavigateToParent();
2191 break;
2192 }
2193 }
2194 else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
2195 {
2196 switch (nCmdID)
2197 {
2198 case 0x7063:
2199 return DoFolderOptions();
2200 }
2201 }
2202 else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
2203 {
2204 switch (nCmdID)
2205 {
2208 break;
2209 }
2210 }
2211 else
2212 {
2213 return E_NOTIMPL;
2214 }
2215 return E_NOTIMPL;
2216}
2217
2219{
2220 if (lphwnd == NULL)
2221 return E_POINTER;
2222 *lphwnd = m_hWnd;
2223 return S_OK;
2224}
2225
2227{
2228 return E_NOTIMPL;
2229}
2230
2231HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
2232{
2233 HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2234
2235 Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
2236
2237 int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
2238 Unused(itemCount3);
2239
2240 DestroyMenu(mainMenu);
2241
2242 lpMenuWidths->width[0] = 2;
2243 lpMenuWidths->width[2] = 3;
2244 lpMenuWidths->width[4] = 1;
2245 return S_OK;
2246}
2247
2248HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
2249{
2250 CComPtr<IShellMenu> shellMenu;
2251 HRESULT hResult;
2252
2253 if (hmenuShared && IsMenu(hmenuShared) == FALSE)
2254 return E_FAIL;
2255 hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
2256 if (FAILED_UNEXPECTEDLY(hResult))
2257 return hResult;
2258
2259 if (!hmenuShared)
2260 {
2261 hmenuShared = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
2262 }
2263 // FIXME: Figure out the proper way to do this.
2264 HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
2265 if (hMenuFavs)
2266 {
2268 }
2269
2270 hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
2271 if (FAILED_UNEXPECTEDLY(hResult))
2272 return hResult;
2273 fCurrentMenuBar = hmenuShared;
2275 return S_OK;
2276}
2277
2279{
2280 if (hmenuShared == fCurrentMenuBar)
2281 {
2282 //DestroyMenu(fCurrentMenuBar);
2284 }
2285 return S_OK;
2286}
2287
2289{
2290 //
2291 if (pszStatusText)
2292 {
2293 ::SetWindowText(fStatusBar, pszStatusText);
2294 }
2295 else
2296 {
2297
2298 }
2299 return S_OK;
2300}
2301
2303{
2304 return E_NOTIMPL;
2305}
2306
2308{
2310 return S_FALSE;
2311 return S_OK;
2312}
2313
2315{
2317 // FIXME: Should not automatically show the Explorer band
2318 if ((wFlags & SBSP_EXPLOREMODE) && !(wFlags & SBSP_NEWBROWSER))
2319 ShowBand(CLSID_ExplorerBand, true);
2320
2321 CComHeapPtr<ITEMIDLIST> pidlResolved;
2322 if (wFlags & (SBSP_RELATIVE | SBSP_PARENT))
2323 {
2324 HRESULT hr = CreateRelativeBrowsePIDL(pidl, wFlags, &pidlResolved);
2325 if (FAILED(hr))
2326 return hr;
2327 pidl = pidlResolved;
2328 }
2329
2330 if (wFlags & SBSP_NEWBROWSER)
2331 return OpenNewBrowserWindow(pidl, wFlags);
2332
2333 switch (wFlags & (SBSP_ABSOLUTE | SBSP_RELATIVE | SBSP_PARENT | SBSP_NAVIGATEBACK | SBSP_NAVIGATEFORWARD))
2334 {
2335 case SBSP_PARENT:
2336 return NavigateToParent();
2337 case SBSP_NAVIGATEBACK:
2338 return GoBack();
2339 case SBSP_NAVIGATEFORWARD:
2340 return GoForward();
2341 }
2342
2343 // TODO: SBSP_WRITENOHISTORY? SBSP_CREATENOHISTORY?
2345 if (fTravelLog)
2347 if (wFlags & SBSP_ACTIVATE_NOFOCUS)
2349 return BrowseToPIDL(pidl, flags);
2350}
2351
2353{
2354 return E_NOTIMPL;
2355}
2356
2358{
2359 if (lphwnd == NULL)
2360 return E_POINTER;
2361 *lphwnd = NULL;
2362 switch (id)
2363 {
2364 case FCW_TOOLBAR:
2365 *lphwnd = fToolbarProxy.m_hWnd;
2366 return S_OK;
2367 case FCW_STATUS:
2368 *lphwnd = fStatusBar;
2369 return S_OK;
2370 case FCW_TREE:
2371 {
2372 BOOL shown;
2373 if (SUCCEEDED(IsControlWindowShown(id, &shown)) && shown)
2374 return IUnknown_GetWindow(fClientBars[BIVerticalBaseBar].clientBar.p, lphwnd);
2375 return S_FALSE;
2376 }
2377 case FCW_PROGRESS:
2378 // is this a progress dialog?
2379 return S_OK;
2380 }
2381 return S_OK;
2382}
2383
2386{
2387 LPARAM result;
2388
2389 if (pret != NULL)
2390 *pret = 0;
2391 switch (id)
2392 {
2393 case FCW_TOOLBAR:
2395 if (pret != NULL)
2396 *pret = result;
2397 break;
2398 case FCW_STATUS:
2400 if (pret != NULL)
2401 *pret = result;
2402 break;
2403 }
2404 return S_OK;
2405}
2406
2408{
2409 if (ppshv == NULL)
2410 return E_POINTER;
2411 *ppshv = fCurrentShellView;
2412 if (fCurrentShellView.p != NULL)
2413 {
2415 return S_OK;
2416 }
2417 return E_FAIL;
2418}
2419
2421{
2422 return E_NOTIMPL;
2423}
2424
2426{
2427 return E_NOTIMPL;
2428}
2429
2431 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2432{
2433 return E_NOTIMPL;
2434}
2435
2437{
2438 return E_NOTIMPL;
2439}
2440
2442{
2443 return E_NOTIMPL;
2444}
2445
2447 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2448{
2449 return E_NOTIMPL;
2450}
2451
2453{
2454 // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2455 // the returned interface has a method GetPropertyBag on it
2456 if (IsEqualIID(guidService, SID_STopLevelBrowser))
2457 return this->QueryInterface(riid, ppvObject);
2458 if (IsEqualIID(guidService, SID_SShellBrowser))
2459 return this->QueryInterface(riid, ppvObject);
2460 if (IsEqualIID(guidService, SID_ITargetFrame2))
2461 return this->QueryInterface(riid, ppvObject);
2462 if (IsEqualIID(guidService, SID_IWebBrowserApp)) // without this, the internet toolbar won't reflect notifications
2463 return this->QueryInterface(riid, ppvObject);
2464 if (IsEqualIID(guidService, SID_SProxyBrowser))
2465 return this->QueryInterface(riid, ppvObject);
2466 if (IsEqualIID(guidService, SID_IExplorerToolbar) && fClientBars[BIInternetToolbar].clientBar.p)
2467 return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2468 if (IsEqualIID(riid, IID_IShellBrowser))
2469 return this->QueryInterface(riid, ppvObject);
2470 return E_NOINTERFACE;
2471}
2472
2474{
2477}
2478
2480{
2481 if (ppvObject == NULL)
2482 return E_POINTER;
2483
2484 *ppvObject = NULL;
2485
2486 LPITEMIDLIST pidl;
2487 HRESULT hr = GetPidl(&pidl);
2489 return E_FAIL;
2490
2491 // FIXME: pidl for Internet etc.
2492
2493 if (_ILIsNetworkPlace(pidl))
2494 flags |= SHGVSPB_ROAM;
2495
2496 hr = SHGetViewStatePropertyBag(pidl, L"Shell", flags, riid, ppvObject);
2497
2498 ILFree(pidl);
2499 return hr;
2500}
2501
2503{
2504 return E_NOTIMPL;
2505}
2506
2508{
2509 return E_NOTIMPL;
2510}
2511
2513 UINT cNames, LCID lcid, DISPID *rgDispId)
2514{
2515 return E_NOTIMPL;
2516}
2517
2519 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2520{
2521 return E_NOTIMPL;
2522}
2523
2525{
2526 return E_NOTIMPL;
2527}
2528
2530{
2531 return E_NOTIMPL;
2532}
2533
2535{
2536 return E_NOTIMPL;
2537}
2538
2540{
2541 return E_NOTIMPL;
2542}
2543
2545{
2546 HRESULT hResult;
2547
2548 // called by toolbar when displaying tooltips
2549 if (pptl == NULL)
2550 return E_FAIL;
2551
2552 *pptl = NULL;
2553 if (fTravelLog.p == NULL)
2554 {
2556 if (FAILED_UNEXPECTEDLY(hResult))
2557 return hResult;
2558 }
2559 *pptl = fTravelLog.p;
2560 fTravelLog.p->AddRef();
2561 return S_OK;
2562}
2563
2565{
2566 BOOL shown;
2567 if (FAILED(IsControlWindowShown(id, &shown)))
2568 return E_NOTIMPL;
2569 else if (!shown == !fShow) // Negated for true boolean comparison
2570 return S_OK;
2571 else switch (id)
2572 {
2573 case FCW_STATUS:
2574 OnToggleStatusBarVisible(0, 0, NULL, shown);
2575 return S_OK;
2576 case FCW_TREE:
2577 return Exec(&CGID_Explorer, SBCMDID_EXPLORERBARFOLDERS, 0, NULL, NULL);
2578 case FCW_ADDRESSBAR:
2580 CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
2581 }
2582 return E_NOTIMPL;
2583}
2584
2586{
2587 HRESULT hr = S_OK;
2588 BOOL shown = FALSE;
2589 switch (id)
2590 {
2591 case FCW_STATUS:
2593 break;
2594 case FCW_TREE:
2595 {
2597 hr = QueryStatus(&CGID_Explorer, 1, &cmd, NULL);
2598 shown = cmd.cmdf & OLECMDF_LATCHED;
2599 break;
2600 }
2601 case FCW_ADDRESSBAR:
2603 shown = hr == S_OK;
2604 break;
2605 default:
2606 hr = E_NOTIMPL;
2607 }
2608 if (pfShown)
2609 {
2610 *pfShown = shown;
2611 return hr;
2612 }
2613 return SUCCEEDED(hr) ? (shown ? S_OK : S_FALSE) : hr;
2614}
2615
2617{
2618 OLECMD cmd = { ITId };
2620 CGID_PrivCITCommands, 1, &cmd, NULL);
2621 return SUCCEEDED(hr) ? (cmd.cmdf & OLECMDF_LATCHED) ? S_OK : S_FALSE : hr;
2622}
2623
2625{
2626 return E_NOTIMPL;
2627}
2628
2630{
2631 return E_NOTIMPL;
2632}
2633
2635{
2636 return E_NOTIMPL;
2637}
2638
2640{
2641 return _NavigateToPidl(pidl, grfHLNF, 0);
2642}
2643
2645{
2646 return E_NOTIMPL;
2647}
2648
2650{
2651 return E_NOTIMPL;
2652}
2653
2655{
2656 return E_NOTIMPL;
2657}
2658
2660{
2661 return E_NOTIMPL;
2662}
2663
2665{
2666 return E_NOTIMPL;
2667}
2668
2670{
2671 m_BrowserSvcFlags = (m_BrowserSvcFlags & ~dwFlagMask) | (dwFlags & dwFlagMask);
2672 return S_OK;
2673}
2674
2676{
2677 *pdwFlags = m_BrowserSvcFlags;
2678 return S_OK;
2679}
2680
2682{
2683 return E_NOTIMPL;
2684}
2685
2687{
2688 // called by explorer bar to get current pidl
2689 return ppidl ? SHILClone(fCurrentDirectoryPIDL, ppidl) : E_POINTER;
2690}
2691
2693{
2694 return E_NOTIMPL;
2695}
2696
2698{
2699 return -1;
2700}
2701
2703{
2704 return E_NOTIMPL;
2705}
2706
2708{
2709 if (ppole == NULL || pstm == NULL || ppbc == NULL)
2710 return E_INVALIDARG;
2711 *ppole = fHistoryObject;
2712 if (fHistoryObject != NULL)
2714 *pstm = fHistoryStream;
2715 if (fHistoryStream != NULL)
2717 *ppbc = fHistoryBindContext;
2723 if (*ppole == NULL)
2724 return E_FAIL;
2725 return S_OK;
2726}
2727
2729{
2730 return E_NOTIMPL;
2731}
2732
2734{
2735 return E_NOTIMPL;
2736}
2737
2739{
2740 return E_NOTIMPL;
2741}
2742
2744 IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2745{
2746 return E_NOTIMPL;
2747}
2748
2750{
2751 return E_NOTIMPL;
2752}
2753
2755{
2756 return E_NOTIMPL;
2757}
2758
2760{
2761 return E_NOTIMPL;
2762}
2763
2765{
2766 HRESULT hr = E_FAIL;
2768 {
2771 }
2772 return hr;
2773}
2774
2776{
2777 return E_NOTIMPL;
2778}
2779
2781{
2782 return E_NOTIMPL;
2783}
2784
2786{
2788 return S_OK;
2789}
2790
2792{
2793 return 0;
2794}
2795
2797{
2798 return E_NOTIMPL;
2799}
2800
2802{
2803 return 0;
2804}
2805
2807{
2808 return E_NOTIMPL;
2809}
2810
2812{
2813 return E_NOTIMPL;
2814}
2815
2817{
2818 return E_NOTIMPL;
2819}
2820
2822{
2823 return E_NOTIMPL;
2824}
2825
2827 IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2828{
2829 return E_NOTIMPL;
2830}
2831
2833{
2834 return E_NOTIMPL;
2835}
2836
2838{
2839 return E_NOTIMPL;
2840}
2841
2843{
2844 return E_NOTIMPL;
2845}
2846
2848{
2849 return NULL;
2850}
2851
2853{
2854 return E_NOTIMPL;
2855}
2856
2858{
2859 m_BrowserSvcFlags |= BSF_TOPBROWSER;
2860 return S_OK;
2861}
2862
2864{
2865 return E_NOTIMPL;
2866}
2867
2869{
2870 return E_NOTIMPL;
2871}
2872
2874{
2875 return E_NOTIMPL;
2876}
2877
2879{
2880 return E_NOTIMPL;
2881}
2882
2884{
2885 return E_NOTIMPL;
2886}
2887
2889{
2890 return E_NOTIMPL;
2891}
2892
2894{
2895 return E_NOTIMPL;
2896}
2897
2899{
2900 return E_NOTIMPL;
2901}
2902
2904{
2905 return E_NOTIMPL;
2906}
2907
2909{
2910 return E_NOTIMPL;
2911}
2912
2914{
2915 return E_NOTIMPL;
2916}
2917
2919{
2920 return E_NOTIMPL;
2921}
2922
2924{
2925 const UINT navflags = HLNF_NAVIGATINGBACK | HLNF_NAVIGATINGFORWARD;
2926 if ((grfHLNF & navflags) && grfHLNF != ~0ul)
2927 {
2928 UINT SbspFlags = (grfHLNF & HLNF_NAVIGATINGBACK) ? SBSP_NAVIGATEBACK : SBSP_NAVIGATEFORWARD;
2929 if (grfHLNF & SHHLNF_WRITENOHISTORY)
2930 SbspFlags |= SBSP_WRITENOHISTORY;
2931 if (grfHLNF & SHHLNF_NOAUTOSELECT)
2932 SbspFlags |= SBSP_NOAUTOSELECT;
2933 return BrowseObject(pidl, SbspFlags);
2934 }
2935 return E_NOTIMPL;
2936}
2937
2939{
2940 return E_NOTIMPL;
2941}
2942
2944{
2945 return E_NOTIMPL;
2946}
2947
2949 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2950{
2951 return E_NOTIMPL;
2952}
2953
2955 HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2956{
2957 return E_NOTIMPL;
2958}
2959
2961{
2962 return E_NOTIMPL;
2963}
2964
2966{
2967 return E_NOTIMPL;
2968}
2969
2971{
2972 return E_NOTIMPL;
2973}
2974
2976{
2977 return 0;
2978}
2979
2981{
2982 return E_NOTIMPL;
2983}
2984
2986{
2987 return E_NOTIMPL;
2988}
2989
2991{
2992 return E_NOTIMPL;
2993}
2994
2996{
2997 return E_NOTIMPL;
2998}
2999
3001{
3002 return E_NOTIMPL;
3003}
3004
3006{
3007 return E_NOTIMPL;
3008}
3009
3011{
3012 return E_NOTIMPL;
3013}
3014
3016{
3017 return NULL;
3018}
3019
3021{
3022 return 0;
3023}
3024
3026{
3027 return E_NOTIMPL;
3028}
3029
3031{
3032 return 0;
3033}
3034
3036{
3037 return NULL;
3038}
3039
3041{
3042 return E_NOTIMPL;
3043}
3044
3046{
3047 return E_NOTIMPL;
3048}
3049
3051{
3052 return E_NOTIMPL;
3053}
3054
3056 LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
3057{
3058 return E_NOTIMPL;
3059}
3060
3062{
3063 return E_NOTIMPL;
3064}
3065
3067{
3068 return 0;
3069}
3070
3072{
3073 return E_NOTIMPL;
3074}
3075
3077{
3078 for (int i = 0; i < 3; i++)
3079 {
3080 if (IUnknown_TranslateAcceleratorIO(fClientBars[i].clientBar, pmsg) == S_OK)
3081 return S_OK;
3082 }
3083
3084 if (!fCurrentShellView)
3085 return S_FALSE;
3086
3087 return fCurrentShellView->TranslateAcceleratorW(pmsg);
3088}
3089
3091{
3092 return E_NOTIMPL;
3093}
3094
3096{
3097 return E_NOTIMPL;
3098}
3099
3101{
3102 CComPtr<ITravelLog> travelLog;
3103 HRESULT hResult = GetTravelLog(&travelLog);
3104 if (FAILED_UNEXPECTEDLY(hResult))
3105 return hResult;
3106 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
3107}
3108
3110{
3111 CComPtr<ITravelLog> travelLog;
3112 HRESULT hResult = GetTravelLog(&travelLog);
3113 if (FAILED_UNEXPECTEDLY(hResult))
3114 return hResult;
3115 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
3116}
3117
3119{
3120 return E_NOTIMPL;
3121}
3122
3124{
3125 return E_NOTIMPL;
3126}
3127
3129 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3130{
3132 HRESULT hResult;
3133 CComPtr<IShellFolder> pDesktop;
3134
3135 hResult = SHGetDesktopFolder(&pDesktop);
3136 if (FAILED_UNEXPECTEDLY(hResult))
3137 return hResult;
3138 hResult = pDesktop->ParseDisplayName(NULL, NULL, URL, NULL, &pidl, NULL);
3139 if (FAILED_UNEXPECTEDLY(hResult))
3140 return hResult;
3141 return BrowseObject(pidl, 1);
3142}
3143
3145{
3146 VARIANT level;
3147
3148 V_VT(&level) = VT_I4;
3149 V_I4(&level) = 4;
3150 return Refresh2(&level);
3151}
3152
3154{
3155 CComPtr<IOleCommandTarget> oleCommandTarget;
3156 HRESULT hResult;
3157
3158 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
3159 if (FAILED_UNEXPECTEDLY(hResult))
3160 return hResult;
3161 return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
3162}
3163
3165{
3166 return E_NOTIMPL;
3167}
3168
3170{
3171 return E_NOTIMPL;
3172}
3173
3175{
3176 return E_NOTIMPL;
3177}
3178
3180{
3181 return E_NOTIMPL;
3182}
3183
3185{
3186 return E_NOTIMPL;
3187}
3188
3190{
3191 return E_NOTIMPL;
3192}
3193
3195{
3196 return E_NOTIMPL;
3197}
3198#ifdef __exdisp_h__
3199#define long LONG
3200#endif
3202{
3203 return E_NOTIMPL;
3204}
3205
3207{
3208 return E_NOTIMPL;
3209}
3210
3212{
3213 return E_NOTIMPL;
3214}
3215
3217{
3218 return E_NOTIMPL;
3219}
3220
3222{
3223 return E_NOTIMPL;
3224}
3225
3227{
3228 return E_NOTIMPL;
3229}
3230
3232{
3233 return E_NOTIMPL;
3234}
3235
3237{
3238 return E_NOTIMPL;
3239}
3240#ifdef __exdisp_h__
3241#undef long
3242#endif
3244{
3245 return E_NOTIMPL;
3246}
3247
3249{
3250 return E_NOTIMPL;
3251}
3252
3254{
3255 return E_NOTIMPL;
3256}
3257
3259{
3260 return E_NOTIMPL;
3261}
3262
3264{
3265 return E_NOTIMPL;
3266}
3267
3269{
3270 return E_NOTIMPL;
3271}
3272
3274{
3275 return E_NOTIMPL;
3276}
3277
3279{
3280 return E_NOTIMPL;
3281}
3282
3284{
3285 return E_NOTIMPL;
3286}
3287
3289{
3290 return E_NOTIMPL;
3291}
3292
3294{
3295 return E_NOTIMPL;
3296}
3297
3299{
3300 return E_NOTIMPL;
3301}
3302
3304{
3305 return E_NOTIMPL;
3306}
3307
3309{
3310 return E_NOTIMPL;
3311}
3312
3314{
3315 return E_NOTIMPL;
3316}
3317
3319{
3320 return E_NOTIMPL;
3321}
3322
3324{
3325 return E_NOTIMPL;
3326}
3327
3329{
3330 return E_NOTIMPL;
3331}
3332
3334{
3335 return E_NOTIMPL;
3336}
3337
3339{
3340 return E_NOTIMPL;
3341}
3342
3344{
3345 return E_NOTIMPL;
3346}
3347
3349{
3350 return E_NOTIMPL;
3351}
3352
3354{
3355 return E_NOTIMPL;
3356}
3357
3359 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3360{
3361 LPITEMIDLIST pidl = NULL;
3362 HRESULT hResult;
3363 // called from drive combo box to navigate to a directory
3364 // Also called by search band to display shell results folder view
3365
3366 if (V_VT(URL) == VT_BSTR)
3367 {
3368 return this->Navigate(V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
3369 }
3370 if (V_VT(URL) == (VT_ARRAY | VT_UI1))
3371 {
3372 if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
3373 return E_INVALIDARG;
3374
3375 pidl = static_cast<LPITEMIDLIST>(V_ARRAY(URL)->pvData);
3376 }
3378 if (FAILED_UNEXPECTEDLY(hResult))
3379 return hResult;
3380 return S_OK;
3381}
3382
3384{
3385 return E_NOTIMPL;
3386}
3387
3389 VARIANT *pvaIn, VARIANT *pvaOut)
3390{
3391 return E_NOTIMPL;
3392}
3393
3395{
3396 CLSID classID;
3397 bool vertical;
3398
3399 // called to show search bar
3400 if (V_VT(pvaClsid) != VT_BSTR)
3401 return E_INVALIDARG;
3402 CLSIDFromString(V_BSTR(pvaClsid), &classID);
3403 // TODO: properly compute the value of vertical
3404 vertical = true;
3405 return ShowBand(classID, vertical);
3406}
3407
3409{
3410 return E_NOTIMPL;
3411}
3412
3414{
3415 return E_NOTIMPL;
3416}
3417
3419{
3420 return E_NOTIMPL;
3421}
3422
3424{
3425 return E_NOTIMPL;
3426}
3427
3429{
3430 return E_NOTIMPL;
3431}
3432
3434{
3435 return E_NOTIMPL;
3436}
3437
3439{
3440 return E_NOTIMPL;
3441}
3442
3444{
3445 return E_NOTIMPL;
3446}
3447
3449{
3450 return E_NOTIMPL;
3451}
3452
3454{
3455 return E_NOTIMPL;
3456}
3457
3459{
3460 return E_NOTIMPL;
3461}
3462
3464{
3465 return E_NOTIMPL;
3466}
3467
3469{
3470 return E_NOTIMPL;
3471}
3472
3474{
3475 return E_NOTIMPL;
3476}
3477
3479{
3480 return E_NOTIMPL;
3481}
3482
3484{
3485 return E_NOTIMPL;
3486}
3487
3489{
3490 if (pWinData == NULL)
3491 return E_POINTER;
3492
3493 pWinData->dwWindowID = -1;
3494 pWinData->uiCP = 0;
3495 pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
3496 pWinData->lpszUrl = NULL;
3497 pWinData->lpszUrlLocation = NULL;
3498 pWinData->lpszTitle = NULL;
3499 return S_OK;
3500}
3501
3503{
3504 return E_NOTIMPL;
3505}
3506
3508{
3509 return E_NOTIMPL;
3510}
3511
3513{
3514 CComPtr<IPersistHistory> viewPersistHistory;
3515 CComPtr<IOleObject> viewHistoryObject;
3516 persistState oldState;
3517 ULONG numRead;
3518 LPITEMIDLIST pidl;
3519 HRESULT hResult;
3520
3521 hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
3522 if (FAILED_UNEXPECTEDLY(hResult))
3523 return hResult;
3524 if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
3525 return E_FAIL;
3526 if (oldState.browseType != 2)
3527 return E_FAIL;
3528 pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
3529 if (pidl == NULL)
3530 return E_OUTOFMEMORY;
3531 hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
3532 if (FAILED_UNEXPECTEDLY(hResult))
3533 {
3534 ILFree(pidl);
3535 return hResult;
3536 }
3537 if (numRead != oldState.pidlSize)
3538 {
3539 ILFree(pidl);
3540 return E_FAIL;
3541 }
3542 hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
3543 IID_PPV_ARG(IOleObject, &viewHistoryObject));
3544 fHistoryObject = viewHistoryObject;
3545 fHistoryStream = pStream;
3546 fHistoryBindContext = pbc;
3547 hResult = BrowseToPIDL(pidl, BTP_DONT_UPDATE_HISTORY);
3551 ILFree(pidl);
3552 if (FAILED_UNEXPECTEDLY(hResult))
3553 return hResult;
3554 return S_OK;
3555}
3556
3558{
3559 CComPtr<IPersistHistory> viewPersistHistory;
3560 persistState newState;
3561 HRESULT hResult;
3562
3563 hResult = fCurrentShellView->GetItemObject(
3564 SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3565 memset(&newState, 0, sizeof(newState));
3566 newState.dwSize = sizeof(newState);
3567 newState.browseType = 2;
3568 newState.browserIndex = GetBrowserIndex();
3569 if (viewPersistHistory.p != NULL)
3570 {
3571 hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3572 if (FAILED_UNEXPECTEDLY(hResult))
3573 return hResult;
3574 }
3576 hResult = pStream->Write(&newState, sizeof(newState), NULL);
3577 if (FAILED_UNEXPECTEDLY(hResult))
3578 return hResult;
3579 hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3580 if (FAILED_UNEXPECTEDLY(hResult))
3581 return hResult;
3582 if (viewPersistHistory.p != NULL)
3583 {
3584 hResult = viewPersistHistory->SaveHistory(pStream);
3585 if (FAILED_UNEXPECTEDLY(hResult))
3586 return hResult;
3587 }
3588 return S_OK;
3589}
3590
3592{
3593 return E_NOTIMPL;
3594}
3595
3597{
3598 return E_NOTIMPL;
3599}
3600
3602{
3603 OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3604 return 0;
3605}
3606
3608{
3609 HRESULT hr;
3610
3611 /* The current thread is about to go down so render any IDataObject that may be left in the clipboard */
3613
3614 // TODO: rip down everything
3615 {
3617
3618 fCurrentShellView->DestroyViewWindow();
3619 fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
3620
3621 for (int i = 0; i < 3; i++)
3622 {
3625 CComPtr<IUnknown> pBarSite;
3627
3628 if (fClientBars[i].clientBar == NULL)
3629 continue;
3630
3631 hr = fClientBars[i].clientBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &pdw));
3633 continue;
3634
3635 /* We should destroy our basebarsite too */
3636 hr = pdw->QueryInterface(IID_PPV_ARG(IDeskBar, &bar));
3637 if (SUCCEEDED(hr))
3638 {
3639 hr = bar->GetClient(&pBarSite);
3640 if (SUCCEEDED(hr) && pBarSite)
3641 {
3642 hr = pBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pClient));
3643 if (SUCCEEDED(hr))
3644 pClient->SetDeskBarSite(NULL);
3645 }
3646 }
3647 pdw->CloseDW(0);
3648
3649 pClient = NULL;
3650 pBarSite = NULL;
3651 pdw = NULL;
3652 bar = NULL;
3653 ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
3654 }
3655 ReleaseCComPtrExpectZero(fCurrentShellView);
3656 ReleaseCComPtrExpectZero(fTravelLog);
3657
3662 }
3663 PostQuitMessage(0);
3664 return 0;
3665}
3666
3668{
3669 CComPtr<IDockingWindow> dockingWindow;
3670 RECT availableBounds;
3671 static const INT excludeItems[] = {1, 1, 1, IDC_STATUSBAR, 0, 0};
3672 HRESULT hResult;
3673
3674 if (wParam != SIZE_MINIMIZED)
3675 {
3676 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3677 for (INT x = 0; x < 3; x++)
3678 {
3679 if (fClientBars[x].clientBar != NULL)
3680 {
3681 hResult = fClientBars[x].clientBar->QueryInterface(
3682 IID_PPV_ARG(IDockingWindow, &dockingWindow));
3683 if (SUCCEEDED(hResult) && dockingWindow != NULL)
3684 {
3685 hResult = dockingWindow->ResizeBorderDW(
3686 &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3687 break;
3688 }
3689 }
3690 }
3692 }
3693 return 1;
3694}
3695
3697{
3698 HMENU theMenu;
3699 LPARAM menuIndex = lParam;
3700
3701 theMenu = reinterpret_cast<HMENU>(wParam);
3702
3704 {
3705 menuIndex = 0;
3706 }
3707 else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_EDIT))
3708 {
3709 menuIndex = 1;
3710 }
3711 else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3712 {
3713 UpdateViewMenu(theMenu);
3714 menuIndex = 2;
3715 }
3717 {
3718 menuIndex = 3;
3719 }
3720 else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_TOOLS))
3721 {
3722 // FIXME: Remove once implemented
3725 menuIndex = 4;
3726 }
3727 else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP))
3728 {
3729 menuIndex = 5;
3730 }
3731
3732 LRESULT ret = RelayMsgToShellView(uMsg, wParam, menuIndex, bHandled);
3733
3734 return ret;
3735}
3736
3738{
3740 return 0;
3741}
3742
3744{
3747 return 0;
3748}
3749
3751{
3754 return 0;
3755}
3756
3757LRESULT CShellBrowser::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
3758{
3759 return SendMessage(