Mousewheel Bug in AdvStringGrid.WndProc

There's a bug in lines 59929..59936 of WndProc in AdvStringGrid v8.6.5.1.

The following code:

    if MouseActions.WheelActive = waMouseOver then
    begin
      pos.x := message.lparam and $FFFF;
      pos.y := (message.lparam and $FFFF0000) shr 16;
      pos := ScreenToClient(pos);
      if not PtInRect(ClientRect,pos) then
        Exit;
    end;

doesn't take into account that the mouse coordinates may become negative by simply masking out message.lparam and not doing a proper type cast.

Monitor 2 below is my primary monitor
grafik

When the application is on the left monitor, the real mouse coordinates are negative, but after masking out pos.x has a value of >64000, after Screentoclient > 66000, which makes PtInRect fail and exit the procedure.

Proposed solution: Put an Int16 typecast around the masked values. Masking out when you shift right should also not be necessary.

      pos.x := Int16(message.lparam and $FFFF);
      pos.y := Int16(message.lparam shr 16);

Another probably wrong masking action is in lines 60120:

          if MouseActions.DisjunctRowSelect then
          begin
            GetKeyboardState(KeyState);
            ShiftState := KeyboardStateToShiftState(KeyState);
            Handled := false;
            Pos := Point(Message.LParam and $FFFF, Message.LParam shr 16);
          end;

I just searched for LParam and $FFFF in AdvGrids after finding the first. There may be lots of other bugs of this type.

Thanks for informing.
We'll adapt this accordingly.