[BROWSEUI]
[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 // create view object
961 hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
962 if (FAILED(hResult))
963 return hResult;
964 previousView = fCurrentShellViewWindow;
965
966 // enter updating section
967 saveCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
968 windowUpdateIsLocked = LockWindowUpdate(TRUE);
969 if (fCurrentShellView != NULL)
970 ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0);
971
972 // set site
973 hResult = newShellView->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
974 if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
975 hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
976
977 // update folder and view
978 saveCurrentShellFolder = fCurrentShellFolder;
979 saveCurrentShellView = fCurrentShellView;
980 fCurrentShellFolder = newShellFolder;
981 fCurrentShellView = newShellView;
982
983 // get boundary
984 if (previousView != NULL)
985 ::GetWindowRect(previousView, &shellViewWindowBounds);
986 else
987 ZeroMemory(&shellViewWindowBounds, sizeof(shellViewWindowBounds));
988 ::MapWindowPoints(0, m_hWnd, reinterpret_cast<POINT *>(&shellViewWindowBounds), 2);
989
990 // create view window
991 hResult = newShellView->CreateViewWindow(saveCurrentShellView, folderSettings,
992 this, &shellViewWindowBounds, &newShellViewWindow);
993 if (FAILED(hResult) || newShellViewWindow == NULL)
994 {
995 fCurrentShellView = saveCurrentShellView;
996 fCurrentShellFolder = saveCurrentShellFolder;
997 ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 1, 0);
998 if (windowUpdateIsLocked)
999 LockWindowUpdate(FALSE);
1000 SetCursor(saveCursor);
1001 return hResult;
1002 }
1003
1004 if (objectWithSite.p != NULL)
1005 hResult = objectWithSite->SetSite(NULL);
1006
1007 // update current pidl
1008 ILFree(fCurrentDirectoryPIDL);
1009 fCurrentDirectoryPIDL = ILClone(absolutePIDL);
1010
1011 // update view window
1012 if (saveCurrentShellView != NULL)
1013 saveCurrentShellView->DestroyViewWindow();
1014 fCurrentShellViewWindow = newShellViewWindow;
1015
1016 // no use
1017 saveCurrentShellView.Release();
1018 saveCurrentShellFolder.Release();
1019
1020 hResult = newShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
1021
1022 // leave updating section
1023 if (windowUpdateIsLocked)
1024 LockWindowUpdate(FALSE);
1025 SetCursor(saveCursor);
1026
1027 // update history
1028 if (flags & BTP_UPDATE_NEXT_HISTORY)
1029 {
1030 hResult = travelLog->AddEntry(static_cast<IDropTarget *>(this), FALSE);
1031 hResult = travelLog->UpdateEntry(static_cast<IDropTarget *>(this), FALSE);
1032 }
1033
1034 // completed
1035 nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1036 hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1037 sizeof(newTitle) / sizeof(wchar_t), NULL);
1038 if (SUCCEEDED(hResult))
1039 {
1040 FireNavigateComplete(newTitle);
1041 }
1042 else
1043 {
1044 FireNavigateComplete(L"ERROR");
1045 }
1046
1047 if (fCabinetState.fFullPathTitle)
1048 nameFlags = SHGDN_FORADDRESSBAR | SHGDN_FORPARSING;
1049 else
1050 nameFlags = SHGDN_FORADDRESSBAR;
1051 hResult = IEGetNameAndFlags(fCurrentDirectoryPIDL, nameFlags, newTitle,
1052 sizeof(newTitle) / sizeof(wchar_t), NULL);
1053 if (SUCCEEDED(hResult))
1054 {
1055 SetWindowText(newTitle);
1056
1057 LPCITEMIDLIST pidlChild;
1058 INT index, indexOpen;
1059 HIMAGELIST himlSmall, himlLarge;
1060
1061 CComPtr<IShellFolder> sf;
1062 SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
1063
1064 index = SHMapPIDLToSystemImageListIndex(sf, pidlChild, &indexOpen);
1065
1066 Shell_GetImageLists(&himlLarge, &himlSmall);
1067
1068 HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
1069 HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
1070
1071 SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
1072 SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge));
1073 }
1074
1075 // TODO: Update the window icon
1076
1077 FireCommandStateChangeAll();
1078 hResult = UpdateForwardBackState();
1079 return S_OK;
1080 }
1081
1082 HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
1083 {
1084 CComPtr<IServiceProvider> serviceProvider;
1085 CComPtr<IBandSite> bandSite;
1086 CComPtr<IDeskBand> deskBand;
1087 HRESULT hResult;
1088
1089 if (fClientBars[BIInternetToolbar].clientBar.p == NULL)
1090 return E_FAIL;
1091 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
1092 IID_PPV_ARG(IServiceProvider, &serviceProvider));
1093 if (FAILED(hResult))
1094 return hResult;
1095 hResult = serviceProvider->QueryService(SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
1096 if (FAILED(hResult))
1097 return hResult;
1098 hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
1099 if (FAILED(hResult))
1100 return hResult;
1101 return deskBand->QueryInterface(riid, shellMenu);
1102 }
1103
1104 HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
1105 {
1106 CComPtr<IUnknown> newBaseBar;
1107 CComPtr<IDeskBar> deskBar;
1108 CComPtr<IUnknown> newBaseBarSite;
1109 CComPtr<IObjectWithSite> objectWithSite;
1110 CComPtr<IDeskBarClient> deskBarClient;
1111 IUnknown **cache;
1112 HRESULT hResult;
1113
1114 if (vertical)
1115 cache = &fClientBars[BIVerticalBaseBar].clientBar.p;
1116 else
1117 cache = &fClientBars[BIHorizontalBaseBar].clientBar.p;
1118 if (*cache == NULL)
1119 {
1120 hResult = CreateBaseBar(IID_PPV_ARG(IUnknown, &newBaseBar));
1121 if (FAILED(hResult))
1122 return hResult;
1123 hResult = CreateBaseBarSite(IID_PPV_ARG(IUnknown, &newBaseBarSite));
1124 if (FAILED(hResult))
1125 return hResult;
1126
1127 // tell the new base bar about the shell browser
1128 hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1129 if (FAILED(hResult))
1130 return hResult;
1131 hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
1132 if (FAILED(hResult))
1133 return hResult;
1134
1135 // tell the new base bar about the new base bar site
1136 hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1137 if (FAILED(hResult))
1138 return hResult;
1139 hResult = deskBar->SetClient(newBaseBarSite);
1140 if (FAILED(hResult))
1141 return hResult;
1142
1143 // tell the new base bar site about the new base bar
1144 hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
1145 if (FAILED(hResult))
1146 return hResult;
1147 hResult = deskBarClient->SetDeskBarSite(newBaseBar);
1148 if (FAILED(hResult))
1149 return hResult;
1150
1151 *cache = newBaseBar.Detach();
1152 }
1153 return (*cache)->QueryInterface(IID_PPV_ARG(IUnknown, theBaseBar));
1154 }
1155
1156 HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
1157 {
1158 CComPtr<IDockingWindow> dockingWindow;
1159 CComPtr<IOleCommandTarget> oleCommandTarget;
1160 CComPtr<IUnknown> baseBarSite;
1161 CComPtr<IUnknown> newBand;
1162 CComPtr<IUnknown> theBaseBar;
1163 CComPtr<IDeskBar> deskBar;
1164 VARIANT vaIn;
1165 HRESULT hResult;
1166
1167 __debugbreak();
1168
1169 hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
1170 if (FAILED(hResult))
1171 return hResult;
1172 hResult = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, &newBand));
1173 if (FAILED(hResult))
1174 return hResult;
1175 hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
1176 if (FAILED(hResult))
1177 return hResult;
1178 hResult = deskBar->GetClient(&baseBarSite);
1179 if (FAILED(hResult))
1180 return hResult;
1181 hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
1182 if (FAILED(hResult))
1183 return hResult;
1184 hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
1185 if (FAILED(hResult))
1186 return hResult;
1187 V_VT(&vaIn) = VT_UNKNOWN;
1188 V_UNKNOWN(&vaIn) = newBand.p;
1189 hResult = oleCommandTarget->Exec(&CGID_IDeskBand, 1, 1, &vaIn, NULL);
1190 if (FAILED(hResult))
1191 return hResult;
1192 hResult = dockingWindow->ShowDW(TRUE);
1193 if (FAILED(hResult))
1194 return hResult;
1195 return S_OK;
1196 }
1197
1198 HRESULT CShellBrowser::NavigateToParent()
1199 {
1200 LPITEMIDLIST newDirectory;
1201 HRESULT hResult;
1202
1203 newDirectory = ILClone(fCurrentDirectoryPIDL);
1204 if (newDirectory == NULL)
1205 return E_OUTOFMEMORY;
1206 ILRemoveLastID(newDirectory);
1207 hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1208 ILFree(newDirectory);
1209 if (FAILED(hResult))
1210 return hResult;
1211 return S_OK;
1212 }
1213
1214 BOOL CALLBACK AddFolderOptionsPage(HPROPSHEETPAGE thePage, LPARAM lParam)
1215 {
1216 PROPSHEETHEADER *sheetInfo;
1217
1218 sheetInfo = (PROPSHEETHEADER *)lParam;
1219 if (sheetInfo->nPages >= folderOptionsPageCountMax)
1220 return FALSE;
1221 sheetInfo->phpage[sheetInfo->nPages] = thePage;
1222 sheetInfo->nPages++;
1223 return TRUE;
1224 }
1225
1226 HRESULT CShellBrowser::DoFolderOptions()
1227 {
1228 CComPtr<IShellPropSheetExt> folderOptionsSheet;
1229 CComPtr<IObjectWithSite> objectWithSite;
1230 PROPSHEETHEADER m_PropSheet;
1231 HPROPSHEETPAGE m_psp[folderOptionsPageCountMax];
1232 // CComPtr<IGlobalFolderSettings> globalSettings;
1233 // SHELLSTATE2 shellState;
1234 HRESULT hResult;
1235
1236 memset(m_psp, 0, sizeof(m_psp));
1237 memset(&m_PropSheet, 0, sizeof(m_PropSheet));
1238
1239 // create sheet object
1240 hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
1241 IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
1242 if (FAILED(hResult))
1243 return E_FAIL;
1244
1245 // must set site in order for Apply to all Folders on Advanced page to be enabled
1246 hResult = folderOptionsSheet->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
1247 if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
1248 hResult = objectWithSite->SetSite(static_cast<IDispatch *>(this));
1249 m_PropSheet.phpage = m_psp;
1250
1251 #if 0
1252 hResult = CoCreateInstance(CLSID_GlobalFolderSettings, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IGlobalFolderSettings, &globalSettings));
1253 if (FAILED(hResult))
1254 return E_FAIL;
1255 hResult = globalSettings->Get(&shellState, sizeof(shellState));
1256 if (FAILED(hResult))
1257 return E_FAIL;
1258 #endif
1259
1260 // add pages
1261 hResult = folderOptionsSheet->AddPages(AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1262 if (FAILED(hResult))
1263 return E_FAIL;
1264
1265 if (fCurrentShellView != NULL)
1266 {
1267 hResult = fCurrentShellView->AddPropertySheetPages(
1268 0, AddFolderOptionsPage, reinterpret_cast<LPARAM>(&m_PropSheet));
1269 if (FAILED(hResult))
1270 return E_FAIL;
1271 }
1272
1273 // show sheet
1274 m_PropSheet.dwSize = sizeof(PROPSHEETHEADER);
1275 m_PropSheet.dwFlags = 0;
1276 m_PropSheet.hwndParent = m_hWnd;
1277 m_PropSheet.hInstance = _AtlBaseModule.GetResourceInstance();
1278 m_PropSheet.pszCaption = _T("Folder Options");
1279 m_PropSheet.nStartPage = 0;
1280 PropertySheet(&m_PropSheet);
1281 return S_OK;
1282 }
1283
1284 LRESULT CALLBACK CShellBrowser::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1285 {
1286 CShellBrowser *pThis = reinterpret_cast<CShellBrowser *>(hWnd);
1287 _ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
1288 LRESULT lResult;
1289 CComPtr<IMenuBand> menuBand;
1290 const _ATL_MSG *previousMessage;
1291 BOOL handled;
1292 WNDPROC saveWindowProc;
1293 HRESULT hResult;
1294
1295 hWnd = pThis->m_hWnd;
1296 previousMessage = pThis->m_pCurrentMsg;
1297 pThis->m_pCurrentMsg = &msg;
1298
1299 hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
1300 if (SUCCEEDED(hResult) && menuBand.p != NULL)
1301 {
1302 hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
1303 if (hResult == S_OK)
1304 return lResult;
1305 uMsg = msg.message;
1306 wParam = msg.wParam;
1307 lParam = msg.lParam;
1308 }
1309
1310 handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
1311 ATLASSERT(pThis->m_pCurrentMsg == &msg);
1312 if (handled == FALSE)
1313 {
1314 if (uMsg == WM_NCDESTROY)
1315 {
1316 saveWindowProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWL_WNDPROC));
1317 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1318 if (saveWindowProc == reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWL_WNDPROC)))
1319 SetWindowLongPtr(hWnd, GWL_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc);
1320 pThis->m_dwState |= WINSTATE_DESTROYED;
1321 }
1322 else
1323 lResult = pThis->DefWindowProc(uMsg, wParam, lParam);
1324 }
1325 pThis->m_pCurrentMsg = previousMessage;
1326 if (previousMessage == NULL && (pThis->m_dwState & WINSTATE_DESTROYED) != 0)
1327 {
1328 pThis->m_dwState &= ~WINSTATE_DESTROYED;
1329 pThis->m_hWnd = NULL;
1330 pThis->OnFinalMessage(hWnd);
1331 }
1332 return lResult;
1333 }
1334
1335 void CShellBrowser::RepositionBars()
1336 {
1337 RECT clientRect;
1338 RECT statusRect;
1339 int x;
1340
1341 GetClientRect(&clientRect);
1342
1343 if (fStatusBarVisible && fStatusBar)
1344 {
1345 ::GetWindowRect(fStatusBar, &statusRect);
1346 ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top),
1347 clientRect.right - clientRect.left,
1348 statusRect.bottom - statusRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1349 clientRect.bottom -= statusRect.bottom - statusRect.top;
1350 }
1351
1352 for (x = 0; x < 3; x++)
1353 {
1354 HWND hwnd = fClientBars[x].hwnd;
1355 RECT borderSpace = fClientBars[x].borderSpace;
1356 if (hwnd == NULL && fClientBars[x].clientBar != NULL)
1357 {
1358 IUnknown_GetWindow(fClientBars[x].clientBar, &hwnd);
1359 fClientBars[x].hwnd = hwnd;
1360 }
1361 if (hwnd != NULL)
1362 {
1363 RECT toolbarRect = clientRect;
1364 if (borderSpace.top != 0)
1365 {
1366 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
1367 }
1368 else if (borderSpace.bottom != 0)
1369 {
1370 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
1371 }
1372 else if (borderSpace.left != 0)
1373 {
1374 toolbarRect.right = toolbarRect.left + borderSpace.left;
1375 }
1376 else if (borderSpace.right != 0)
1377 {
1378 toolbarRect.left = toolbarRect.right - borderSpace.right;
1379 }
1380
1381 ::SetWindowPos(hwnd, NULL,
1382 toolbarRect.left,
1383 toolbarRect.top,
1384 toolbarRect.right - toolbarRect.left,
1385 toolbarRect.bottom - toolbarRect.top,
1386 SWP_NOOWNERZORDER | SWP_NOZORDER);
1387
1388 if (borderSpace.top != 0)
1389 {
1390 clientRect.top = toolbarRect.bottom;
1391 }
1392 else if (borderSpace.bottom != 0)
1393 {
1394 clientRect.bottom = toolbarRect.top;
1395 }
1396 else if (borderSpace.left != 0)
1397 {
1398 clientRect.left = toolbarRect.right;
1399 }
1400 else if (borderSpace.right != 0)
1401 {
1402 clientRect.right = toolbarRect.left;
1403 }
1404 }
1405 }
1406 ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
1407 clientRect.right - clientRect.left,
1408 clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
1409 }
1410
1411 HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arguments)
1412 {
1413 DISPPARAMS params;
1414 CComDynamicUnkArray &vec = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents2>::m_vec;
1415 CComDynamicUnkArray &vec2 = IConnectionPointImpl<CShellBrowser, &DIID_DWebBrowserEvents>::m_vec;
1416 HRESULT hResult;
1417
1418 params.rgvarg = arguments;
1419 params.rgdispidNamedArgs = NULL;
1420 params.cArgs = argCount;
1421 params.cNamedArgs = 0;
1422 IUnknown** pp = vec.begin();
1423 while (pp < vec.end())
1424 {
1425 if (*pp != NULL)
1426 {
1427 CComPtr<IDispatch> theDispatch;
1428
1429 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1430 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1431 }
1432 pp++;
1433 }
1434 pp = vec2.begin();
1435 while (pp < vec2.end())
1436 {
1437 if (*pp != NULL)
1438 {
1439 CComPtr<IDispatch> theDispatch;
1440
1441 hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
1442 hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
1443 }
1444 pp++;
1445 }
1446 return S_OK;
1447 }
1448
1449 HRESULT CShellBrowser::FireNavigateComplete(const wchar_t *newDirectory)
1450 {
1451 // these two variants intentionally to do use CComVariant because it would double free/release
1452 // or does not need to dispose at all
1453 VARIANT varArg[2];
1454 VARIANT varArgs;
1455 CComBSTR tempString(newDirectory);
1456
1457 V_VT(&varArgs) = VT_BSTR;
1458 V_BSTR(&varArgs) = tempString.m_str;
1459
1460 V_VT(&varArg[0]) = VT_VARIANT | VT_BYREF;
1461 V_VARIANTREF(&varArg[0]) = &varArgs;
1462 V_VT(&varArg[1]) = VT_DISPATCH;
1463 V_DISPATCH(&varArg[1]) = (IDispatch *)this;
1464
1465 return FireEvent(DISPID_NAVIGATECOMPLETE2, 2, varArg);
1466 }
1467
1468 HRESULT CShellBrowser::FireCommandStateChange(bool newState, int commandID)
1469 {
1470 VARIANT varArg[2];
1471
1472 V_VT(&varArg[0]) = VT_BOOL;
1473 V_BOOL(&varArg[0]) = newState ? VARIANT_TRUE : VARIANT_FALSE;
1474 V_VT(&varArg[1]) = VT_I4;
1475 V_I4(&varArg[1]) = commandID;
1476
1477 return FireEvent(DISPID_COMMANDSTATECHANGE, 2, varArg);
1478 }
1479
1480 HRESULT CShellBrowser::FireCommandStateChangeAll()
1481 {
1482 return FireCommandStateChange(false, -1);
1483 }
1484
1485 HRESULT CShellBrowser::UpdateForwardBackState()
1486 {
1487 CComPtr<ITravelLog> travelLog;
1488 CComPtr<ITravelEntry> unusedEntry;
1489 bool canGoBack;
1490 bool canGoForward;
1491 HRESULT hResult;
1492
1493 canGoBack = false;
1494 canGoForward = false;
1495 hResult = GetTravelLog(&travelLog);
1496 if (FAILED(hResult))
1497 return hResult;
1498 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
1499 if (SUCCEEDED(hResult))
1500 {
1501 canGoBack = true;
1502 unusedEntry.Release();
1503 }
1504 hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
1505 if (SUCCEEDED(hResult))
1506 {
1507 canGoForward = true;
1508 unusedEntry.Release();
1509 }
1510 hResult = FireCommandStateChange(canGoBack, 2);
1511 hResult = FireCommandStateChange(canGoForward, 1);
1512 return S_OK;
1513 }
1514
1515 void CShellBrowser::UpdateGotoMenu(HMENU theMenu)
1516 {
1517 CComPtr<ITravelLog> travelLog;
1518 int position;
1519 MENUITEMINFO menuItemInfo;
1520 HRESULT hResult;
1521
1522 DeleteMenuItems(theMenu, IDM_GOTO_TRAVEL_FIRST, IDM_GOTO_TRAVEL_LAST);
1523
1524 position = GetMenuItemCount(theMenu);
1525 hResult = GetTravelLog(&travelLog);
1526 if (FAILED(hResult))
1527 return;
1528 hResult = travelLog->InsertMenuEntries(static_cast<IDropTarget *>(this), theMenu, position,
1529 IDM_GOTO_TRAVEL_FIRSTTARGET, IDM_GOTO_TRAVEL_LASTTARGET, TLMENUF_BACKANDFORTH | TLMENUF_CHECKCURRENT);
1530 if (SUCCEEDED(hResult))
1531 {
1532 menuItemInfo.cbSize = sizeof(menuItemInfo);
1533 menuItemInfo.fMask = MIIM_TYPE | MIIM_ID;
1534 menuItemInfo.fType = MF_SEPARATOR;
1535 menuItemInfo.wID = IDM_GOTO_TRAVEL_SEP;
1536 InsertMenuItem(theMenu, position, TRUE, &menuItemInfo);
1537 }
1538 }
1539
1540 void CShellBrowser::UpdateViewMenu(HMENU theMenu)
1541 {
1542 CComPtr<IOleCommandTarget> oleCommandTarget;
1543 CComPtr<ITravelLog> travelLog;
1544 HMENU gotoMenu;
1545 OLECMD commandList[5];
1546 HMENU toolbarMenuBar;
1547 HMENU toolbarMenu;
1548 MENUITEMINFO menuItemInfo;
1549 HRESULT hResult;
1550
1551 gotoMenu = SHGetMenuFromID(theMenu, FCIDM_MENU_EXPLORE);
1552 if (gotoMenu != NULL)
1553 UpdateGotoMenu(gotoMenu);
1554
1555 commandList[0].cmdID = ITID_TOOLBARBANDSHOWN;
1556 commandList[1].cmdID = ITID_ADDRESSBANDSHOWN;
1557 commandList[2].cmdID = ITID_LINKSBANDSHOWN;
1558 commandList[3].cmdID = ITID_TOOLBARLOCKED;
1559 commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
1560
1561 hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
1562 IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
1563 if (SUCCEEDED(hResult))
1564 hResult = oleCommandTarget->QueryStatus(&CGID_PrivCITCommands, 5, commandList, NULL);
1565 if (FAILED(hResult))
1566 DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND);
1567 else
1568 {
1569 toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU));
1570 toolbarMenu = GetSubMenu(toolbarMenuBar, 0);
1571
1572 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf);
1573 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED);
1574 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LINKSBAR, commandList[2].cmdf & OLECMDF_ENABLED);
1575 SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_LOCKTOOLBARS, commandList[3].cmdf & OLECMDF_ENABLED);
1576 if ((commandList[4].cmdf & OLECMDF_ENABLED) == 0)
1577 DeleteMenu(toolbarMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
1578 DeleteMenu(toolbarMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
1579 DeleteMenu(toolbarMenu, IDM_TOOLBARS_GOBUTTON, MF_BYCOMMAND);
1580
1581 menuItemInfo.cbSize = sizeof(menuItemInfo);
1582 menuItemInfo.fMask = MIIM_SUBMENU;
1583 menuItemInfo.hSubMenu = toolbarMenu;
1584 SetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo);
1585 }
1586 SHCheckMenuItem(theMenu, IDM_VIEW_STATUSBAR, fStatusBarVisible ? TRUE : FALSE);
1587 }
1588
1589 bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
1590 {
1591 CComPtr<IUnknown> int1Retry;
1592 CComPtr<IUnknown> int2Retry;
1593 HRESULT hResult;
1594
1595 if (int1 == int2)
1596 return true;
1597 if (int1 == NULL || int2 == NULL)
1598 return false;
1599 hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
1600 if (FAILED(hResult))
1601 return false;
1602 hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
1603 if (FAILED(hResult))
1604 return false;
1605 if (int1Retry == int2Retry)
1606 return true;
1607 return false;
1608 }
1609
1610 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
1611 {
1612 static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
1613
1614 RECT availableBounds;
1615
1616 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
1617 for (INT x = 0; x < 3; x++)
1618 {
1619 if (fClientBars[x].clientBar.p != NULL && !IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1620 {
1621 availableBounds.top += fClientBars[x].borderSpace.top;
1622 availableBounds.left += fClientBars[x].borderSpace.left;
1623 availableBounds.bottom -= fClientBars[x].borderSpace.bottom;
1624 availableBounds.right -= fClientBars[x].borderSpace.right;
1625 }
1626 }
1627 *prcBorder = availableBounds;
1628 return S_OK;
1629 }
1630
1631 HRESULT STDMETHODCALLTYPE CShellBrowser::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1632 {
1633 return S_OK;
1634 }
1635
1636 HRESULT STDMETHODCALLTYPE CShellBrowser::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
1637 {
1638 for (INT x = 0; x < 3; x++)
1639 {
1640 if (IUnknownIsEqual(fClientBars[x].clientBar, punkObj))
1641 {
1642 fClientBars[x].borderSpace = *pbw;
1643 // if this bar changed size, it cascades and forces all subsequent bars to resize
1644 RepositionBars();
1645 return S_OK;
1646 }
1647 }
1648 return E_INVALIDARG;
1649 }
1650
1651 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
1652 ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
1653 {
1654 CComPtr<IOleCommandTarget> commandTarget;
1655 HRESULT hResult;
1656
1657 if (prgCmds == NULL)
1658 return E_INVALIDARG;
1659 if (pguidCmdGroup == NULL)
1660 {
1661 if (fCurrentShellView.p != NULL)
1662 {
1663 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
1664 if (SUCCEEDED(hResult) && commandTarget.p != NULL)
1665 return commandTarget->QueryStatus(NULL, 1, prgCmds, pCmdText);
1666 }
1667 while (cCmds != 0)
1668 {
1669 prgCmds->cmdf = 0;
1670 prgCmds++;
1671 cCmds--;
1672 }
1673 }
1674 else if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1675 {
1676 while (cCmds != 0)
1677 {
1678 switch (prgCmds->cmdID)
1679 {
1680 case 0x1c: // search
1681 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1682 break;
1683 case 0x1d: // history
1684 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1685 break;
1686 case 0x1e: // favorites
1687 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
1688 break;
1689 case 0x23: // folders
1690 prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED | OLECMDF_LATCHED;
1691 break;
1692 default:
1693 prgCmds->cmdf = 0;
1694 break;
1695 }
1696 prgCmds++;
1697 cCmds--;
1698 }
1699 }
1700 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1701 {
1702 while (cCmds != 0)
1703 {
1704 switch (prgCmds->cmdID)
1705 {
1706 case 0xa022: // up level
1707 prgCmds->cmdf = OLECMDF_SUPPORTED;
1708 if (fCurrentDirectoryPIDL->mkid.cb != 0)
1709 prgCmds->cmdf |= OLECMDF_ENABLED;
1710 break;
1711 }
1712 prgCmds++;
1713 cCmds--;
1714 }
1715 }
1716 return S_OK;
1717 }
1718
1719 HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID,
1720 DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
1721 {
1722 HRESULT hResult;
1723
1724 if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
1725 {
1726 switch (nCmdID)
1727 {
1728 case 0x23:
1729 hResult = ShowBand(CLSID_ExplorerBand, true);
1730 return S_OK;
1731 case 0x27:
1732 if (nCmdexecopt == 1)
1733 {
1734 // pvaIn is a VT_UNKNOWN with a band that is being hidden
1735 }
1736 else
1737 {
1738 // update zones part of the status bar
1739 }
1740 return S_OK;
1741 case 0x35: // don't do this, and the internet toolbar doesn't create a menu band
1742 V_VT(pvaOut) = VT_INT_PTR;
1743 V_INTREF(pvaOut) = reinterpret_cast<INT *>(
1744 LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU)));
1745 return S_OK;
1746 case 0x38:
1747 // indicate if this cabinet was opened as a browser
1748 return S_FALSE;
1749 default:
1750 return E_NOTIMPL;
1751 }
1752 }
1753 else if (IsEqualIID(*pguidCmdGroup, CGID_InternetButtons))
1754 {
1755 switch (nCmdID)
1756 {
1757 case 0x23:
1758 // placeholder
1759 return S_OK;
1760 }
1761 }
1762 else if (IsEqualIID(*pguidCmdGroup, CGID_Theater))
1763 {
1764 switch (nCmdID)
1765 {
1766 case 6:
1767 // what is theater mode and why do we receive this?
1768 return E_NOTIMPL;
1769 }
1770 }
1771 else if (IsEqualIID(*pguidCmdGroup, CGID_MenuBand))
1772 {
1773 switch (nCmdID)
1774 {
1775 case 14:
1776 // initialize favorites menu
1777 return S_OK;
1778 }
1779 }
1780 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellDocView))
1781 {
1782 switch (nCmdID)
1783 {
1784 case 0x12:
1785 // refresh on toolbar clicked
1786 return S_OK;
1787 case 0x4d:
1788 // tell the view if it should hide the task pane or not
1789 return (fClientBars[BIVerticalBaseBar].clientBar.p == NULL) ? S_FALSE : S_OK;
1790 }
1791 }
1792 else if (IsEqualIID(*pguidCmdGroup, CGID_ShellBrowser))
1793 {
1794 switch (nCmdID)
1795 {
1796 case 40994:
1797 return NavigateToParent();
1798 }
1799 }
1800 else if (IsEqualIID(*pguidCmdGroup, CGID_IExplorerToolbar))
1801 {
1802 switch (nCmdID)
1803 {
1804 case 0x7063:
1805 return DoFolderOptions();
1806 }
1807 }
1808 else if (IsEqualIID(*pguidCmdGroup, CGID_DefView))
1809 {
1810 switch (nCmdID)
1811 {
1812 case 1:
1813 // Reset All Folders option in Folder Options
1814 break;
1815 }
1816 }
1817 else
1818 {
1819 return E_NOTIMPL;
1820 }
1821 return E_NOTIMPL;
1822 }
1823
1824 HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindow(HWND *lphwnd)
1825 {
1826 if (lphwnd == NULL)
1827 return E_POINTER;
1828 *lphwnd = m_hWnd;
1829 return S_OK;
1830 }
1831
1832 HRESULT STDMETHODCALLTYPE CShellBrowser::ContextSensitiveHelp(BOOL fEnterMode)
1833 {
1834 return E_NOTIMPL;
1835 }
1836
1837 HRESULT STDMETHODCALLTYPE CShellBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
1838 {
1839 HMENU mainMenu = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_MAINMENU));
1840 Shell_MergeMenus(hmenuShared, mainMenu, 0, 0, FCIDM_BROWSERLAST, MM_SUBMENUSHAVEIDS);
1841
1842 int GCCU(itemCount3) = GetMenuItemCount(hmenuShared);
1843 Unused(itemCount3);
1844
1845 lpMenuWidths->width[0] = 2;
1846 lpMenuWidths->width[2] = 3;
1847 lpMenuWidths->width[4] = 1;
1848 return S_OK;
1849 }
1850
1851 HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
1852 {
1853 CComPtr<IShellMenu> shellMenu;
1854 HRESULT hResult;
1855
1856 if (IsMenu(hmenuShared) == FALSE)
1857 return E_FAIL;
1858 hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
1859 if (FAILED(hResult))
1860 return hResult;
1861 hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
1862 if (FAILED(hResult))
1863 return hResult;
1864 fCurrentMenuBar = hmenuShared;
1865 return S_OK;
1866 }
1867
1868 HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
1869 {
1870 if (hmenuShared == fCurrentMenuBar)
1871 fCurrentMenuBar = NULL;
1872 return S_OK;
1873 }
1874
1875 HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
1876 {
1877 //
1878 if (pszStatusText)
1879 {
1880 ::SetWindowText(fStatusBar, pszStatusText);
1881 }
1882 else
1883 {
1884
1885 }
1886 return E_NOTIMPL;
1887 }
1888
1889 HRESULT STDMETHODCALLTYPE CShellBrowser::EnableModelessSB(BOOL fEnable)
1890 {
1891 return E_NOTIMPL;
1892 }
1893
1894 HRESULT STDMETHODCALLTYPE CShellBrowser::TranslateAcceleratorSB(MSG *pmsg, WORD wID)
1895 {
1896 if (!::TranslateAcceleratorW(m_hWnd, m_hAccel, pmsg))
1897 return S_FALSE;
1898 return S_OK;
1899 }
1900
1901 HRESULT STDMETHODCALLTYPE CShellBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
1902 {
1903 return BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
1904 }
1905
1906 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
1907 {
1908 return E_NOTIMPL;
1909 }
1910
1911 HRESULT STDMETHODCALLTYPE CShellBrowser::GetControlWindow(UINT id, HWND *lphwnd)
1912 {
1913 if (lphwnd == NULL)
1914 return E_POINTER;
1915 *lphwnd = NULL;
1916 switch(id)
1917 {
1918 case FCW_TOOLBAR:
1919 *lphwnd = fToolbarProxy.m_hWnd;
1920 return S_OK;
1921 case FCW_STATUS:
1922 *lphwnd = fStatusBar;
1923 return S_OK;
1924 case FCW_TREE:
1925 // find the directory browser and return it
1926 // this should be used only to determine if a tree is present
1927 return S_OK;
1928 case FCW_PROGRESS:
1929 // is this a progress dialog?
1930 return S_OK;
1931 }
1932 return S_OK;
1933 }
1934
1935 HRESULT STDMETHODCALLTYPE CShellBrowser::SendControlMsg(
1936 UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
1937 {
1938 LPARAM result;
1939
1940 if (pret != NULL)
1941 *pret = 0;
1942 switch(id)
1943 {
1944 case FCW_TOOLBAR:
1945 result = fToolbarProxy.SendMessage(uMsg, wParam, lParam);
1946 if (pret != NULL)
1947 *pret = result;
1948 break;
1949 case FCW_STATUS:
1950 result = SendMessage(fStatusBar, uMsg, wParam, lParam);
1951 if (pret != NULL)
1952 *pret = result;
1953 break;
1954 }
1955 return S_OK;
1956 }
1957
1958 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryActiveShellView(IShellView **ppshv)
1959 {
1960 if (ppshv == NULL)
1961 return E_POINTER;
1962 *ppshv = fCurrentShellView;
1963 if (fCurrentShellView.p != NULL)
1964 fCurrentShellView.p->AddRef();
1965 return S_OK;
1966 }
1967
1968 HRESULT STDMETHODCALLTYPE CShellBrowser::OnViewWindowActive(IShellView *ppshv)
1969 {
1970 return E_NOTIMPL;
1971 }
1972
1973 HRESULT STDMETHODCALLTYPE CShellBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
1974 {
1975 return E_NOTIMPL;
1976 }
1977
1978 HRESULT STDMETHODCALLTYPE CShellBrowser::DragEnter(
1979 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
1980 {
1981 return E_NOTIMPL;
1982 }
1983
1984 HRESULT STDMETHODCALLTYPE CShellBrowser::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
1985 {
1986 return E_NOTIMPL;
1987 }
1988
1989 HRESULT STDMETHODCALLTYPE CShellBrowser::DragLeave()
1990 {
1991 return E_NOTIMPL;
1992 }
1993
1994 HRESULT STDMETHODCALLTYPE CShellBrowser::Drop(
1995 IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
1996 {
1997 return E_NOTIMPL;
1998 }
1999
2000 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
2001 {
2002 // view does a query for SID_STopLevelBrowser, IID_IShellBrowserService
2003 // the returned interface has a method GetPropertyBag on it
2004 if (IsEqualIID(guidService, SID_STopLevelBrowser))
2005 return this->QueryInterface(riid, ppvObject);
2006 if (IsEqualIID(guidService, SID_SShellBrowser))
2007 return this->QueryInterface(riid, ppvObject);
2008 if (IsEqualIID(guidService, SID_ITargetFrame2))
2009 return this->QueryInterface(riid, ppvObject);
2010 if (IsEqualIID(guidService, SID_IWebBrowserApp)) // without this, the internet toolbar won't reflect notifications
2011 return this->QueryInterface(riid, ppvObject);
2012 if (IsEqualIID(guidService, SID_SProxyBrowser))
2013 return this->QueryInterface(riid, ppvObject);
2014 if (IsEqualIID(guidService, SID_IExplorerToolbar))
2015 return fClientBars[BIInternetToolbar].clientBar->QueryInterface(riid, ppvObject);
2016 if (IsEqualIID(riid, IID_IShellBrowser))
2017 return this->QueryInterface(riid, ppvObject);
2018 return E_NOINTERFACE;
2019 }
2020
2021 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPropertyBag(long flags, REFIID riid, void **ppvObject)
2022 {
2023 if (ppvObject == NULL)
2024 return E_POINTER;
2025 *ppvObject = NULL;
2026 return E_NOTIMPL;
2027 }
2028
2029 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfoCount(UINT *pctinfo)
2030 {
2031 return E_NOTIMPL;
2032 }
2033
2034 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
2035 {
2036 return E_NOTIMPL;
2037 }
2038
2039 HRESULT STDMETHODCALLTYPE CShellBrowser::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
2040 UINT cNames, LCID lcid, DISPID *rgDispId)
2041 {
2042 return E_NOTIMPL;
2043 }
2044
2045 HRESULT STDMETHODCALLTYPE CShellBrowser::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
2046 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2047 {
2048 return E_NOTIMPL;
2049 }
2050
2051 HRESULT STDMETHODCALLTYPE CShellBrowser::GetParentSite(IOleInPlaceSite **ppipsite)
2052 {
2053 return E_NOTIMPL;
2054 }
2055
2056 HRESULT STDMETHODCALLTYPE CShellBrowser::SetTitle(IShellView *psv, LPCWSTR pszName)
2057 {
2058 return E_NOTIMPL;
2059 }
2060
2061 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName)
2062 {
2063 return E_NOTIMPL;
2064 }
2065
2066 HRESULT STDMETHODCALLTYPE CShellBrowser::GetOleObject(IOleObject **ppobjv)
2067 {
2068 return E_NOTIMPL;
2069 }
2070
2071 HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
2072 {
2073 HRESULT hResult;
2074
2075 // called by toolbar when displaying tooltips
2076 if (pptl == NULL)
2077 return E_FAIL;
2078
2079 *pptl = NULL;
2080 if (fTravelLog.p == NULL)
2081 {
2082 hResult = CreateTravelLog(IID_PPV_ARG(ITravelLog, &fTravelLog));
2083 if (FAILED(hResult))
2084 return hResult;
2085 }
2086 *pptl = fTravelLog.p;
2087 fTravelLog.p->AddRef();
2088 return S_OK;
2089 }
2090
2091 HRESULT STDMETHODCALLTYPE CShellBrowser::ShowControlWindow(UINT id, BOOL fShow)
2092 {
2093 return E_NOTIMPL;
2094 }
2095
2096 HRESULT STDMETHODCALLTYPE CShellBrowser::IsControlWindowShown(UINT id, BOOL *pfShown)
2097 {
2098 return E_NOTIMPL;
2099 }
2100
2101 HRESULT STDMETHODCALLTYPE CShellBrowser::IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
2102 {
2103 return E_NOTIMPL;
2104 }
2105
2106 HRESULT STDMETHODCALLTYPE CShellBrowser::IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut)
2107 {
2108 return E_NOTIMPL;
2109 }
2110
2111 HRESULT STDMETHODCALLTYPE CShellBrowser::DisplayParseError(HRESULT hres, LPCWSTR pwszPath)
2112 {
2113 return E_NOTIMPL;
2114 }
2115
2116 HRESULT STDMETHODCALLTYPE CShellBrowser::NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF)
2117 {
2118 return E_NOTIMPL;
2119 }
2120
2121 HRESULT STDMETHODCALLTYPE CShellBrowser::SetNavigateState(BNSTATE bnstate)
2122 {
2123 return E_NOTIMPL;
2124 }
2125
2126 HRESULT STDMETHODCALLTYPE CShellBrowser::GetNavigateState(BNSTATE *pbnstate)
2127 {
2128 return E_NOTIMPL;
2129 }
2130
2131 HRESULT STDMETHODCALLTYPE CShellBrowser::NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse)
2132 {
2133 return E_NOTIMPL;
2134 }
2135
2136 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateWindowList()
2137 {
2138 return E_NOTIMPL;
2139 }
2140
2141 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateBackForwardState()
2142 {
2143 return E_NOTIMPL;
2144 }
2145
2146 HRESULT STDMETHODCALLTYPE CShellBrowser::SetFlags(DWORD dwFlags, DWORD dwFlagMask)
2147 {
2148 return E_NOTIMPL;
2149 }
2150
2151 HRESULT STDMETHODCALLTYPE CShellBrowser::GetFlags(DWORD *pdwFlags)
2152 {
2153 return E_NOTIMPL;
2154 }
2155
2156 HRESULT STDMETHODCALLTYPE CShellBrowser::CanNavigateNow()
2157 {
2158 return E_NOTIMPL;
2159 }
2160
2161 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPidl(LPITEMIDLIST *ppidl)
2162 {
2163 // called by explorer bar to get current pidl
2164 if (ppidl == NULL)
2165 return E_POINTER;
2166 *ppidl = ILClone(fCurrentDirectoryPIDL);
2167 return S_OK;
2168 }
2169
2170 HRESULT STDMETHODCALLTYPE CShellBrowser::SetReferrer(LPCITEMIDLIST pidl)
2171 {
2172 return E_NOTIMPL;
2173 }
2174
2175 DWORD STDMETHODCALLTYPE CShellBrowser::GetBrowserIndex()
2176 {
2177 return -1;
2178 }
2179
2180 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
2181 {
2182 return E_NOTIMPL;
2183 }
2184
2185 HRESULT STDMETHODCALLTYPE CShellBrowser::GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc)
2186 {
2187 if (ppole == NULL || pstm == NULL || ppbc == NULL)
2188 return E_INVALIDARG;
2189 *ppole = fHistoryObject;
2190 if (fHistoryObject != NULL)
2191 fHistoryObject->AddRef();
2192 *pstm = fHistoryStream;
2193 if (fHistoryStream != NULL)
2194 fHistoryStream->AddRef();
2195 *ppbc = fHistoryBindContext;
2196 if (fHistoryBindContext != NULL)
2197 fHistoryBindContext->AddRef();
2198 fHistoryObject = NULL;
2199 fHistoryStream = NULL;
2200 fHistoryBindContext = NULL;
2201 if (*ppole == NULL)
2202 return E_FAIL;
2203 return S_OK;
2204 }
2205
2206 HRESULT STDMETHODCALLTYPE CShellBrowser::SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor)
2207 {
2208 return E_NOTIMPL;
2209 }
2210
2211 HRESULT STDMETHODCALLTYPE CShellBrowser::CacheOLEServer(IOleObject *pole)
2212 {
2213 return E_NOTIMPL;
2214 }
2215
2216 HRESULT STDMETHODCALLTYPE CShellBrowser::GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut)
2217 {
2218 return E_NOTIMPL;
2219 }
2220
2221 HRESULT STDMETHODCALLTYPE CShellBrowser::OnHttpEquiv(
2222 IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
2223 {
2224 return E_NOTIMPL;
2225 }
2226
2227 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPalette(HPALETTE *hpal)
2228 {
2229 return E_NOTIMPL;
2230 }
2231
2232 HRESULT STDMETHODCALLTYPE CShellBrowser::RegisterWindow(BOOL fForceRegister, int swc)
2233 {
2234 return E_NOTIMPL;
2235 }
2236
2237 LRESULT STDMETHODCALLTYPE CShellBrowser::WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
2238 {
2239 return E_NOTIMPL;
2240 }
2241
2242 HRESULT STDMETHODCALLTYPE CShellBrowser::SetAsDefFolderSettings()
2243 {
2244 return E_NOTIMPL;
2245 }
2246
2247 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewRect(RECT *prc)
2248 {
2249 return E_NOTIMPL;
2250 }
2251
2252 HRESULT STDMETHODCALLTYPE CShellBrowser::OnSize(WPARAM wParam)
2253 {
2254 return E_NOTIMPL;
2255 }
2256
2257 HRESULT STDMETHODCALLTYPE CShellBrowser::OnCreate(struct tagCREATESTRUCTW *pcs)
2258 {
2259 m_hAccel = LoadAcceleratorsW(GetModuleHandle(L"browseui.dll"), MAKEINTRESOURCEW(256));
2260 return S_OK;
2261 }
2262
2263 LRESULT STDMETHODCALLTYPE CShellBrowser::OnCommand(WPARAM wParam, LPARAM lParam)
2264 {
2265 return 0;
2266 }
2267
2268 HRESULT STDMETHODCALLTYPE CShellBrowser::OnDestroy()
2269 {
2270 return E_NOTIMPL;
2271 }
2272
2273 LRESULT STDMETHODCALLTYPE CShellBrowser::OnNotify(struct tagNMHDR *pnm)
2274 {
2275 return 0;
2276 }
2277
2278 HRESULT STDMETHODCALLTYPE CShellBrowser::OnSetFocus()
2279 {
2280 return E_NOTIMPL;
2281 }
2282
2283 HRESULT STDMETHODCALLTYPE CShellBrowser::OnFrameWindowActivateBS(BOOL fActive)
2284 {
2285 return E_NOTIMPL;
2286 }
2287
2288 HRESULT STDMETHODCALLTYPE CShellBrowser::ReleaseShellView()
2289 {
2290 return E_NOTIMPL;
2291 }
2292
2293 HRESULT STDMETHODCALLTYPE CShellBrowser::ActivatePendingView()
2294 {
2295 return E_NOTIMPL;
2296 }
2297
2298 HRESULT STDMETHODCALLTYPE CShellBrowser::CreateViewWindow(
2299 IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
2300 {
2301 return E_NOTIMPL;
2302 }
2303
2304 HRESULT STDMETHODCALLTYPE CShellBrowser::CreateBrowserPropSheetExt(REFIID riid, void **ppv)
2305 {
2306 return E_NOTIMPL;
2307 }
2308
2309 HRESULT STDMETHODCALLTYPE CShellBrowser::GetViewWindow(HWND *phwndView)
2310 {
2311 return E_NOTIMPL;
2312 }
2313
2314 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd)
2315 {
2316 return E_NOTIMPL;
2317 }
2318
2319 LPBASEBROWSERDATA STDMETHODCALLTYPE CShellBrowser::PutBaseBrowserData()
2320 {
2321 return NULL;
2322 }
2323
2324 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTravelLog(ITravelLog *ptl, DWORD dw)
2325 {
2326 return E_NOTIMPL;
2327 }
2328
2329 HRESULT STDMETHODCALLTYPE CShellBrowser::SetTopBrowser()
2330 {
2331 return E_NOTIMPL;
2332 }
2333
2334 HRESULT STDMETHODCALLTYPE CShellBrowser::Offline(int iCmd)
2335 {
2336 return E_NOTIMPL;
2337 }
2338
2339 HRESULT STDMETHODCALLTYPE CShellBrowser::AllowViewResize(BOOL f)
2340 {
2341 return E_NOTIMPL;
2342 }
2343
2344 HRESULT STDMETHODCALLTYPE CShellBrowser::SetActivateState(UINT u)
2345 {
2346 return E_NOTIMPL;
2347 }
2348
2349 HRESULT STDMETHODCALLTYPE CShellBrowser::UpdateSecureLockIcon(int eSecureLock)
2350 {
2351 return E_NOTIMPL;
2352 }
2353
2354 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeDownloadManager()
2355 {
2356 return E_NOTIMPL;
2357 }
2358
2359 HRESULT STDMETHODCALLTYPE CShellBrowser::InitializeTransitionSite()
2360 {
2361 return E_NOTIMPL;
2362 }
2363
2364 HRESULT STDMETHODCALLTYPE CShellBrowser::_Initialize(HWND hwnd, IUnknown *pauto)
2365 {
2366 return E_NOTIMPL;
2367 }
2368
2369 HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingNavigationAsync()
2370 {
2371 return E_NOTIMPL;
2372 }
2373
2374 HRESULT STDMETHODCALLTYPE CShellBrowser::_CancelPendingView()
2375 {
2376 return E_NOTIMPL;
2377 }
2378
2379 HRESULT STDMETHODCALLTYPE CShellBrowser::_MaySaveChanges()
2380 {
2381 return E_NOTIMPL;
2382 }
2383
2384 HRESULT STDMETHODCALLTYPE CShellBrowser::_PauseOrResumeView(BOOL fPaused)
2385 {
2386 return E_NOTIMPL;
2387 }
2388
2389 HRESULT STDMETHODCALLTYPE CShellBrowser::_DisableModeless()
2390 {
2391 return E_NOTIMPL;
2392 }
2393
2394 HRESULT STDMETHODCALLTYPE CShellBrowser::_NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags)
2395 {
2396 return E_NOTIMPL;
2397 }
2398
2399 HRESULT STDMETHODCALLTYPE CShellBrowser::_TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew)
2400 {
2401 return E_NOTIMPL;
2402 }
2403
2404 HRESULT STDMETHODCALLTYPE CShellBrowser::_SwitchActivationNow()
2405 {
2406 return E_NOTIMPL;
2407 }
2408
2409 HRESULT STDMETHODCALLTYPE CShellBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
2410 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
2411 {
2412 return E_NOTIMPL;
2413 }
2414
2415 HRESULT STDMETHODCALLTYPE CShellBrowser::_SendChildren(
2416 HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
2417 {
2418 return E_NOTIMPL;
2419 }
2420
2421 HRESULT STDMETHODCALLTYPE CShellBrowser::GetFolderSetData(struct tagFolderSetData *pfsd)
2422 {
2423 return E_NOTIMPL;
2424 }
2425
2426 HRESULT STDMETHODCALLTYPE CShellBrowser::_OnFocusChange(UINT itb)
2427 {
2428 return E_NOTIMPL;
2429 }
2430
2431 HRESULT STDMETHODCALLTYPE CShellBrowser::v_ShowHideChildWindows(BOOL fChildOnly)
2432 {
2433 return E_NOTIMPL;
2434 }
2435
2436 UINT STDMETHODCALLTYPE CShellBrowser::_get_itbLastFocus()
2437 {
2438 return 0;
2439 }
2440
2441 HRESULT STDMETHODCALLTYPE CShellBrowser::_put_itbLastFocus(UINT itbLastFocus)
2442 {
2443 return E_NOTIMPL;
2444 }
2445
2446 HRESULT STDMETHODCALLTYPE CShellBrowser::_UIActivateView(UINT uState)
2447 {
2448 return E_NOTIMPL;
2449 }
2450
2451 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetViewBorderRect(RECT *prc)
2452 {
2453 return E_NOTIMPL;
2454 }
2455
2456 HRESULT STDMETHODCALLTYPE CShellBrowser::_UpdateViewRectSize()
2457 {
2458 return E_NOTIMPL;
2459 }
2460
2461 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorder(UINT itb)
2462 {
2463 return E_NOTIMPL;
2464 }
2465
2466 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeView()
2467 {
2468 return E_NOTIMPL;
2469 }
2470
2471 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon)
2472 {
2473 return E_NOTIMPL;
2474 }
2475
2476 IStream *STDMETHODCALLTYPE CShellBrowser::v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName)
2477 {
2478 return NULL;
2479 }
2480
2481 LRESULT STDMETHODCALLTYPE CShellBrowser::ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
2482 {
2483 return 0;
2484 }
2485
2486 HRESULT STDMETHODCALLTYPE CShellBrowser::SetAcceleratorMenu(HACCEL hacc)
2487 {
2488 return E_NOTIMPL;
2489 }
2490
2491 int STDMETHODCALLTYPE CShellBrowser::_GetToolbarCount()
2492 {
2493 return 0;
2494 }
2495
2496 LPTOOLBARITEM STDMETHODCALLTYPE CShellBrowser::_GetToolbarItem(int itb)
2497 {
2498 return NULL;
2499 }
2500
2501 HRESULT STDMETHODCALLTYPE CShellBrowser::_SaveToolbars(IStream *pstm)
2502 {
2503 return E_NOTIMPL;
2504 }
2505
2506 HRESULT STDMETHODCALLTYPE CShellBrowser::_LoadToolbars(IStream *pstm)
2507 {
2508 return E_NOTIMPL;
2509 }
2510
2511 HRESULT STDMETHODCALLTYPE CShellBrowser::_CloseAndReleaseToolbars(BOOL fClose)
2512 {
2513 return E_NOTIMPL;
2514 }
2515
2516 HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayGetNextToolbarFocus(
2517 LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
2518 {
2519 return E_NOTIMPL;
2520 }
2521
2522 HRESULT STDMETHODCALLTYPE CShellBrowser::_ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor)
2523 {
2524 return E_NOTIMPL;
2525 }
2526
2527 UINT STDMETHODCALLTYPE CShellBrowser::_FindTBar(IUnknown *punkSrc)
2528 {
2529 return 0;
2530 }
2531
2532 HRESULT STDMETHODCALLTYPE CShellBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
2533 {
2534 return E_NOTIMPL;
2535 }
2536
2537 HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg)
2538 {
2539 if (fCurrentShellView->TranslateAcceleratorW(pmsg) != S_OK)
2540 {
2541 if (TranslateAcceleratorSB(pmsg, 0) != S_OK)
2542 return S_FALSE;
2543 return S_OK;
2544 }
2545 return S_OK;
2546 }
2547
2548 HRESULT STDMETHODCALLTYPE CShellBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor)
2549 {
2550 return E_NOTIMPL;
2551 }
2552
2553 HRESULT STDMETHODCALLTYPE CShellBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
2554 {
2555 return E_NOTIMPL;
2556 }
2557
2558 HRESULT STDMETHODCALLTYPE CShellBrowser::GoBack()
2559 {
2560 CComPtr<ITravelLog> travelLog;
2561 HRESULT hResult;
2562
2563 hResult = GetTravelLog(&travelLog);
2564 if (FAILED(hResult))
2565 return hResult;
2566 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
2567 }
2568
2569 HRESULT STDMETHODCALLTYPE CShellBrowser::GoForward()
2570 {
2571 CComPtr<ITravelLog> travelLog;
2572 HRESULT hResult;
2573
2574 hResult = GetTravelLog(&travelLog);
2575 if (FAILED(hResult))
2576 return hResult;
2577 return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
2578 }
2579
2580 HRESULT STDMETHODCALLTYPE CShellBrowser::GoHome()
2581 {
2582 return E_NOTIMPL;
2583 }
2584
2585 HRESULT STDMETHODCALLTYPE CShellBrowser::GoSearch()
2586 {
2587 return E_NOTIMPL;
2588 }
2589
2590 HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate(BSTR URL, VARIANT *Flags,
2591 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2592 {
2593 return E_NOTIMPL;
2594 }
2595
2596 HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh()
2597 {
2598 VARIANT level;
2599
2600 V_VT(&level) = VT_I4;
2601 V_I4(&level) = 4;
2602 return Refresh2(&level);
2603 }
2604
2605 HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh2(VARIANT *Level)
2606 {
2607 CComPtr<IOleCommandTarget> oleCommandTarget;
2608 HRESULT hResult;
2609
2610 hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
2611 if (FAILED(hResult))
2612 return hResult;
2613 return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
2614 }
2615
2616 HRESULT STDMETHODCALLTYPE CShellBrowser::Stop()
2617 {
2618 return E_NOTIMPL;
2619 }
2620
2621 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Application(IDispatch **ppDisp)
2622 {
2623 return E_NOTIMPL;
2624 }
2625
2626 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Parent(IDispatch **ppDisp)
2627 {
2628 return E_NOTIMPL;
2629 }
2630
2631 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Container(IDispatch **ppDisp)
2632 {
2633 return E_NOTIMPL;
2634 }
2635
2636 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Document(IDispatch **ppDisp)
2637 {
2638 return E_NOTIMPL;
2639 }
2640
2641 HRESULT STDMETHODCALLTYPE CShellBrowser::get_TopLevelContainer(VARIANT_BOOL *pBool)
2642 {
2643 return E_NOTIMPL;
2644 }
2645
2646 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Type(BSTR *Type)
2647 {
2648 return E_NOTIMPL;
2649 }
2650 #ifdef __exdisp_h__
2651 #define long LONG
2652 #endif
2653 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(long *pl)
2654 {
2655 return E_NOTIMPL;
2656 }
2657
2658 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(long Left)
2659 {
2660 return E_NOTIMPL;
2661 }
2662
2663 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(long *pl)
2664 {
2665 return E_NOTIMPL;
2666 }
2667
2668 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(long Top)
2669 {
2670 return E_NOTIMPL;
2671 }
2672
2673 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(long *pl)
2674 {
2675 return E_NOTIMPL;
2676 }
2677
2678 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(long Width)
2679 {
2680 return E_NOTIMPL;
2681 }
2682
2683 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(long *pl)
2684 {
2685 return E_NOTIMPL;
2686 }
2687
2688 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(long Height)
2689 {
2690 return E_NOTIMPL;
2691 }
2692 #ifdef __exdisp_h__
2693 #undef long
2694 #endif
2695 HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName)
2696 {
2697 return E_NOTIMPL;
2698 }
2699
2700 HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationURL(BSTR *LocationURL)
2701 {
2702 return E_NOTIMPL;
2703 }
2704
2705 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Busy(VARIANT_BOOL *pBool)
2706 {
2707 return E_NOTIMPL;
2708 }
2709
2710 HRESULT STDMETHODCALLTYPE CShellBrowser::Quit()
2711 {
2712 return E_NOTIMPL;
2713 }
2714
2715 HRESULT STDMETHODCALLTYPE CShellBrowser::ClientToWindow(int *pcx, int *pcy)
2716 {
2717 return E_NOTIMPL;
2718 }
2719
2720 HRESULT STDMETHODCALLTYPE CShellBrowser::PutProperty(BSTR Property, VARIANT vtValue)
2721 {
2722 return E_NOTIMPL;
2723 }
2724
2725 HRESULT STDMETHODCALLTYPE CShellBrowser::GetProperty(BSTR Property, VARIANT *pvtValue)
2726 {
2727 return E_NOTIMPL;
2728 }
2729
2730 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Name(BSTR *Name)
2731 {
2732 return E_NOTIMPL;
2733 }
2734
2735 HRESULT STDMETHODCALLTYPE CShellBrowser::get_HWND(SHANDLE_PTR *pHWND)
2736 {
2737 return E_NOTIMPL;
2738 }
2739
2740 HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullName(BSTR *FullName)
2741 {
2742 return E_NOTIMPL;
2743 }
2744
2745 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Path(BSTR *Path)
2746 {
2747 return E_NOTIMPL;
2748 }
2749
2750 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Visible(VARIANT_BOOL *pBool)
2751 {
2752 return E_NOTIMPL;
2753 }
2754
2755 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Visible(VARIANT_BOOL Value)
2756 {
2757 return E_NOTIMPL;
2758 }
2759
2760 HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusBar(VARIANT_BOOL *pBool)
2761 {
2762 return E_NOTIMPL;
2763 }
2764
2765 HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusBar(VARIANT_BOOL Value)
2766 {
2767 return E_NOTIMPL;
2768 }
2769
2770 HRESULT STDMETHODCALLTYPE CShellBrowser::get_StatusText(BSTR *StatusText)
2771 {
2772 return E_NOTIMPL;
2773 }
2774
2775 HRESULT STDMETHODCALLTYPE CShellBrowser::put_StatusText(BSTR StatusText)
2776 {
2777 return E_NOTIMPL;
2778 }
2779
2780 HRESULT STDMETHODCALLTYPE CShellBrowser::get_ToolBar(int *Value)
2781 {
2782 return E_NOTIMPL;
2783 }
2784
2785 HRESULT STDMETHODCALLTYPE CShellBrowser::put_ToolBar(int Value)
2786 {
2787 return E_NOTIMPL;
2788 }
2789
2790 HRESULT STDMETHODCALLTYPE CShellBrowser::get_MenuBar(VARIANT_BOOL *Value)
2791 {
2792 return E_NOTIMPL;
2793 }
2794
2795 HRESULT STDMETHODCALLTYPE CShellBrowser::put_MenuBar(VARIANT_BOOL Value)
2796 {
2797 return E_NOTIMPL;
2798 }
2799
2800 HRESULT STDMETHODCALLTYPE CShellBrowser::get_FullScreen(VARIANT_BOOL *pbFullScreen)
2801 {
2802 return E_NOTIMPL;
2803 }
2804
2805 HRESULT STDMETHODCALLTYPE CShellBrowser::put_FullScreen(VARIANT_BOOL bFullScreen)
2806 {
2807 return E_NOTIMPL;
2808 }
2809
2810 HRESULT STDMETHODCALLTYPE CShellBrowser::Navigate2(VARIANT *URL, VARIANT *Flags,
2811 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
2812 {
2813 LPITEMIDLIST pidl;
2814 HRESULT hResult;
2815
2816 // called from drive combo box to navigate to a directory
2817 if (V_VT(URL) != (VT_ARRAY | VT_UI1))
2818 return E_INVALIDARG;
2819 if (V_ARRAY(URL)->cDims != 1 || V_ARRAY(URL)->cbElements != 1)
2820 return E_INVALIDARG;
2821 pidl = (LPITEMIDLIST)V_ARRAY(URL)->pvData;
2822 hResult = BrowseToPIDL((LPITEMIDLIST)pidl, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
2823 if (FAILED(hResult))
2824 return hResult;
2825 return S_OK;
2826 }
2827
2828 HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatusWB(OLECMDID cmdID, OLECMDF *pcmdf)
2829 {
2830 return E_NOTIMPL;
2831 }
2832
2833 HRESULT STDMETHODCALLTYPE CShellBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
2834 VARIANT *pvaIn, VARIANT *pvaOut)
2835 {
2836 return E_NOTIMPL;
2837 }
2838
2839 HRESULT STDMETHODCALLTYPE CShellBrowser::ShowBrowserBar(VARIANT *pvaClsid, VARIANT *pvarShow, VARIANT *pvarSize)
2840 {
2841 CLSID classID;
2842 bool vertical;
2843
2844 // called to show search bar
2845 if (V_VT(pvaClsid) != VT_BSTR)
2846 return E_INVALIDARG;
2847 CLSIDFromString(V_BSTR(pvaClsid), &classID);
2848 // TODO: properly compute the value of vertical
2849 vertical = true;
2850 return ShowBand(classID, vertical);
2851 }
2852
2853 HRESULT STDMETHODCALLTYPE CShellBrowser::get_ReadyState(READYSTATE *plReadyState)
2854 {
2855 return E_NOTIMPL;
2856 }
2857
2858 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Offline(VARIANT_BOOL *pbOffline)
2859 {
2860 return E_NOTIMPL;
2861 }
2862
2863 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Offline(VARIANT_BOOL bOffline)
2864 {
2865 return E_NOTIMPL;
2866 }
2867
2868 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Silent(VARIANT_BOOL *pbSilent)
2869 {
2870 return E_NOTIMPL;
2871 }
2872
2873 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Silent(VARIANT_BOOL bSilent)
2874 {
2875 return E_NOTIMPL;
2876 }
2877
2878 HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsBrowser(VARIANT_BOOL *pbRegister)
2879 {
2880 return E_NOTIMPL;
2881 }
2882
2883 HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsBrowser(VARIANT_BOOL bRegister)
2884 {
2885 return E_NOTIMPL;
2886 }
2887
2888 HRESULT STDMETHODCALLTYPE CShellBrowser::get_RegisterAsDropTarget(VARIANT_BOOL *pbRegister)
2889 {
2890 return E_NOTIMPL;
2891 }
2892
2893 HRESULT STDMETHODCALLTYPE CShellBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister)
2894 {
2895 return E_NOTIMPL;
2896 }
2897
2898 HRESULT STDMETHODCALLTYPE CShellBrowser::get_TheaterMode(VARIANT_BOOL *pbRegister)
2899 {
2900 return E_NOTIMPL;
2901 }
2902
2903 HRESULT STDMETHODCALLTYPE CShellBrowser::put_TheaterMode(VARIANT_BOOL bRegister)
2904 {
2905 return E_NOTIMPL;
2906 }
2907
2908 HRESULT STDMETHODCALLTYPE CShellBrowser::get_AddressBar(VARIANT_BOOL *Value)
2909 {
2910 return E_NOTIMPL;
2911 }
2912
2913 HRESULT STDMETHODCALLTYPE CShellBrowser::put_AddressBar(VARIANT_BOOL Value)
2914 {
2915 return E_NOTIMPL;
2916 }
2917
2918 HRESULT STDMETHODCALLTYPE CShellBrowser::get_Resizable(VARIANT_BOOL *Value)
2919 {
2920 return E_NOTIMPL;
2921 }
2922
2923 HRESULT STDMETHODCALLTYPE CShellBrowser::put_Resizable(VARIANT_BOOL Value)
2924 {
2925 return E_NOTIMPL;
2926 }
2927
2928 HRESULT STDMETHODCALLTYPE CShellBrowser::FindWindowByIndex(DWORD dwID, IUnknown **ppunk)
2929 {
2930 return E_NOTIMPL;
2931 }
2932
2933 HRESULT STDMETHODCALLTYPE CShellBrowser::GetWindowData(IStream *pStream, LPWINDOWDATA pWinData)
2934 {
2935 if (pWinData == NULL)
2936 return E_POINTER;
2937
2938 pWinData->dwWindowID = -1;
2939 pWinData->uiCP = 0;
2940 pWinData->pidl = ILClone(fCurrentDirectoryPIDL);
2941 pWinData->lpszUrl = NULL;
2942 pWinData->lpszUrlLocation = NULL;
2943 pWinData->lpszTitle = NULL;
2944 return S_OK;
2945 }
2946
2947 HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistoryPosition(LPWSTR pszUrlLocation, DWORD dwPosition)
2948 {
2949 return E_NOTIMPL;
2950 }
2951
2952 HRESULT STDMETHODCALLTYPE CShellBrowser::GetClassID(CLSID *pClassID)
2953 {
2954 return E_NOTIMPL;
2955 }
2956
2957 HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistory(IStream *pStream, IBindCtx *pbc)
2958 {
2959 CComPtr<IPersistHistory> viewPersistHistory;
2960 CComPtr<IOleObject> viewHistoryObject;
2961 persistState oldState;
2962 ULONG numRead;
2963 LPITEMIDLIST pidl;
2964 HRESULT hResult;
2965
2966 hResult = pStream->Read(&oldState, sizeof(oldState), &numRead);
2967 if (FAILED(hResult))
2968 return hResult;
2969 if (numRead != sizeof(oldState) || oldState.dwSize != sizeof(oldState))
2970 return E_FAIL;
2971 if (oldState.browseType != 2)
2972 return E_FAIL;
2973 pidl = static_cast<LPITEMIDLIST>(CoTaskMemAlloc(oldState.pidlSize));
2974 if (pidl == NULL)
2975 return E_OUTOFMEMORY;
2976 hResult = pStream->Read(pidl, oldState.pidlSize, &numRead);
2977 if (FAILED(hResult))
2978 {
2979 ILFree(pidl);
2980 return hResult;
2981 }
2982 if (numRead != oldState.pidlSize)
2983 {
2984 ILFree(pidl);
2985 return E_FAIL;
2986 }
2987 hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
2988 IID_PPV_ARG(IOleObject, &viewHistoryObject));
2989 fHistoryObject = viewHistoryObject;
2990 fHistoryStream = pStream;
2991 fHistoryBindContext = pbc;
2992 hResult = BrowseToPIDL(pidl, BTP_UPDATE_CUR_HISTORY);
2993 fHistoryObject = NULL;
2994 fHistoryStream = NULL;
2995 fHistoryBindContext = NULL;
2996 ILFree(pidl);
2997 if (FAILED(hResult))
2998 return hResult;
2999 return S_OK;
3000 }
3001
3002 HRESULT STDMETHODCALLTYPE CShellBrowser::SaveHistory(IStream *pStream)
3003 {
3004 CComPtr<IPersistHistory> viewPersistHistory;
3005 persistState newState;
3006 HRESULT hResult;
3007
3008 hResult = fCurrentShellView->GetItemObject(
3009 SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
3010 memset(&newState, 0, sizeof(newState));
3011 newState.dwSize = sizeof(newState);
3012 newState.browseType = 2;
3013 newState.browserIndex = GetBrowserIndex();
3014 if (viewPersistHistory.p != NULL)
3015 {
3016 hResult = viewPersistHistory->GetClassID(&newState.persistClass);
3017 if (FAILED(hResult))
3018 return hResult;
3019 }
3020 newState.pidlSize = ILGetSize(fCurrentDirectoryPIDL);
3021 hResult = pStream->Write(&newState, sizeof(newState), NULL);
3022 if (FAILED(hResult))
3023 return hResult;
3024 hResult = pStream->Write(fCurrentDirectoryPIDL, newState.pidlSize, NULL);
3025 if (FAILED(hResult))
3026 return hResult;
3027 if (viewPersistHistory.p != NULL)
3028 {
3029 hResult = viewPersistHistory->SaveHistory(pStream);
3030 if (FAILED(hResult))
3031 return hResult;
3032 }
3033 return S_OK;
3034 }
3035
3036 HRESULT STDMETHODCALLTYPE CShellBrowser::SetPositionCookie(DWORD dwPositioncookie)
3037 {
3038 return E_NOTIMPL;
3039 }
3040
3041 HRESULT STDMETHODCALLTYPE CShellBrowser::GetPositionCookie(DWORD *pdwPositioncookie)
3042 {
3043 return E_NOTIMPL;
3044 }
3045
3046 LRESULT CShellBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3047 {
3048 OnCreate(reinterpret_cast<LPCREATESTRUCT> (lParam));
3049 return 0;
3050 }
3051
3052 LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3053 {
3054 // TODO: rip down everything
3055 PostQuitMessage(0);
3056 return 0;
3057 }
3058
3059 LRESULT CShellBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3060 {
3061 CComPtr<IDockingWindow> dockingWindow;
3062 RECT availableBounds;
3063 static const INT excludeItems[] = {1, 1, 1, 0xa001, 0, 0};
3064 HRESULT hResult;
3065
3066 if (wParam != SIZE_MINIMIZED)
3067 {
3068 GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
3069 for (INT x = 0; x < 3; x++)
3070 {
3071 if (fClientBars[x].clientBar != NULL)
3072 {
3073 hResult = fClientBars[x].clientBar->QueryInterface(
3074 IID_PPV_ARG(IDockingWindow, &dockingWindow));
3075 if (SUCCEEDED(hResult) && dockingWindow != NULL)
3076 {
3077 hResult = dockingWindow->ResizeBorderDW(
3078 &availableBounds, static_cast<IDropTarget *>(this), TRUE);
3079 break;
3080 }
3081 }
3082 }
3083 RepositionBars();
3084 }
3085 return 1;
3086 }
3087
3088 LRESULT CShellBrowser::OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3089 {
3090 HMENU theMenu;
3091
3092 theMenu = reinterpret_cast<HMENU>(wParam);
3093 if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_VIEW))
3094 UpdateViewMenu(theMenu);
3095 return RelayMsgToShellView(uMsg, wParam, lParam, bHandled);
3096 }
3097
3098 LRESULT CShellBrowser::RelayMsgToShellView(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
3099 {
3100 if (fCurrentShellViewWindow != NULL)
3101 return SendMessage