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