[BROWSEUI]
authorDavid Quintana <gigaherz@gmail.com>
Sun, 4 May 2014 13:57:23 +0000 (13:57 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Sun, 4 May 2014 13:57:23 +0000 (13:57 +0000)
* Begin implementing resizing of the rebar.
* Begin implementing the addressbar function. For now, the current folder path is displayed. No icon, no parsing support, no combo dropdown list.
CORE-8173

svn path=/branches/shell-experiments/; revision=63156

dll/win32/browseui/addressband.cpp
dll/win32/browseui/addressband.h
dll/win32/browseui/addresseditbox.cpp
dll/win32/browseui/addresseditbox.h
dll/win32/browseui/internettoolbar.cpp
dll/win32/browseui/internettoolbar.h
dll/win32/browseui/shellbrowser.cpp
dll/win32/browseui/travellog.cpp

index c33b983..10f8e02 100644 (file)
@@ -24,6 +24,8 @@ Implements the navigation band of the cabinet window
 
 #include "precomp.h"
 
+HRESULT CreateAddressEditBox(REFIID riid, void **ppv);
+
 /*
 TODO:
 ****Add command handler for show/hide Go button to OnWinEvent
@@ -45,6 +47,7 @@ CAddressBand::CAddressBand()
     fGoButton = NULL;
     fComboBox = NULL;
     fGoButtonShown = false;
+    fAdviseCookie = 0;
 }
 
 CAddressBand::~CAddressBand()
@@ -97,6 +100,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetBandInfo(DWORD dwBandID, DWORD dwView
 
 HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
 {
+    CComPtr<IBrowserService>                browserService;
+    CComPtr<IOleWindow>                     oleWindow;
     CComPtr<IShellService>                  shellService;
     CComPtr<IUnknown>                       offset34;
     HWND                                    parentWindow;
@@ -107,9 +112,14 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
     HINSTANCE                               shellInstance;
     HRESULT                                 hResult;
 
-    fSite.Release();
     if (pUnkSite == NULL)
+    {
+        hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie);
+        fSite.Release();
         return S_OK;
+    }
+
+    fSite.Release();
 
     hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
     if (FAILED(hResult))
@@ -138,11 +148,16 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
 #if 1
     hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER,
         IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
-    if (FAILED(hResult))
-        return hResult;
 #else
-    // instantiate new version
+    hResult = E_FAIL;
 #endif
+    if (FAILED(hResult))
+    {
+        // instantiate new version
+        hResult = CreateAddressEditBox(IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
+        if (FAILED(hResult))
+            return hResult;
+    }
 
     hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &shellService));
     if (FAILED(hResult))
@@ -169,12 +184,22 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
         0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
     SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
     SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
-    SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
-    SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
+    if (normalImagelist)
+        SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
+    if (hotImageList)
+        SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
     SendMessage(fGoButton, TB_ADDSTRINGW,
         reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
     SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
 
+    // take advice to watch events
+    hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
+    if (SUCCEEDED(hResult))
+    {
+        if (SUCCEEDED(hResult))
+            hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
+    }
+
     return hResult;
 }
 
@@ -379,12 +404,65 @@ HRESULT STDMETHODCALLTYPE CAddressBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
     return E_NOTIMPL;
 }
 
+HRESULT STDMETHODCALLTYPE CAddressBand::GetTypeInfoCount(UINT *pctinfo)
+{
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
+    LCID lcid, DISPID *rgDispId)
+{
+    return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
+    DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    CComPtr<IBrowserService> isb;
+    HRESULT hr;
+
+    if (pDispParams == NULL)
+        return E_INVALIDARG;
+
+    switch (dispIdMember)
+    {
+    case DISPID_NAVIGATECOMPLETE2:
+    case DISPID_DOCUMENTCOMPLETE:
+        hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &isb));
+        if (FAILED(hr))
+            return hr;
+        PIDLIST_ABSOLUTE absolutePIDL;
+        LPCITEMIDLIST pidlChild;
+        isb->GetPidl(&absolutePIDL);
+
+        CComPtr<IShellFolder> sf;
+        SHBindToParent(absolutePIDL, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
+
+        STRRET ret;
+        sf->GetDisplayNameOf(pidlChild, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING, &ret);
+
+        WCHAR buf[4096];
+        StrRetToBufW(&ret, pidlChild, buf, 4095);
+
+        fAddressEditBox->SetCurrentDir(reinterpret_cast<long>(buf));
+
+        break;
+    }
+    return S_OK;
+}
+
 LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled)
 {
     if (notifyHeader->hwndFrom == fGoButton)
     {
-        SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
-        SendMessage(fEditControl, WM_KEYUP, 13, 0);
+        fAddressEditBox->ParseNow(0);
+        //SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
+        //SendMessage(fEditControl, WM_KEYUP, 13, 0);
     }
     return 0;
 }
index 5e387b7..e7e38be 100644 (file)
@@ -32,7 +32,8 @@ class CAddressBand :
     public IServiceProvider,
     public IWinEventHandler,
     public IAddressBand,
-    public IInputObjectSite
+    public IInputObjectSite,
+    public IDispatch
 {
 private:
     CComPtr<IDockingWindowSite>             fSite;
@@ -41,6 +42,7 @@ private:
     HWND                                    fGoButton;
     HWND                                    fComboBox;
     bool                                    fGoButtonShown;
+    DWORD                                   fAdviseCookie;
 public:
     CAddressBand();
     ~CAddressBand();
@@ -95,6 +97,12 @@ public:
     virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
     virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
 
+    // *** IDispatch methods ***
+    virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
+    virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
+    virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
+    virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
+
     // message handlers
     LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled);
     LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled);
@@ -128,5 +136,6 @@ public:
         COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
         COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+        COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
     END_COM_MAP()
 };
index 67afa9d..672ca1d 100644 (file)
@@ -40,8 +40,7 @@ TODO:
 */
 
 CAddressEditBox::CAddressEditBox() :
-        fEditWindow(NULL, this, 1),
-        fComboBoxExWindow(NULL, this, 2)
+        fEditWindow(NULL, this, 1)
 {
 }
 
@@ -57,6 +56,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *)
 
 HRESULT STDMETHODCALLTYPE CAddressEditBox::FileSysChange(long param8, long paramC)
 {
+    LPWSTR str8 = reinterpret_cast<LPWSTR>(param8);
+    LPWSTR strC = reinterpret_cast<LPWSTR>(paramC);
     return E_NOTIMPL;
 }
 
