[BROWSEUI] Improve CBandSiteBase::OnWinEvent to forward messages correctly to the...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Fri, 20 Oct 2017 16:41:01 +0000 (19:41 +0300)
committerGiannis Adamopoulos <johnyadams@outlook.com>
Sun, 22 Oct 2017 17:03:32 +0000 (20:03 +0300)
dll/win32/browseui/shellbars/CBandSite.cpp

index 24ca2e9..520f9eb 100644 (file)
@@ -694,12 +694,32 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
         
         return S_OK;
     }
-        
-    if (hWnd == fRebarWindow)
+    else if (uMsg == WM_COMMAND && lParam)
     {
-        /* FIXME: Just send the message? */
-        *plrResult = SendMessageW(hWnd, uMsg, wParam, lParam);
-        return S_OK;
+        hWnd = reinterpret_cast<HWND>(lParam);
+    }
+    else if (uMsg == WM_NOTIFY)
+    {
+        NMHDR* pnmhdr = reinterpret_cast<NMHDR*>(lParam);
+        if (pnmhdr->hwndFrom != fRebarWindow)
+        {
+            hWnd = pnmhdr->hwndFrom;
+        }
+        else
+        {
+            for (int i = 0; i < fBandsAllocated; i++)
+            {
+                if (fBands[i].WndEvtHandler && fBands[i].OleWindow)
+                {
+                    HWND hwndBand;
+                    if (SUCCEEDED(fBands[i].OleWindow->GetWindow(&hwndBand)))
+                    {
+                        fBands[i].WndEvtHandler->OnWinEvent(hwndBand, uMsg, wParam, lParam, plrResult);
+                    }
+                }
+            }
+            return S_OK;
+        }
     }
 
     Band = GetBandFromHwnd(hWnd);