Incorrect Mouse Scrolling with Microsoft Intellipoint 3000

Main development forum.

Incorrect Mouse Scrolling with Microsoft Intellipoint 3000

Postby hamtitampti » Sat Oct 03, 2009 6:08 pm

Hi Guys
Got a new Mouse (Microsoft Intellipoint 3000) and i have strange Scrolling Behaviours in many programms (Winamp...) + Winmerge.

So i sticked around, and i found a solution for this problem:
http://msdn.microsoft.com/en-us/library/ms997498.aspx

Here the Fix: (not sure about the Table provided there)
ccrystaltextview.cpp

Code: Select all
//
// Mouse wheel event.  zDelta is in multiples of 120.
// Divide by 40 so each click is 3 lines.  I know some
// drivers let you set the ammount of scroll, but I
// don't know how to retrieve this or if they just
// adjust the zDelta you get here.
BOOL CCrystalTextView::
OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
  SCROLLINFO si = {0};
  si.cbSize = sizeof (si);
  si.fMask = SIF_PAGE | SIF_RANGE;
  VERIFY (GetScrollInfo (SB_VERT, &si));

  ULONG       ulScrollLines = 0;
  int         iDeltaPerLine = 0;
  if (ulScrollLines == 0) {
    SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &ulScrollLines, 0);

    if (ulScrollLines) {
      iDeltaPerLine = WHEEL_DELTA / ulScrollLines ;
    }
    else {
      iDeltaPerLine = 0;
    }
  }

   if (iDeltaPerLine == 0) {
     // Seems Mouse Scrolling is Disabled - is returncode correct ??
     return false;
   }
 
  int nNewTopSubLine= m_nTopSubLine - (int)(zDelta / iDeltaPerLine);


and
mergeeditview.cpp

Code: Select all
/**
 * @brief Called when mouse's wheel is scrolled.
 */
BOOL CMergeEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
   if ( nFlags == MK_CONTROL )
   {
      short amount = zDelta < 0 ? -1: 1;
      ZoomText(amount);

      // no default CCrystalTextView
      return CView::OnMouseWheel(nFlags, zDelta, pt);
   }

   if (nFlags == MK_SHIFT)
   {
      SCROLLINFO si = {0};
      si.cbSize = sizeof(si);
      si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;

      VERIFY(GetScrollInfo(SB_HORZ, &si));
    ULONG       ulScrollLines = 0;
    int         iDeltaPerLine = 0;
    if (ulScrollLines == 0) {
      SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &ulScrollLines, 0);

      if (ulScrollLines) {
        iDeltaPerLine = WHEEL_DELTA / ulScrollLines ;
      }
      else {
        iDeltaPerLine = 0;
      }
    }
      // new horz pos
      si.nPos -= (int)zDelta / iDeltaPerLine;
      if (si.nPos > si.nMax) si.nPos = si.nMax;
      if (si.nPos < si.nMin) si.nPos = si.nMin;


regards
Franz
hamtitampti
 
Posts: 1
Joined: Sat Oct 03, 2009 6:01 pm

Return to Developers

Who is online

Users browsing this forum: No registered users and 4 guests