@@ -67,13 +68,15 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Refresh(long param8)
 
 HRESULT STDMETHODCALLTYPE CAddressEditBox::Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18)
 {
-    fComboBoxExWindow.SubclassWindow(comboboxEx);
+    SubclassWindow(comboboxEx);
     fEditWindow.SubclassWindow(editControl);
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE CAddressEditBox::SetCurrentDir(long paramC)
 {
+    LPWSTR strC = reinterpret_cast<LPWSTR>(paramC);    
+    fEditWindow.SetWindowText(strC);
     return E_NOTIMPL;
 }
 
@@ -167,6 +170,25 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::GetSizeMax(ULARGE_INTEGER *pcbSize)
     return E_NOTIMPL;
 }
 
+LRESULT CAddressEditBox::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    bHandled = FALSE;
+/*
+    RECT rc;
+    GetClientRect(&rc);
+    rc.left += 24;
+    rc.top += 4;
+    rc.right -= 4;
+    rc.bottom -= 4;
+    fEditWindow.SetWindowPos(NULL,
+        rc.left, rc.top,
+        rc.right - rc.left,
+        rc.bottom - rc.top,
+        SWP_NOOWNERZORDER | SWP_NOZORDER);
+*/
+    return 0;
+}
+
 HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
 {
     CComObject<CAddressEditBox>             *theMenuBar;
index e85d040..44c9c04 100644 (file)
@@ -34,7 +34,6 @@ class CAddressEditBox :
 {
 private:
     CContainedWindow                        fEditWindow;
-    CContainedWindow                        fComboBoxExWindow;
 public:
     CAddressEditBox();
     ~CAddressEditBox();
@@ -80,6 +79,7 @@ public:
     // message handlers
 //    LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
 //    LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+    LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
 
     DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
     DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
@@ -94,6 +94,7 @@ public:
     //        MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
     //    ALT_MSG_MAP(2)
     //        MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
+        MESSAGE_HANDLER(WM_SIZE, OnSize)
     END_MSG_MAP()
 
     BEGIN_COM_MAP(CAddressEditBox)
index b1c33cc..a47ad3c 100644 (file)
@@ -25,6 +25,10 @@ toolbar, and address band for an explorer window
 
 #include "precomp.h"
 
+/* FIXME, I can't include windowsx because it conflicts with some #defines */
+#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+
 #define USE_CUSTOM_MENUBAND 1
 
 // navigation controls and menubar just send a message to parent window
@@ -514,33 +518,24 @@ void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
     newSite->Initialize(newItem, this, fMainReBar, bandID, flags);
 }
 
-HRESULT CInternetToolbar::ReserveBorderSpace()
+HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
 {
     CComPtr<IDockingWindowSite>             dockingWindowSite;
     RECT                                    availableBorderSpace;
-    RECT                                    neededBorderSpace;
-    HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
+    HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
     if (FAILED(hResult))
         return hResult;
     hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
     if (FAILED(hResult))
         return hResult;
-    SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
-    // RBSTR_CHANGERECT does not seem to set the proper size in the rect.
-    // Let's make sure we fetch the actual size properly.
-    GetWindowRect(fMainReBar, &availableBorderSpace);
-    neededBorderSpace.left = 0;
-    neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
-    if (!fLocked)
-        neededBorderSpace.top += 3;
-    neededBorderSpace.right = 0;
-    neededBorderSpace.bottom = 0;
-    hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
-    if (FAILED(hResult))
-        return hResult;
-    return S_OK;
+
+    if (availableBorderSpace.top > maxHeight)
+    {
+        availableBorderSpace.top = maxHeight;
+    }
+
+    return ResizeBorderDW(&availableBorderSpace, fSite, FALSE);
 }
 
 HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
@@ -784,7 +779,36 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::CloseDW(DWORD dwReserved)
 HRESULT STDMETHODCALLTYPE CInternetToolbar::ResizeBorderDW(LPCRECT prcBorder,
     IUnknown *punkToolbarSite, BOOL fReserved)
 {
-    return E_NOTIMPL;
+    RECT neededBorderSpace;
+    RECT availableBorderSpace = *prcBorder;
+
+    SendMessage(fMainReBar, RB_SIZETORECT, RBSTR_CHANGERECT, reinterpret_cast<LPARAM>(&availableBorderSpace));
+
+    // RBSTR_CHANGERECT does not seem to set the proper size in the rect.
+    // Let's make sure we fetch the actual size properly.
+    GetWindowRect(fMainReBar, &availableBorderSpace);
+    neededBorderSpace.left = 0;
+    neededBorderSpace.top = availableBorderSpace.bottom - availableBorderSpace.top;
+    if (!fLocked)
+        neededBorderSpace.top += 3;
+    neededBorderSpace.right = 0;
+    neededBorderSpace.bottom = 0;
+
+    CComPtr<IDockingWindowSite> dockingWindowSite;
+    
+    HRESULT hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = dockingWindowSite->RequestBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDockingWindow *>(this), &neededBorderSpace);
+    if (FAILED(hResult))
+        return hResult;
+
+    return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE CInternetToolbar::GetClassID(CLSID *pClassID)
@@ -830,8 +854,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     hResult = CreateMenuBar(&menuBar);
     if (FAILED(hResult))
         return hResult;
-    AddDockItem(menuBar, ITBBID_MENUBAND,
-        CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
+    AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
 
     hResult = menuBar->QueryInterface(IID_PPV_ARG(IOleWindow, &menuOleWindow));
     hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
@@ -841,8 +864,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     hResult = CreateBrandBand(&logoBar);
     if (FAILED(hResult))
         return hResult;
-    AddDockItem(logoBar, ITBBID_BRANDBAND,
-        CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
+    AddDockItem(logoBar, ITBBID_BRANDBAND, CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE);
     fLogoBar.Attach(logoBar.Detach());                  // transfer the ref count
 
     /* Create and attach the standard toolbar to the rebar */
@@ -1184,7 +1206,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(
     if (fMenuBar)
     {
         hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
-        if (menuWinEventHandler->IsWindowOwner(hWnd))
+        if (menuWinEventHandler->IsWindowOwner(hWnd) == S_OK)
         {
             return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult);
         }
@@ -1661,6 +1683,66 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
     return 0;
 }
 
+LRESULT CInternetToolbar::OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    bHandled = FALSE;
+    if (fLocked)
+        return 0;
+
+    if (wParam & MK_CONTROL)
+        return 0;
+
+    fSizing = TRUE;
+
+    DWORD msgp = GetMessagePos();
+    
+    fStartPosition.x = GET_X_LPARAM(msgp);
+    fStartPosition.y = GET_Y_LPARAM(msgp);
+    
+    RECT rc;
+    GetWindowRect(m_hWnd, &rc);
+
+    fStartHeight = rc.bottom - rc.top;
+
+    SetCapture();
+
+    bHandled = TRUE;
+    return 0;
+}
+
+LRESULT CInternetToolbar::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    bHandled = FALSE;
+    if (!fSizing)
+        return 0;
+
+    DWORD msgp = GetMessagePos();
+
+    POINT pt;
+    pt.x = GET_X_LPARAM(msgp);
+    pt.y = GET_Y_LPARAM(msgp);
+
+    ReserveBorderSpace(fStartHeight - fStartPosition.y + pt.y);
+
+    bHandled = TRUE;
+    return 0;
+}
+
+LRESULT CInternetToolbar::OnLUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    bHandled = FALSE;
+    if (!fSizing)
+        return 0;
+
+    OnMouseMove(uMsg, wParam, lParam, bHandled);
+
+    fSizing = FALSE;
+
+    ReleaseCapture();
+
+    return 0;
+}
+
 HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
 {
     CComObject<CInternetToolbar>            *theToolbar;
index 0b6ae67..b416043 100644 (file)
@@ -96,11 +96,14 @@ public:
     HWND                                    fToolbarWindow;
     DWORD                                   fAdviseCookie;
     CComPtr<IBandProxy>                     fBandProxy;
+    BOOL                                    fSizing;
+    POINT                                   fStartPosition;
+    LONG                                    fStartHeight;
 public:
     CInternetToolbar();
     ~CInternetToolbar();
     void AddDockItem(IUnknown *newItem, int bandID, int flags);
-    HRESULT ReserveBorderSpace();
+    HRESULT ReserveBorderSpace(LONG maxHeight = -1);
     HRESULT CreateMenuBar(IShellMenu **menuBar);
     HRESULT CreateBrandBand(IUnknown **logoBar);
     HRESULT CreateToolsBar(IUnknown **toolsBar);
@@ -198,6 +201,9 @@ public:
     LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
     LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
     LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+    LRESULT OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+    LRESULT OnLUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+    LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
 
     BEGIN_MSG_MAP(CInternetToolbar)
         COMMAND_ID_HANDLER(gBackCommandID, OnTravelBack)
@@ -215,6 +221,9 @@ public:
         MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
         NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
         MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
+        MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLDown)
+        MESSAGE_HANDLER(WM_LBUTTONUP, OnLUp)
+        MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
     END_MSG_MAP()
 
     DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR)
