--- ap_Win32Frame.cpp.old	Fri Nov 29 09:18:28 2002
+++ ap_win32frame.cpp	Mon Feb 17 06:22:02 2003
@@ -1026,30 +1026,43 @@
  	{
  		// Get delta
  		const int iDelta = (short) HIWORD(wParam);
+		const int cWheelLines = GetMouseWheelLines();

- 		// Calculate the movement offset to an integer resolution
- 		const int iMove = (iDelta * GetMouseWheelLines()) / WHEEL_DELTA;
+		if (WHEEL_PAGESCROLL == cWheelLines)
+		{
+			WORD wDir = (iDelta < 0) ? SB_PAGEDOWN : SB_PAGEUP;
+			SendMessage(hwnd,
+						WM_VSCROLL,
+						MAKELONG(wDir, 0),
+						NULL);
+		}
+		else
+		{
+			// Calculate the movement offset to an integer resolution
+			const int iMove = (iDelta * cWheelLines) / WHEEL_DELTA;

- 		// Get current scroll position
- 		SCROLLINFO si = { 0 };
+			// Get current scroll position
+			SCROLLINFO si = { 0 };

- 		si.cbSize = sizeof(si);
- 		si.fMask = SIF_ALL;
- 		f->_getVerticalScrollInfo(&si);
+			si.cbSize = sizeof(si);
+			si.fMask = SIF_ALL;
+			f->_getVerticalScrollInfo(&si);

- 		// Clip new position to limits
- 		int iNewPos = si.nPos - (iMove * SCROLL_LINE_SIZE);
- 		if (iNewPos > si.nMax) iNewPos = si.nMax;
- 		if (iNewPos < si.nMin) iNewPos = si.nMin;
+			// Clip new position to limits
+			int iNewPos = si.nPos - (iMove * SCROLL_LINE_SIZE);
+			if (iNewPos > si.nMax) iNewPos = si.nMax;
+			if (iNewPos < si.nMin) iNewPos = si.nMin;

- 		if (iNewPos != si.nPos)
- 		{
- 			// If position has changed set new position
- 			SendMessage(hwnd,
- 						WM_VSCROLL,
- 						MAKELONG(SB_THUMBPOSITION, iNewPos),
- 						NULL);
- 		}
+			if (iNewPos != si.nPos)
+			{
+				// If position has changed set new position
+				iNewPos >>= f->m_vScale;
+				SendMessage(hwnd,
+							WM_VSCROLL,
+							MAKELONG(SB_THUMBPOSITION, iNewPos),
+							NULL);
+			}
+		}
	}
	return 0;