Date: 20:16:30, 2010年3月18日----Modified : /EmbeddedWB/EmbeddedWB.pasModified : /EmbeddedWB/EmbeddedWebBrowser_D7.dpk
{$IFDEF Enable_MouseWheelFix} function MouseHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; var hwnd: THANDLE; WndClass: string; begin Result := CallNextHookEx(MouseHook, nCode, wParam, lParam); case nCode < 0 of TRUE: Exit; FALSE: begin if (wParam = WM_MOUSEWHEEL) then begin hwnd := WindowFromPoint(Mouse.CursorPos); if hwnd <> 0 then begin //hwnd := GetParent(hwnd); ///屏蔽这一句后正常 if hwnd <> 0 then begin SetLength(WndClass, 25); SetLength(WndClass, GetClassName(hwnd, PChar(WndClass), Length(WndClass))); if WndClass = 'Shell DocObject View' then Windows.SetFocus(hwnd); end; end; end; end; end; end; {$ENDIF}
在项目中出现一个bug就是在内嵌的浏览器中使用鼠标中键滚动时会丢失浏览器的焦点,也就是滚动一次就需要再次点击浏览器后才能继续滚动,然后分析源码后找到问题,更改后正常。