index 5ce9f79..2a91d2f 100644 (file)
@@ -25,8 +25,8 @@
 
 extern "C"
 BOOL WINAPI Shell_GetImageLists(
-    _In_  HIMAGELIST *phiml,
-    _In_  HIMAGELIST *phimlSmall
+    _Out_  HIMAGELIST *phiml,
+    _Out_  HIMAGELIST *phimlSmall
     );
 
 #include "newatlinterfaces.h"
@@ -200,8 +200,8 @@ HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
 {
     CComPtr<IShellFolder>                   desktop;
 
-    ::SHGetDesktopFolder(&desktop);
-    if (desktop == NULL)
+    HRESULT hr = ::SHGetDesktopFolder(&desktop);
+    if (FAILED(hr))
         return E_FAIL;
     if (path == NULL || path->mkid.cb == 0)
     {
@@ -1361,26 +1361,43 @@ void CShellBrowser::RepositionBars()
             if (borderSpace.top != 0)
             {
                 toolbarRect.bottom = toolbarRect.top + borderSpace.top;
-                clientRect.top += borderSpace.top;
             }
             else if (borderSpace.bottom != 0)
             {
                 toolbarRect.top = toolbarRect.bottom - borderSpace.bottom;
-                clientRect.bottom -= borderSpace.bottom;
             }
-            if (borderSpace.left != 0)
+            else if (borderSpace.left != 0)
             {
                 toolbarRect.right = toolbarRect.left + borderSpace.left;
-                clientRect.left += borderSpace.left;
             }
             else if (borderSpace.right != 0)
             {
                 toolbarRect.left = toolbarRect.right - borderSpace.right;
-                clientRect.right -= borderSpace.right;
             }
-            ::SetWindowPos(hwnd, NULL, toolbarRect.left, toolbarRect.top,
-                                toolbarRect.right - toolbarRect.left,
-                                toolbarRect.bottom - toolbarRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
+
+            ::SetWindowPos(hwnd, NULL,
+                toolbarRect.left,
+                toolbarRect.top,
+                toolbarRect.right - toolbarRect.left,
+                toolbarRect.bottom - toolbarRect.top,
+                SWP_NOOWNERZORDER | SWP_NOZORDER);
+
+            if (borderSpace.top != 0)
+            {
+                clientRect.top = toolbarRect.bottom;
+            }
+            else if (borderSpace.bottom != 0)
+            {
+                clientRect.bottom = toolbarRect.top;
+            }
+            else if (borderSpace.left != 0)
+            {
+                clientRect.left = toolbarRect.right;
+            }
+            else if (borderSpace.right != 0)
+            {
+                clientRect.right = toolbarRect.left;
+            }
         }
     }
     ::SetWindowPos(fCurrentShellViewWindow, NULL, clientRect.left, clientRect.top,
@@ -1589,8 +1606,9 @@ bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
 
 HRESULT STDMETHODCALLTYPE CShellBrowser::GetBorderDW(IUnknown *punkObj, LPRECT prcBorder)
 {
-    RECT                                    availableBounds;
-    static const INT                        excludeItems[] = {1, 1, 1, 0xa001, 0, 0};
+    static const INT excludeItems[] = { 1, 1, 1, 0xa001, 0, 0 };
+
+    RECT availableBounds;
 
     GetEffectiveClientRect(m_hWnd, &availableBounds, excludeItems);
     for (INT x = 0; x < 3; x++)
@@ -1853,6 +1871,15 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
 
 HRESULT STDMETHODCALLTYPE CShellBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
 {
+    //
+    if (pszStatusText)
+    {
+        ::SetWindowText(fStatusBar, pszStatusText);
+    }
+    else
+    {
+
+    }
     return E_NOTIMPL;
 }
 
@@ -2041,8 +2068,10 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
     HRESULT                                 hResult;
 
     // called by toolbar when displaying tooltips
-    if (pptl != NULL)
-        *pptl = NULL;
+    if (pptl == NULL)
+        return E_FAIL;
+
+    *pptl = NULL;
     if (fTravelLog.p == NULL)
     {
         hResult = CreateTravelLog(IID_PPV_ARG(ITravelLog, &fTravelLog));
index 0bddc94..b215d46 100644 (file)
@@ -125,7 +125,7 @@ HRESULT CTravelEntry::GetToolTipText(IUnknown *punk, LPWSTR pwzText) const
 {
     HRESULT                                 hResult;
 
-    hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL);
+    hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL) ? S_OK : S_FALSE;
     if (FAILED(hResult))
         return hResult;
     return S_OK;