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