RRUZ / vcl-styles-utils

Extend and improve the Delphi VCL Styles
https://theroadtodelphi.wordpress.com/
329 stars 115 forks source link

ERangeError in TSysScrollingStyleHook.DoSliderTrackTimer #287

Closed luebbe closed 1 year ago

luebbe commented 3 years ago

This error occurs in the line

SendMessage(Handle, CM_SCROLLTRACKING, MakeWParam(P.X, P.Y), 0);

Root cause is that MakeWParam expects two unsigned integers, but P.X and P.Y can become negative. You can easily reproduce this bug on a dual monitor setup, where the secondary screen is left of the primary screen.

procedure TSysScrollingStyleHook.DoSliderTrackTimer(Sender: TObject);
var
  P: TPoint;
begin
  GetCursorPos(P);
  if (FPrevPoint <> P) and (FDownPoint <> P) then
  begin
    SendMessage(Handle, CM_SCROLLTRACKING, MakeWParam(P.X, P.Y), 0);
    FPrevPoint := P;
    FDownPoint := Point(-1, -1);
  end;
end;
DinuruSeniya commented 2 years ago

Please check @salvadordf @RRUZ