Mouse wheel support in winhelp

Mike Hearn mike at theoretic.com
Mon Sep 15 16:11:06 CDT 2003


Well, our winhelp may be lacking 90% of the features of the native
version, but at least native win98 winhelp doesn't have mouse wheel
support and now ours does. We rule!

Mike Hearn <mike at theoretic.com>
Implement mouse wheel support in winhelp

--- ../head/programs/winhelp/winhelp.c  2003-09-11 16:27:16.000000000 +0100
+++ programs/winhelp/winhelp.c  2003-09-15 21:48:49.000000000 +0100
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
+#include <stdlib.h>
  
 #include "windef.h"
 #include "winbase.h"
@@ -811,6 +812,36 @@
         if (!(winpos->flags & SWP_NOSIZE)) WINHELP_SetupText(hWnd);
         break;
  
+    case WM_MOUSEWHEEL:
+    {
+       int wheelDelta = 0;
+       UINT scrollLines = 3;
+       int curPos = GetScrollPos(hWnd, SB_VERT);
+       int min, max;
+
+       GetScrollRange(hWnd, SB_VERT, &min, &max);
+
+       SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0, &scrollLines, 0);
+       if (wParam & (MK_SHIFT | MK_CONTROL))
+           return DefWindowProc(hWnd, msg, wParam, lParam);
+       wheelDelta -= SHIWORD(wParam);
+       if (abs(wheelDelta) >= WHEEL_DELTA && scrollLines) {
+           int dy;
+
+           curPos += wheelDelta;
+           if (curPos > max)
+                curPos = max;
+           else if (curPos < min)
+                curPos = min;
+
+           dy = GetScrollPos(hWnd, SB_VERT) - curPos;
+           SetScrollPos(hWnd, SB_VERT, curPos, TRUE);
+           ScrollWindow(hWnd, 0, dy, NULL, NULL);
+           UpdateWindow(hWnd);
+       }
+    }
+    break;
+
     case WM_VSCROLL:
     {
        BOOL  update = TRUE;





More information about the wine-patches mailing list