Delphi 修正EmbeddedWEB不能使用中键滚动的bug

Modified : /EmbeddedWB/EmbeddedWB.pas


{$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}


你可能感兴趣的:(function,shell,Integer,Delphi)